Understanding Computers: Today and Tomorrow, 13th Edition Chapter 13: Program Development and Programming Languages
Understanding Computers: Today and Tomorrow, 13th Edition
Chapter 13:
Program Development andProgramming Languages
Understanding Computers: Today and Tomorrow, 13th Edition2
Learning Objectives
1.
2.
3.
Understand the differences between structuredprogramming, object-oriented programming (OOP),aspect-oriented programming (AOP), and adaptivesoftware development.Identify and describe the activities involved in theprogram development life cycle (PDLC).Understand what constitutes good program design andlist several tools that can be used by computerprofessionals when designing a program.
Understanding Computers: Today and Tomorrow, 13th Edition3
Learning Objectives
4.
5.
6.
7.
Explain the three basic control structures and how theycan be used to control program flow during execution.
Discuss some of the activities involved with debugginga program and otherwise ensuring it is designed andwritten properly.
List some tools that can be used to speed up orotherwise facilitate the program development process.
Describe several programming languages in use todayand explain their key features.
Understanding Computers: Today and Tomorrow, 13th Edition4
Overview
•–
–
–
–
–
This chapter covers:The most common approaches to program designand developmentThe phases of the program development life cycle(PDLC)Tools that can be used to design and develop aprogramGood program design techniques and types ofprogram errorsCommon programming languages
Understanding Computers: Today and Tomorrow, 13th Edition5
Approaches to Program Design andDevelopment
•
–
–
–
–
Procedural programming: An approach to programdesign in which a program is separated into smallmodules that are called by the main program or anothermodule when needed
Uses procedures (modules, subprograms): Smallersections of code that perform specific tasksAllows each procedure to be performed as manytimes as needed; multiple copies of code not neededPrior to procedural programming, programs were onelarge set of instructions (used GOTO statements)Structured programming: Goes even further, breakingthe program into small modules (Top-down design)
Understanding Computers: Today and Tomorrow, 13th Edition6
Approaches to Program Design andDevelopment
–
•
Variables: Named memory locationsthat are defined for a program
Used to store the current value ofdata items used in the program
Understanding Computers: Today and Tomorrow, 13th Edition7
Approaches to Program Design andDevelopment
•
–
–
–
–
–
Object-oriented programming (OOP): Programs consistof a collection of objects that contain data and methodsto be used with that data
Class: Group of objects that sharesome common propertiesInstance: An individual object in aclassAttributes: Data about the state ofan objectMethods: Perform actions on anobjectObjects can perform nontraditional actions and beeasily used by more than one program
Understanding Computers: Today and Tomorrow, 13th Edition8
Approaches to Program Design andDevelopment
•
–
•
––
–
Aspect-oriented programming (AOP): Separatesfunctions so program components can be developedand modified individually from one another
The components can be easily reused withseparate nonrelated objects
Adaptive software development: Designed to makeprogram development faster and more efficient andfocus on adapting the program as it is being written
Iterative and/or incrementalIncludes RAD (rapid application development) andextreme programming (XP)Agile software development: Focuses on buildingsmall functional program pieces during the project
Understanding Computers: Today and Tomorrow, 13th Edition9
The Program Development Life Cycle (PDLC)
•
•
Program development: The process of creatingapplication programsProgram development life cycle (PDLC): The processcontaining the five phases of program development
Understanding Computers: Today and Tomorrow, 13th Edition10
•
–
–
–
Problem analysis: The problem is considered and theprogram specifications are developed
Specifications developed during the PDLC arereviewed by the systems analyst and the programmer(the person who will code the program)Goal: To understand the functions the software mustperformDocumentation: Includes program specifications(what it does, timetable, programming language to beused, etc)
The Program Development Life Cycle (PDLC)
Understanding Computers: Today and Tomorrow, 13th Edition11
•
––
•
–•
––
Program design: The program specifications areexpanded into a complete design of the new program
Good program design is extremely importantProgram design tools
Structure charts: Depict the overall organization ofa program
Shown in Figure 13-1Flowcharts: Show graphically step-by-stephow a computer program will process data
Use special symbols and relational operatorsCan be drawn by hand or with flowchartingsoftware
The Program Development Life Cycle (PDLC)
Understanding Computers: Today and Tomorrow, 13th Edition12
Flowcharts
Understanding Computers: Today and Tomorrow, 13th Edition13
•
•
–
–
Pseudocode: Uses English-like statements to outlinethe logic of a programUnified Modeling Language(UML) Models: Set ofstandard notations forcreating business models
Widely used in object-oriented programsIncludes class diagrams,use case diagrams, etc.
The Program Development Life Cycle (PDLC)
Understanding Computers: Today and Tomorrow, 13th Edition14
Unified Modeling Language (UML) Models
Understanding Computers: Today and Tomorrow, 13th Edition15
The Program Development Life Cycle (PDLC)
–
•
•
––
•––
Control structure: A pattern for controlling the flow oflogic in a computer program, module, or method
Sequence control structure: Series of statementsthat follow one anotherSelection control structure: Multiple paths,direction depends on result of test
If-then-elseCase (avoids nested if-then-else statements)
Repetition control structure: Repeat series of stepsDo-whileDo-until
Understanding Computers: Today and Tomorrow, 13th Edition16
Control Structures
Understanding Computers: Today and Tomorrow, 13th Edition17
The Program Development Life Cycle (PDLC)
–••
–•
–
••
––
•–
Good program design:Is essentialSaves time
Good program design principles:Be specific
All things the program must do need to bespecified
One-entry-point/one-exit-point ruleNo infinite loops or other logic errors
Infinite loop: Series of steps that repeat foreverDesign should be tested to ensure logic is correct
Desk check; tracing tablesDocumentation: Includes design specifications
Understanding Computers: Today and Tomorrow, 13th Edition18
Good Program Design
Understanding Computers: Today and Tomorrow, 13th Edition19
Program Design Testing
Understanding Computers: Today and Tomorrow, 13th Edition20
Program Design Testing
Understanding Computers: Today and Tomorrow, 13th Edition21
The Program Development Life Cycle (PDLC)
•
–••••••
–
Program coding: The program code is written using aprogramming language.
When choosing a programming language, consider:Suitability to the applicationIntegration with other programsStandards for the companyProgrammer availabilityPortability if being run on multiple platformsDevelopment speed
Coding creates source code
Understanding Computers: Today and Tomorrow, 13th Edition22
Coding Standards
–
•
•–
––
–
•–
Coding standards: Rules designed to standardizeprogramming
Makes programs more readable and easier tomaintainIncludes the proper use of comments to:
Identify the programmer and last modificationdateExplain variables used in the programIdentify the main parts of the program
Reusable code: Pretested, error-free code segments thatcan be used over and over again with minormodifications
Can greatly reduce development timeDocumentation: Includes documented source code
Understanding Computers: Today and Tomorrow, 13th Edition23
Comments
Understanding Computers: Today and Tomorrow, 13th Edition24
The Program Development Life Cycle (PDLC)
•
–
••
•
Program debugging and testing: The process of ensuringa program is free of errors (bugs) and works as it issupposed to
Before they can be debugged, coded programs needto be translated into executable code
Source code: Coded program before it is compiledObject code: Machine language version of aprogramLanguage translator: Program that convertssource code to machine language
Understanding Computers: Today and Tomorrow, 13th Edition25
The Program Development Life Cycle (PDLC)
–•
•
•
Types of language translators:Compilers: Language translatorthat converts an entire programinto machine language beforeexecuting itInterpreters: Translates one lineof code at one timeAssemblers: Convert assemblylanguage programs intomachine language
Understanding Computers: Today and Tomorrow, 13th Edition26
The Program Development Life Cycle (PDLC)
•
−
•
Preliminary debugging: Finds initial errorsCompiler errors: Program doesn’t run
Typically syntax errors: When theprogrammer has not followed the rules ofthe programming language
Run time error: Error that occurs when theprogram is runningLogic errors: Program will run but produces
incorrect resultsDummy print statements can help locate logic
errors and other run time errors
Understanding Computers: Today and Tomorrow, 13th Edition27
Preliminary Debugging
Understanding Computers: Today and Tomorrow, 13th Edition28
Preliminary Debugging
Understanding Computers: Today and Tomorrow, 13th Edition29
The Program Development Life Cycle (PDLC)
–
••
•
••
–
Testing: Occurs after the program appears to becorrect to find any additional errors
Should use good test dataTests conditions that will occur when the programis implementedShould check for coding omissions (productquantity allowed to be < 0, etc.)Alpha test (inside organization)Beta test (outside testers)
Documentation: Completed program package (user’smanual, description of software commands,troubleshooting guide to help with difficulties, etc.)
Understanding Computers: Today and Tomorrow, 13th Edition30
The Program Development Life Cycle (PDLC)
•
–
–
•–
Program implementation and maintenance: Installingand maintaining the program
Once the system containing the program is up andrunning, the implementation process is completeProgram maintenance: Process of updating softwareso it continues to be useful
Very costlyDocumentation: Amended program package
Understanding Computers: Today and Tomorrow, 13th Edition31
Quick Quiz
1. Which approach to programming uses the concept ofinheritance?a. Proceduralb. Object-orientedc. Aspect-oriented
2. True or False: An infinite loop is an example of a logicerror.
3. A(n)______________________ is a program design tool thatshows graphically step-by-step the actions a computerprogram will take.
Answers:1) b; 2) True; 3) flowchart
Understanding Computers: Today and Tomorrow, 13th Edition32
Tools for FacilitatingProgram Development
•
–•
•
•
Application Lifecycle Management (ALM): Creating andmanaging an application during its entire lifecycle, fromdesign through retirement
Tools include:Requirements management: Keeping track of andmanaging the program requirements as they aredefined and then modifiedConfiguration management: Keeping track of theprogress of a program development projectIssue tracking: Recording issues such as bugs orother problems that arise during development orafter the system is in place
Understanding Computers: Today and Tomorrow, 13th Edition33
Tools for FacilitatingProgram Development
Understanding Computers: Today and Tomorrow, 13th Edition34
Tools for FacilitatingProgram Development
•
–
–
Application generator: Software program that helpsprogrammers develop software
Macro recorders: Record and play back a series ofkeystrokesReport and formgenerators: Tools thatenable individuals toprepare reports andforms quickly
Understanding Computers: Today and Tomorrow, 13th Edition35
Tools for FacilitatingProgram Development
•
•
––
•
–
Device software development tools: Assist withdeveloping embedded software to be used on devices,such as cars, ATM machines, consumer devices, etcSoftware development kits (SDKs): Designed for aparticular platform; enables programmers to developapplications more quickly and easily
Released by hardware or software companiese.g. iPhone SDK
Application Program Interfaces (APIs): Help applicationsinterface with a particular operating system
Often used in conjunction with Web sites
Understanding Computers: Today and Tomorrow, 13th Edition36
Tools for FacilitatingProgram Development
•
–
––
•
Rich Internet Application (RIA): Web-based applicationsthat work like installed software programs
Desktop RIA can access local files and used withoutan Internet connectionWeb-based RIAs are commonTools to develop RIAs
Adobe AIR
Understanding Computers: Today and Tomorrow, 13th Edition37
Quick Quiz
1. Which of the following is not an Application LifecycleManagement (ALM) tool?
a. Requirements definition softwareb. Code generatorc. Application program interface (API)2. True or False: A software development kit (SDK) is
designed for a particular platform and allows programmersto develop applications quickly for that platform.
3. A(n) ______________________ is often used to create theforms or input screens used to input data into a program ordatabase.
Answers:1) c; 2) True; 3) form generator
Understanding Computers: Today and Tomorrow, 13th Edition38
Programming Languages
•
–
•–
••
Programming language: A set of rules, words, symbols,and codes used to write computer programs
To write a program, you need appropriate software forthe programming language you will be using
Categories of programming languagesLow-level languages: Difficult to code in; machinedependent
Machine language: 1s and 0sAssembly language: Includes some names andother symbols to replace some of the 1s and 0s inmachine language
Understanding Computers: Today and Tomorrow, 13th Edition39
Programming Languages
Understanding Computers: Today and Tomorrow, 13th Edition40
Programming Languages
–••
•
–
••
High-level languages: Closer to natural languagesMachine independentIncludes 3GLs (FORTRAN, BASIC, COBOL,C, etc.)and object-oriented languages (Visual Basic, C#,Python, Java, etc.)Visual or graphical languages: Use graphicalinterface to create programs
Fourth-generation languages (4GLs): Even closer tonatural languages and easier to work with thanhigh-level
Declarative rather than proceduralIncludes structured query language (SQL) usedwith databases
Understanding Computers: Today and Tomorrow, 13th Edition41
Online Video
“Introducing the Scratch Graphical Programming Language”(click below to start video)
Reminder: The complete set of online videos and video podcasts are available at:www.cengage.com/computerconcepts/np/uc13
Scratch is developed by theLifelong KindergartenGroup at the MIT MediaLab. See http://scratch.mit.edu
Understanding Computers: Today and Tomorrow, 13th Edition42
Common Programming Languages
•
–
–
FORTRAN: High-levelprogramming languageused for mathematical,scientific, and engineeringapplications
Efficient for math,engineering andscientific applicationsStill used today forhigh-performancecomputing tasks(weather forecast)
Understanding Computers: Today and Tomorrow, 13th Edition43
Common Programming Languages
•––
–
COBOL: Designed for business transaction processingMakes extensive use of modules and submodulesBeingphased outin manyorganizationsEvolving(COBOL.NET)
Understanding Computers: Today and Tomorrow, 13th Edition44
Common Programming Languages
•
–
Pascal: Created as a teaching tool to encouragestructured programming
Contains a variety of control structures used tomanipulate modules systematically
Understanding Computers: Today and Tomorrow, 13th Edition45
Common Programming Languages
•
–
BASIC: Easy-to-learn, high-level programming languagethat was developed to be used by beginningprogrammers
Visual Basic: Object-oriented version of BASIC; uses avisual environment
Understanding Computers: Today and Tomorrow, 13th Edition46
Common Programming Languages
•••
•
C: Designed for system programmingC++: Object-oriented versions of CC#: Used for WebapplicationsObjective-C:For iPhone andother Appleapplications
Understanding Computers: Today and Tomorrow, 13th Edition47
Common Programming Languages
•
––
–•
–
Java: High-level, object-oriented programming languagefrequently used for Web-based applications
Java programs are compiled into bytecodeCan run on any computer that includes Java VirtualMachine (Java VM)Can be used to write Java applets
Scroll text on Web page, games, calculators, etcIs one of the most popular programming languagestoday
Understanding Computers: Today and Tomorrow, 13th Edition48
Common Programming Languages
Understanding Computers: Today and Tomorrow, 13th Edition49
Common Programming Languages
•
––
Python: Open-source, dynamic, object-oriented languagethat can be used to develop a variety of applications
Gaming, scientific, database, and Web applicationsOnly recently gaining a following
Understanding Computers: Today and Tomorrow, 13th Edition50
Common Programming Languages
•
–
Ruby: Open-source, object-oriented language that can beused to create general-purpose or Web applications
Uses a syntax that is fairly easy to read and write,allowing programmers to create database-driven Webapplications easily and quickly
Understanding Computers: Today and Tomorrow, 13th Edition51
Quick Quiz
1. An example of a high-level programming language is______________________.a. Pascalb. Assembly languagec. Machine language
2. True or False: Visual Basic is an object-oriented version ofCOBOL.
3. Java applets are small programs written in the______________________ programming language.
Answers:1) a; 2) False; 3) Java
Understanding Computers: Today and Tomorrow, 13th Edition52
Summary
••••
Approaches to Program Design and DevelopmentThe Program Development Life Cycle (PDLC)Tools for Facilitating Program DevelopmentProgramming Languages