Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 10 Behind the Scenes: Software Programming

Similar presentations


Presentation on theme: "Chapter 10 Behind the Scenes: Software Programming"— Presentation transcript:

0 Alan Evans • Kendall Martin
Technology in Action Alan Evans • Kendall Martin Mary Anne Poatsy Ninth Edition Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

1 Chapter 10 Behind the Scenes: Software Programming
Technology in Action Chapter 10 Behind the Scenes: Software Programming In this behind-the-scenes chapter, we explore the stages of program development and survey the most popular programming languages. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

2 Chapter Topics Understanding software programming
Life cycle of an information system Life cycle of a program Programming languages Chapter topics include: Understanding software programming Life cycle of an information system Life cycle of a program Programming languages Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

3 Understanding Software Programming
Types of tasks that are candidates for automation: Routine Repetitive Work with electronic data Follow a series of clear steps When existing software cannot be found, programming is mandatory Every day we face a wide array of tasks. Some tasks are complex and need a human touch; others require creative thought and higher-level organization. Tasks that are repetitive, work with electronic information, and follow a series of clear steps are candidates for automation with computers. For users who cannot find an existing software product to accomplish a task, programming is mandatory. Even if you are not going to be a programmer, you need to know some programming. Many existing applications allow you to customize and automate various features using miniprograms called macros. By creating macros, you can ask the computer to execute a complicated sequence of steps with a single command. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

4 Life Cycle of an Information System
A collection of pieces working together to achieve a common goal An information system includes: Data People Procedures Hardware Software Generally speaking, a system is a collection of pieces working together to achieve a common goal. An information system includes data, people, procedures, hardware, and software. You interact with information systems all the time, whether you are at a grocery store, bank, or restaurant. In any of these instances, the parts of the system work together toward a similar goal. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

5 System Development Life Cycle
To create modern software, an entire team is needed Programs require many phases to complete Must be available for multiple operating systems and work over networks Must be free of errors and well supported To create a modern software package, an entire team of people is needed, and a systematic approach is necessary. Those programs are generally far more complex than the ones you would write yourself, and they require many phases to make the product complete and marketable. They need to be available for multiple operating systems, work over networked environments, and be free of errors and well supported. Therefore, a process often referred to as the system development life cycle (SDLC) is used. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

6 Six Steps in the SDLC Because teams of individuals are required to develop systems, an organized process (or set of steps) needs to be followed to ensure that development proceeds in an orderly fashion. This set of steps is usually referred to as the system development life cycle (SDLC). There are six steps in the SDLC. This system is sometimes referred to as a “waterfall” system because each step is dependent on the previous step being completed first. Each step must be completed before you can progress to the next step. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

7 Problem & Opportunity Identification
Development steering committee formed to evaluate systems development proposals Reviews ideas Decides which projects to take forward based on available resources Personnel and funding In the Problem and Opportunity Identification phase, problems or opportunities are defined. Whether solving an existing problem or responding to an opportunity, corporations usually generate more ideas for systems than they have the time and money to implement. Large corporations typically form a steering committee to evaluate system development proposals and decide which projects to take forward. They then document the process, and relevant problems or opportunities are defined. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

8 Analysis Analysts explore problem to be solved
Develop program specifications Clear statement of goals and objectives of project Feasibility assessment is performed User requirements are defined Analysts recommend a plan of action In the Analysis phase, analysts explore the problem to be solved and develop a program specification. The program specification is a clear statement of the goals and objectives of the project at hand. It is also at this stage that the first feasibility assessment is performed. The feasibility assessment determines whether the project should go forward by looking at the needs and resources available and determining whether the project can be completed at all. Assuming the project is feasible, the analysis team studies the current system (if there is one) and defines the user requirements of the proposed system. Finally, the analysts recommend a solution or plan of action, and the process moves to the Design phase. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

9 Design A detailed plan for programmers is developed
Flowcharts and data-flow diagrams are used for the current and proposed system Data-flow diagram In the Design phase of the SDLC, a detailed plan for programmers to follow is developed. The current and proposed systems are documented using flowcharts and data-flow diagrams. Flowcharts are visual diagrams of a process, including the decisions that need to be made along the way. Data-flow diagrams trace all data in an information system from the point at which data enters the system to the point of its final resting place (storage or output). Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

10 Development and Documentation
Actual programming takes place First phase of the program development life cycle (PDLC) It is during this phase that actual programming takes place. This phase is also the first part of the program development life cycle (PDLC), described in detail in the rest of the chapter. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

11 Testing and Installation
Program is tested to ensure it works properly Program is installed for use The next step in the SDLC is testing the program to ensure it works properly and then installing the program so that it can be used. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

12 Maintenance and Evaluation
Performance of the system is monitored Corrections and modifications to the program are made Additional enhancements that users request are evaluated Appropriate program modifications are made Once the system is installed, its performance must be monitored to determine whether it is still meeting the needs of end users. Bugs (errors) that were not detected in the testing phase but that users discover subsequently must be corrected. Additional enhancements that users request are evaluated so that appropriate program modifications can be made. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

13 Joint Application Development
JAD helps designers adapt to changes in program specifications Includes customer involvement No communication delays Also referred to as: Accelerated design Facilitated team technique In each phase of the SDLC, a style of interaction named joint application development (JAD) is useful in creating successful, flexible results. JAD is popular because it helps designers adapt quickly to changes in program specifications. In JAD, the customer is involved in the project very closely, right from the beginning. Slow communication and lengthy feedback time are reasons the traditional development process is so time consuming. In JAD “workshops,” there are no communication delays. Workshops usually include end users, developers, subject experts, observers (such as senior management), and a facilitator. The facilitator enforces the rules of the meeting to make sure all voices are heard and agreement is reached as quickly as possible. Also called accelerated design or facilitated team technique, the goal of JAD is to improve design quality by fostering clear communication. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

14 Ethics in IT The Association of Computing Machinery (ACM) and the Institute of Electrical and Electronic Engineers (IEEE) have established eight principles for ethical software engineering practices: Public Client and Employer Product Judgment Management Profession Colleagues Self The ACM and the IEEE have established eight principles for ethical software engineering practices: Public: Software engineers shall act consistently with the public interest. Client and Employer: Software engineers shall act in a manner that is in the best interests of their client and employer consistent with the public interest. Product: Software engineers shall ensure that their products and related modifications meet the highest professional standards possible. Judgment: Software engineers shall maintain integrity and independence in their professional judgment. Management: Software engineering managers and leaders shall subscribe to and promote an ethical approach to the management of software development and maintenance. Profession: Software engineers shall advance the integrity and reputation of the profession consistent with the public interest. Colleagues: Software engineers shall be fair to and supportive of their colleagues. Self: Software engineers shall participate in lifelong learning regarding the practice of their profession and shall promote an ethical approach to the practice of the profession. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

15 The Life Cycle of a Program
Programming is the process of translating a task into a series of commands a computer will use to perform that task Programming involves: Identifying the parts of a task the computer can perform Describing tasks in a highly specific and complete manner Translating this description into a language understood by the computer’s CPU Programming is the process of translating a task into a series of commands a computer will use to perform that task. It involves -Identifying which parts of a task a computer can perform -Describing those tasks in a very specific and complete manner -Translating this description into the language spoken by the computer’s CPU. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

16 Program Development Life Cycle
Just as an information system has a development life cycle, each programming project follows a number of stages from conception to final deployment—sometimes referred to as the program development life cycle (PDLC). Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

17 Step 1: Describing the Problem
Programmers develop a complete description of problem Problem statement identifies task to be automated Statement describes how software will behave Describing the Problem: First, programmers must develop a complete description of the problem. The problem statement identifies the task to be automated and describes how the software program will behave. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

18 Step 2: Making a Plan Problem statement is translated into a set of specific, sequential steps known as an algorithm Algorithm is written in natural ordinary language such as English Making a Plan: The problem statement is next translated into a set of specific, sequential steps that describe exactly what the computer program must do to complete the work. The steps are known as an algorithm. At this stage, the algorithm is written in natural, ordinary language (such as English). Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

19 Step 3: Coding Algorithm is translated into programming code
Programmers must think in terms of operations that a CPU can perform Coding: The algorithm is then translated into programming code, a language that is friendlier to humans than the 1s and 0s that the CPU speaks but is still highly structured. By coding the algorithm, programmers must think in terms of the operations that a CPU can perform. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

20 Step 4: Debugging Code goes through process of debugging
Programmers repair any errors found in code Debugging: The code then goes through a process of debugging in which the programmers repair any errors found in the code. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

21 Step 5: Finishing the Project
Software is tested Programming team People who will use program Results of entire project are documented Users are trained to use program efficiently Finishing the Project: The software is tested by both the programming team and the people who will use the program. The results of the entire project are documented for the users and the development team. Finally, users are trained so that they can use the program efficiently. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

22 Describing the Problem
The Problem Statement Staring point of programming work Clear description of tasks the computer program must accomplish How the program will execute these tasks How the program will respond to unusual situations The problem statement is the starting point of programming work. It is a clear description of what tasks the computer program must accomplish and how the program will execute these tasks and respond to unusual situations. Programmers develop problem statements so that they can better understand the goals of their programming efforts. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

23 Creating Problem Statements
Programmers interact with users to describe three relevant things: Data – raw input users have at the start Information – result users require Method – process of how program converts the inputs to correct outputs Most computer users understand what jobs (or problems) they want to computerize but not the details of the programming process. Therefore, the goal in creating a useful problem statement is to have programmers interact with users to describe three things relevant to creating a useful program: data, information, and method. 1. Data is the raw input that users have at the start of the job. It will be fed into the program. 2. Information is the result, or output, that the users require at the end of the job. The program produces this information from data. 3. Method, described precisely, is the process of how the program converts the inputs into the correct outputs. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

24 Parking Garage Example
Program Goal: To compute the total pay for a fixed number of hours worked at a parking garage. Inputs: Number of Hours Worked a positive number Outputs: Total Pay Earned a positive number Process: The Total Pay Earned is computed as $7.50 per hour for the first eight hours worked each day. Any hours worked beyond the first eight are billed at $11.25 per hour. Error Handling: The input (Number of Hours Worked) must be a positive real number. If it is a negative number or other non-acceptable character, the program will force the user to re-enter the information. Testing Plan: INPUT OUTPUT NOTES 8 8*7.50 Testing positive input 3 3*7.50 12 8* *11.25 Testing overtime input –6 Error message/ask user to re-enter value Handling error All problem statements include the same basic components: 1. The input that is the data that will be entered. 2. The output that is the information that is expected to be produced. 3. The processing that is the rules for transforming the input into output. 4. The error handling that is the explanation of how the program will respond if the users enter data that doesn’t make sense. 5. The testing plan. In this table, we see a problem statement for the Parking Garage example. From here, the programmer can start to write code that satisfies the plan. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

25 Making a Plan Algorithm Development Set of specific sequential steps
Describe exactly what computer program must do to complete task Use natural language Once programmers understand exactly what the program must do and have created the final problem statement, they can begin developing a detailed algorithm, a set of specific, sequential steps that describe in natural language exactly what the computer program must do to complete its task. Let’s look at some ways in which programmers design and test algorithms. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

26 Flowchart Flowcharts provide a visual representation of the patterns an algorithm follows. Specific shape symbols indicate program behaviors and decision types. For example, diamonds indicate that a binary decision and branching action will be performed, and rectangles indicate a program instruction. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

27 Pseudocode Bold terms show actions that are common in programming, such as reading data, making decisions, printing, and so on. 1. Ask the user how many hours they worked today 2. If the number of hours worked < = 8, compute total pay without overtime otherwise, compute total pay with overtime pay 3. Print total pay Pseudocode is a text-based approach to documenting an algorithm. In pseudocode, words describe the actions that the algorithm will take. Pseudocode is organized like an outline, with differing levels of indentation to indicate the flow of actions within the program. Underlined words are information items that appear repeatedly in the algorithm. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

28 Developing the Algorithm
Decision Making and Design Convert problem statement into list of steps or actions Only simplest algorithms execute same series of actions every time they run Complex problems involve choices and include decision points When programmers develop an algorithm, they convert the problem statement into a list of steps (or actions) the program will take. For simple problems, this list is straightforward: The program completes this action first, that action second, another action third, and so on. However, only the simplest algorithms execute the same series of actions every time they run. Problems that are more complex involve choices and, therefore, cannot follow a sequential list of steps to generate the correct output. Instead, the list of steps created for complex problems includes decision points, places where the program must choose from an array of different actions based on the value of its current inputs. For example, a binary decision (shown in a flowchart as a diamond) will have two possible paths that can be taken, depending on the value of the inputs. Programmers convert a problem into an algorithm by listing the sequence of actions that must be taken and recognizing the places where decisions must be made. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

29 Top-Down Design Problem is divided into a series of high-level tasks
Detailed subtasks are created from high-level tasks Top-down design is a systematic approach in which a problem is broken down into a series of high-level tasks. In top-down design, programmers apply the same strategy repeatedly, breaking down each task into successively more detailed subtasks. They continue until they have a sequence of steps that are close to the types of commands allowed by the programming language they will use for coding. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

30 Object-Oriented Analysis
Classes (categories of inputs) are identified Classes are defined by information (data) and actions (methods or behaviors) Reusability is key A very different approach to generating an algorithm is object-oriented analysis. With object-oriented analysis, programmers first identify all of the categories of inputs that are part of the problem the program is trying to solve. These categories are called classes. For example, the classes in our parking garage example might include a TimeCard class and an Employee class. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

31 Writing Program Code Programmers select best programming language for the problem Translate the algorithm into that language Translation is act of coding Once programmers create an algorithm, they select the best programming language for the problem and then translate the algorithm into that language. Translating an algorithm into a programming language is the act of coding. Programming languages are (somewhat!) readable by humans but then are translated into patterns of 1s and 0s to be understood by the CPU. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

32 Generations of Programming Languages
Level Generation Example Low 1GL Machine 2GL Assembly High 3GL FORTRAN, BASIC, C, Java 4GL SQL Natural 5GL PROLOG A first-generation language (1GL) is the actual machine language of a CPU, the sequence of bits (1s and 0s) that the CPU understands. A second-generation language (2GL) is also known as an assembly language. Assembly languages allow programmers to write their programs using a set of short, English-like commands that speak directly to the CPU and give the programmer direct control of hardware resources. A third-generation language (3GL) uses symbols and commands to help programmers tell the computer what to do. This makes 3GL languages easier for humans to read and remember. Most programming languages today, including BASIC, FORTRAN, COBOL, C/C++, and Java, are considered third generation. Structured Query Language (SQL) is a database programming language that is an example of a fourth-generation language (4GL). Many other database query languages and report generators are also 4GLs. The following single SQL command would check a huge table of data on the employees and build a new table showing all those employees who worked overtime: Fifth-generation languages are considered the most “natural” of languages. In a 5GL, a problem is presented as a series of facts or constraints instead of as a specific algorithm. The system of facts can then be queried (asked) questions. PROLOG (PROgramming LOGic) is an example of a 5GL. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

33 Coding Speaking the Language of the Computer Syntax Keywords
Agreed-upon set of rules of language used Keywords Set of words with predefined meanings Data types Describe the kind of data being stored in memory Operators Coding symbols that represent fundamental actions Programming languages are evolving constantly. New languages emerge every year, and existing languages change dramatically. Therefore, it would be extremely difficult and time consuming for programmers to learn every programming language. However, all languages have several common elements: rules of syntax, a set of keywords, a group of supported data types, and a set of allowed operators. By learning these four concepts, a programmer will be better equipped to approach any new language. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

34 Compilation Compilation is the process of converting code into machine language A compiler reads the source code and translates it into machine language After compilation, programmers have an executable program Compilation is the process by which code is converted into machine language, the language the CPU can understand. A compiler is a program that understands both the syntax of the programming language and the exact structure of the CPU and its machine language. It can “read” the source code—the instructions programmers have written in the higher-level language—and translate the source code directly into machine language—the binary patterns that will execute commands on the CPU. At this stage, programmers finally have produced an executable program, the binary sequence that instructs the CPU to run their code. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

35 Interpreter Some programming languages do not have a compiler, but use an interpreter instead The interpreter translates source code into a line-by-line intermediate form Each line is executed before the next line is compiled Programmers do not have to wait for the entire program to be recompiled each time they make a change Programmers can immediately see the results of changes as they are making them An interpreter translates the source code into an intermediate form, line by line. Each line is then executed as it is translated. The compilation process takes longer than the interpretation process because in compilation, all of the lines of source code are translated into machine language before any lines are executed. The finished compiled program runs faster than an interpreted program because the interpreter is constantly translating and executing as it goes. Programmers can immediately see the results of their program changes as they are making them in the code. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

36 Coding Tools Integrated Development Environment
Developmental tool that helps programmers write, compile, and test programs Every language has its own specific IDE Modern programming is supported by a collection of tools that make the writing and testing of software easier. Compiler products feature an integrated development environment (IDE), a developmental tool that helps programmers write, compile, and test their programs. As is the case with compilers, every language has its own specific IDE. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

37 Debugging Getting Rid of Errors
Process of running program over and over To find errors To make sure the program behaves the way it should Once the program has compiled without syntax errors, it has met all of the syntax rules of the language. However, this doesn’t mean that the program behaves in a logical way or that it appropriately addresses the task the algorithm described. If programmers made errors in the strategy used in the algorithm or in how they translated the algorithm to code, problems will occur. The process of running the program over and over to find errors and to make sure the program behaves in the way it should is termed debugging . Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

38 Finishing the Project Testing and Documentation
Internal testing – a group with the software company uses program in every way possible External testing – people like those who will eventually purchase the program work with it Once debugging has detected all of the runtime errors in the code, it is time for users to test the program. This process is called internal testing. In internal testing, a group within the software company uses the program in every way it can imagine—including how it was intended to be used and in ways only new users may think up. The internal testing group makes sure the program behaves as described in the original testing plan. Any differences in how the program responds are reported back to the programming team, which makes the final revisions and updates to the code. The next round of testing is external testing. In this testing round, people like the ones that eventually will purchase and use the software must work with it to determine whether it matches their original vision. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

39 Programming Languages
Many languages for many projects Create a solution to meet several competing objectives Software must run quickly and reliably Simple to expand when demands change Completed on time for minimal cost Use smallest amount of system resources In any programming endeavor, programmers want to create a solution that meets several competing objectives. They want the software to run quickly and reliably and to be simple to expand later when the demands on the system change. They also want it to be completed on time and for the minimum possible cost, and to use the smallest amount of system resources possible. Because it will always be difficult to balance these conflicting goals, a wide variety of programming languages has been developed. Earlier in the chapter, you learned about the five main categories (generations) of programming languages. In this section, we discuss the specific programming languages that are members of these different generations. Although programming languages often share many common characteristics, each language has specific traits that allow it to be the best fit for certain types of projects. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

40 Selecting the Right Language
Programming team considers several factors Space available Speed required Organizational resources available Type of target application A programming team considers several factors before selecting the language it will use for a specific project. Space available: Not all languages produce code that takes up the same amount of space. Therefore, the target language should be well matched to the amount of space available for the final program. For example, if the program will be embedded in a chip for use in a cell phone, then it is important for the language to create space-efficient programs. Speed required: Although poorly written code executes inefficiently in any language, some languages can execute more quickly than others can. Some projects require a focus on speed rather than size. These projects require a language that produces code that executes in the fastest possible time. Organizational resources available: Another consideration is the resources available in a manager’s group or organization. Selecting a language that is easy to use and will be easy to maintain if there is a turnover in programmers is an important consideration. Managers also may factor in the existing pool of talent available for the project. Having to train five programmers to tackle a project in a new language would have significant disadvantages over allowing them to work in a familiar language. Type of target application: Certain languages are customized to support a specific environment (UNIX or Windows, for instance). Knowing which languages are most commonly used for which environments can be helpful. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

41 Building Applications
Programs often have a number of common features Scroll bars Title bars Text boxes Buttons Several languages include controls that make it easy to include these features Software programs that run under the Windows OS are extremely popular. These programs often have a number of common features—scroll bars, title bars, text boxes, buttons, and expanding or collapsing menus, to name a few. Several languages include customized controls that make it easy for programmers to include these features in their programs. The same is true for the OS/X operating system. We’ll look at tools that are helpful for building applications for each. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

42 Visual Basic 2010 Visual Basic 2010 is the current version
Builds object-oriented applications for: Windows The Web Mobile Devices Easy to drag and drop entire programming components into application Visual Basic 2010 is the current version of Visual Basic and is designed for building object-oriented applications for Windows, the Web, and mobile devices. Interface of Visual Basic makes it easy to drag and drop entire programming components into an application. Visual Basic 2010 provides a multitude of features that are new or an improvement on the previous versions. These changes make development with Visual Basic easier and produce more efficient code than with any earlier version. Visual Basic 2010 and the .NET Framework are both part of Visual Studio 2010, which provides a complete set of developer tools. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

43 C and C++ C C++ Developed for system programmers
Provides higher-level programming features if statements and for loops C++ Uses same symbols and keywords as C Better security Support for reuse of existing code Includes object-oriented design C was originally developed for system programmers. It provides higher-level programming language features (such as if statements and for loops) but still allows programmers to manipulate the system memory and CPU registers directly. This mix of high- and low-level access makes C very attractive to “power” programmers. Most modern operating systems (including Windows Vista, Windows 7, Mac OS X, and Linux) are written in C. C++ uses all of the same symbols and keywords as C, but extends the language with additional keywords, better security, and more support for the reuse of existing code through object-oriented design. Programmers often choose to learn C/C++ because their basic components (operators, data types, and keywords) are common to many other languages. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

44 Java and C# Java C# Object-oriented features
Large set of existing classes Architecture neutral Java applets: Small Java-based programs C# Completing program released by Microsoft Java’s object-oriented model enables Java programmers to benefit from its large set of existing classes. An attractive feature of Java is that it is architecture neutral. This means that Java code needs to be compiled only once, and it can run on many CPUs. The Java program does not care what CPU, OS, or user interface is running on the machine where it lands. This is possible because the target computer runs a Java Virtual Machine (VM), software that can explain to the Java program how to function on any specific system. A Java VM installed with Microsoft Internet Explorer, for example, allows Internet Explorer to execute any Java applets (small Java-based programs) it encounters on the Internet. Microsoft has released a language named C# (pronounced “see sharp”) that competes with Java. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

45 Objective C Language most often used to program applications to run under Mac OS X Object-oriented language Superset of the C language Often used with library called Cocoa Objective C is the language most often used to program applications to run under Mac OS X. It is an object-oriented style of language, a superset of the C language so it includes all of the keywords of C and then adds more keywords and features. It is often used together with a library called Cocoa. The Cocoa library, or framework, lets users program for the Mac OS X graphical user interface. The Cocoa Touch extension introduces a framework of methods that support gesture recognition for touch devices like the iPhone or iPad. Many different IDE tools support Objective C, but OS X ships with a tool named Xcode, that is often used to develop Objective C applications for OS X. The version 4 release of Xcode, is a paid application that can be purchased and downloaded from the online Mac App Store. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

46 Building Web Applications
HTML/XHTML HyperText Markup Language/eXtensible HyperText Markup Language Not a true programming language Uses special symbols (tags) to control how Web pages are viewed HTML/XHTML is not a programming language. Rather, HTML/XHTML is a series of tags that modify the display of text. HTML was the original standard defining these tags. XHTML is a newer standard that corrects some of the problems found in HTML. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

47 Scripting Languages for the Web
Simple programming language limited to performing a set of specialized tasks Scripts allow decisions to be made and calculations to be performed JavaScript, VBScript, and PHP work well with HTML To make their Web pages more visually appealing and interactive, programmers use scripting languages to add more power and flexibility to their HTML code. A scripting language is a simple programming language that is limited to performing a set of specialized tasks. Scripts allow decisions to be made and calculations to be performed. Several popular scripting languages work well with HTML, including JavaScript, VBScript, and PHP (Hypertext Preprocessor). Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

48 ASP, JSP, and PHP Used by programmers to build Web sites with interactive capabilities User supplies information that is translated into a request. Scripting code controls automatic writing of the custom page returned to user’s computer To build Web sites with interactive capabilities, programmers use Active Server Pages (ASP), JavaServer Pages (JSP), or the scripting language PHP (Hypertext Preprocessor) to adapt the HTML or XHTML page to the user’s selections. The user supplies information that is translated into a request by the main computer at the company that owns the Web site, often using a database query language such as SQL. Scripting code in ASP, JSP, or PHP controls the automatic writing of the custom HTML/XHTML page that is returned to the user’s computer. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

49 Flash and XML Adobe Flash XML (eXtensible Markup Language)
Used to develop Web-based multimedia Includes its own scripting language, ActionScript XML (eXtensible Markup Language) Enables designers to define data-based tags Makes it easier for Web site to transfer key information on its page to another site Adobe Flash is a software product used for developing Web-based multimedia. Flash includes its own programming language, ActionScript, which is very similar to JavaScript in its selection of keywords, operators, and classes. Microsoft has a competing product named Silverlight that supports the development of rich multimedia and interactive Web applications. XML (eXtensible Markup Language) enables designers to define their own data-based tags, making it much easier for a Web site to transfer the key information on its page to another site. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

50 AJAX Asynchronous JavaScript And XML
Allows creation of Web applications that can update information without requiring a page refresh Uses existing technologies to do more processing in the browser Users have a more responsive experience Other advances, like the collection of technologies referred to as AJAX (Asynchronous JavaScript And XML), and the continued evolution of HTML5 allow the creation of Web applications that can update information on a page without requiring the user to do a page refresh or leave the page. By using existing technologies to do more processing in the browser, users have a more responsive experience. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

51 Building Mobile Applications
Special languages and supporting tools help speed development of applications for mobile devices like smart phones and tablets Specific features include GPS capability, software keyboards, and touch-sensitive screens User interface must take smaller screen size into account Special languages and supporting tools are helping speed the development of applications for mobile devices like smartphones and tablets. Programmers need to be able to take advantage of specific features like GPS capability, a compass, software keyboards, and touch-sensitive screens. In addition, the user interface has to take the smaller screen size into account. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

52 The Next Great Language
Never easy to predict which language will become the next “great” language Experts predict that as projects grow in size, time to compile will also grow Interpreted languages could become more important because they have virtually no compile time Python, Ruby, and Smalltalk It is never easy to predict which language will become the next “great” language. Software experts predict that as software projects continue to grow in size, the amount of time needed to compile a completed project will also grow. It is not uncommon for a large project to require 30 minutes or more to compile. Interpreted languages, however, have virtually no compile time because compilation occurs while the code is being edited. As projects get larger, the capability to be compiled instantaneously will become even more important. Thus, interpreted languages such as Python, Ruby, and Smalltalk could become more important in the coming years. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

53 Chapter 10 Summary Questions
Why do I need to understand how to create software? 1. Why do I need to understand how to create software? Programming skills allow you to customize existing software products to accomplish tasks you need. Even if you are not planning to pursue programming as a career, a beginning-level knowledge of programming will let you create macros, customized mini-programs to speed up redundant tasks. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

54 Chapter 10 Summary Questions
What is a system development life cycle, and what are the phases in the cycle? 2. What is a system development life cycle, and what are the phases in the cycle? An information system includes data, people, procedures, hardware, and software. Teams of individuals are required to develop systems. Those teams need to follow an organized process (or set of steps) to ensure that development proceeds in an orderly fashion. This set of steps is usually referred to as the system development life cycle (SDLC). There are six steps in the SDLC waterfall model discussed earlier in this chapter: (1) A problem or opportunity is identified. (2) The problem is analyzed, and a program specification document is created to outline the project objectives. (3) A detailed plan for programmers to follow is designed using flowcharts and data-flow diagrams. (4) Using this plan, the program is developed and documented. (5) The program is tested to ensure that it works properly and is installed so that it can be used. (6) Ongoing maintenance and evaluation ensure a working product. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

55 Chapter 10 Summary Questions
What is the life cycle of a program? 3. What is the life cycle of a program? Each programming project follows several stages from conception to final deployment. The problem statement identifies the task to be computerized and describes how the software program will behave. An algorithm is developed that specifies the sequence of steps that the program must take to complete the work. The algorithm is then translated into highly structured programming code. The code goes through the processes of debugging, in which the programmers find and repair any errors in the code; testing by the programming team; and further testing by the people who will use the program. The results of the entire project are documented for the users and the development team. Finally, users are trained so that they can use the program efficiently. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

56 Chapter 10 Summary Questions
What role does a problem statement play in programming? 4. What role does a problem statement play in programming? The problem statement is an explicit description of what tasks the computer program must accomplish and how the program will execute these tasks and respond to unusual situations. It describes the input data that users will have at the start of the job, the output that the program will produce, and the exact processing that converts these inputs to outputs. In addition, the problem statement identifies potential errors and plans to address these errors. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

57 Chapter 10 Summary Questions
How do programmers create algorithms and move from algorithm to code? 5. How do programmers create algorithms and move from algorithm to code? For simple problems, programmers create an algorithm by converting a problem statement into a list of steps (or actions) the program will take. For more complex problems, programmers must identify where decision points occur in the list of steps. Some decisions are yes/no (binary), whereas others create a repeating action (loop). Algorithms are documented in the form of a flowchart or in pseudocode. Programmers use either top-down or object-oriented analysis to produce the algorithm. Computer code uses special words and strict rules to enable programmers to control the CPU without having to know all of its hardware details. Programming languages are classified in several major groupings, sometimes referred to as generations, with the first generation being machine language—the binary code of 1s and 0s that the computer understands. Assembly language is the next generation; it uses short, English-like commands that speak directly to the CPU and give the programmer direct control of hardware resources. Each successive generation in language development has relieved programmers of some of the burden of keeping track of what the hardware requires and more closely matches how humans think about problems. Compilation is the process by which code is converted into machine language, the language the CPU can understand. A compiler is a program that understands both the syntax of the programming language and the exact structure of the CPU and its machine language. It can translate the instructions written by programmers in the higher-level language into machine language, the binary patterns that will execute commands on the CPU. Each programming language has its own compiler. Separate versions are required to compile code that will run on each different type of processor. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

58 Chapter 10 Summary Questions
What steps are involved in completing the program? 6. What steps are involved in completing the program? If programmers make errors in the algorithm or in translating the algorithm to code, problems will occur. Programmers debug the program by running it constantly to find errors and to make sure the program behaves in the way it should. Once debugging has detected all the code errors, users, both within the company and outside the company, test the program in every way they can imagine—both as it was intended to be used and in ways only new users may think up. Before its commercial release, software is often provided at a reduced cost or no cost in a beta version to certain test sites or to interested users for a last round of testing. Once testing is complete, technical writers create internal documentation for the program and external documentation that will be provided to users of the program. User training, which begins once the software is distributed, teaches the user community how to use the software efficiently. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

59 Chapter 10 Summary Questions
How do programmers select the right programming language for a specific task? 7. How do programmers select the right programming language for a specific task? A programming team reviews several considerations before selecting the language. First, certain languages are best used with certain problems. Second, the target language should be well matched to the amount of space available for the final program. Third, some projects require the selection of a language that can produce code that executes in the fastest possible time. Finally, selecting a language with which the programmers are familiar is also helpful. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

60 Chapter 10 Summary Questions
What are the most popular programming languages for different types of application development? 8. What are the most popular programming languages for different types of application development? Visual Basic, C/C++, and Java are languages that enable programmers to include Windows control features such as scroll bars, title bars, text boxes, buttons, and expanding and collapsing menus. Objective C is a language used in programming applications to run under Mac OS X. Programmers use HTML/XHTML tags to structure for Web pages. For more complex Web development, scripting programs such as JavaScript and VBScript are popular. Web page animations are done with ASP, JSP, PHP, Flash, Silverlight and XML. Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

61 Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States of America. Copyright © 2012 Pearson Education, Inc.   Publishing as Prentice Hall


Download ppt "Chapter 10 Behind the Scenes: Software Programming"

Similar presentations


Ads by Google