Lecture 11 (1)
Lecture 11 (1)
Lecture # 11
Qurra-tul-ann
Department of Computer Science
GC University, Lahore
The slides are adapted from the publisher’s material
Understanding Computers: Today and Tomorrow
Overview
This chapter covers:
The most common approaches to program design and
development
The steps in the program development life cycle (PDLC)
Tools that can facilitate program development
Popular programming languages
2
Approaches to Program Design
and Development
Procedural programming: Focuses on the step-by-step
instructions that tell the computer what to do
Uses procedures (modules, subprograms): Smaller sections of
code that perform particular tasks
Allows each procedure to be performed as many times as needed
without requiring multiple copies of code
Prior to procedural programming, programs were one large set of
instructions containing statements that sent control to different parts
of the program as needed (i.e. GOTO statements)
Structured programming: Breaks the program into small chunks
• Top-down design
3
Approaches to Program Design
and Development
Variables: Named memory locations that are defined for a
program
• Used to store the current value of data items used in
the program
4
Approaches to Program Design
and Development
Object-oriented programming (OOP): Programs consist
of a collection of objects
Objects: Contain data and methods to be used with that data
Class: Group of objects that share some common properties
Instance: An individual object in a class
Attributes: Data about the state of an object
Methods: Perform actions on an object
5
Approaches to Program Design
and Development
Aspect-oriented programming (AOP): Breaks program
into small pieces that overlap in functionality as little as
possible
Program components can be developed and modified individually, and easily
reused
Adaptive software development: Designed to make
program development faster and more efficient and focus on
adapting the program as it is being written
Iterative: Cyclical approach that allows the repetition of steps and tasks as
needed
Incremental: Developing one piece at a time
Includes RAD (rapid application development) and extreme programming
(XP)
More recent adaptive software development approaches are called agile
software development
6
The Program Development Life
Cycle (PDLC)
Program development: The process of creating application
programs
Program development life cycle (PDLC):The steps involved
with creating programs:
7
Problem analysis: The problem is considered, and the
program specifications are developed
Specifications developed during the SDLC are reviewed by the
systems analyst and the programmer (the person who will code the
program)
Goal: To understand the functions the software must perform
Documentation: Includes program specifications (what it does,
timetable, programming language to be used, etc)
8
The Program Development Life
Cycle (PDLC)
Program design: The set of steps needed in order for the
program to perform the tasks it is supposed to perform (algorithm)
is developed
Good program design is extremely important
Program design tools
Structure charts: Depict the overall
organization of a program
Flowcharts: Show
graphically step-by-step
how a computer program
will process data
Use special symbols and
relational operators
9
The ProgramFlowcharts
Development Life
Cycle (PDLC)
10
The Program Development Life
Cycle (PDLC)
Pseudocode: Uses English-like statements to outline
the logic of a program
11
The Program Development Life
Cycle (PDLC)
Control structure: A Pattern for controlling the flow of logic in a
computer program
Sequence control structure: Series of statements that follow one
another
Selection control structure: Multiple paths, direction depends on
result of test
• If-then-else
• Case
Repetition control structure: Repeat series of steps
• Do-while
• Do-until
12
Control Structures
13
Control Structures
14
The Program Development Life
Cycle (PDLC)
Good program design:
Saves time
Creates better programs
Good program design principles:
Be specific
• All things the program must do need to be specified
One-entry-point/one-exit-point rule
No infinite loops or other logic errors
• Infinite loop: Series of steps that repeat forever
Design should be tested to ensure logic is correct
Desk check; tracing tables
Documentation: Includes design specifications
15
Good Program Design
16
Program Design Testing
17
The Program Development Life
Cycle (PDLC)
Program coding: The process of writing the programming
language statements to create a computer program
When choosing a programming language, consider:
Suitability to the application
Integration with other programs
Standards for the company
Programmer availability
Portability if being run on multiple platforms
Development speed
Coding creates source code
18
Coding Standards
Coding standards: A list of rules designed to standardize programming
styles
Make programs more universally readable and easier to maintain
Includes the proper use of comments to:
Identify the programmer and last modification date
Explain variables used in the program
Identify the main parts of the program
Reusable code: Generic code segments that can be used over and over again
with minor modifications
Can greatly reduce development time
Documentation: Includes documented source code
19
Coding Standards
20
The Program Development Life
Cycle (PDLC)
Program debugging and testing: The process of ensuring
a program is free of errors (bugs) and works as it is supposed
to
Before they can be debugged, coded programs need to be translated
into executable code
Source code: Coded program before it is compiled
Object code: Machine language version of a program
Language translator: Program that converts source code to
machine language
21
The Program Development Life
Cycle (PDLC)
Types of language translators:
Compilers: Combines program with other
object modules and creates a finished
executable program
Interpreters: Translates one line of
code at one time
Assemblers: Convert assembly language
programs into machine language
22
The Program Development Life
Cycle (PDLC)
Preliminary debugging: Finds initial errors
Compiler errors: Must be corrected before the logic of the
program can be tested
Syntax errors: Occur when the programmer has not followed
the rules of the programming language
• Program won’t run; usually an error message is displayed
Run time error: Occurs when the program is running
• Often logic errors: Program will run but produces incorrect
results
• Dummy print statements can help locate logic errors and other
run time errors
23
Preliminary Debugging
24
Preliminary Debugging
25
The Program Development Life
Cycle (PDLC)
Testing occurs after the program appears to be correct to find any additional
errors
Should use good test data
Tests conditions that will occur when the program is implemented
Should check for coding omissions (product quantity allowed to be < 0,
etc.)
Alpha test (inside organization)
Beta test (outside testers)
Documentation: Completed program package (user’s manual, description of
software commands, troubleshooting guide to help with difficulties, etc.)
26
The Program Development Life
Cycle (PDLC)
Program implementation and maintenance: Installing and
maintaining the program
Once the system containing the program is up and running, the
implementation process is complete
Program maintenance: Process of updating software so it continues to
be useful
• Very costly
Documentation: Amended program package
27
Tools for Facilitating Program
Development
Application Lifecycle Management (ALM): Creating and
managing an application during its entire lifecycle, from design
through testing
Tools include:
Requirements management: Keeping track of and managing the
information needs of users
• Requirements definition software
• Requirements management software
Configuration management: Keeping track of the progress of a
program development project
Program design tools to generate diagrams, code, etc.
28
Tools for Facilitating Program
Development
Application generator: Software product that enables users
to code new applications quickly
Macro recorders: Record and play back a series of keystrokes
Report and form generators: GUI tools that enable individuals to
prepare reports and forms quickly
29
Tools for Facilitating Program
Development
Device software development tools: Assist with
developing software to be used on devices, such as cars, ATM
machines, consumer devices, etc
Software development kits (SDK): Programming package
designed for a particular platform that enables programmers to
develop applications more quickly and easily
Released by hardware or software companies (Microsoft, Apple, etc.)
30
Programming Languages
Programming language: A set of rules used to write
computer programs
To write a program, you need appropriate software for the
programming language you will be using
Categories of programming languages
Low-level languages: Difficult to code in; machine dependent
• Machine language: 1s and 0s
• Assembly language: Includes some words and symbols
31
Programming Languages
32
Programming Languages
High-level languages: Closer to natural languages and so are easier to write
in
Machine independent
Includes third-level procedural languages such as FORTRAN,
BASIC, COBOL, Pascal, and C, as well as newer object-oriented
languages such as Visual Basic, C++, C#, Python, Ruby, and Java
Fourth-generation languages (4GLs): Even closer to natural languages and
easier to work with than 3GLs
Declarative rather than procedural
Includes structured query language (SQL) used with databases
33
Programming Languages
Natural programming languages: Users can communicate in their native
language
Doesn’t have to follow program syntax
In the infancy stage
Visual programming languages: Uses a visual programming environment
User can use mouse and graphical interface and the code is
automatically generated
Visual versions of many programming languages
Visual programming environment (VPE): Use visual elements to
assist in program development but still require some coding
34
Common Programming
Languages
FORTRAN: High-level programming language used for
mathematical, scientific, and engineering applications
Efficient for math
and scientific
applications
35
Common Programming
Languages
COBOL: Designed for business transaction processing
Makes extensive use of modules and submodules
Being phased out in many organizations
36
Common Programming
Languages
Pascal: Created as a teaching tool to encourage structured
programming
Contains a variety of control structures used to manipulate modules
systematically
37
Common Programming
Languages
BASIC: Easy-to-learn, high-level programming language that
was developed to be used by beginning programmers
Visual Basic: Object-oriented version of BASIC which helps programmers
quickly and easily create programs through the use of a visual environment
38
Common Programming
Languages
C: Designed for system programming
C++, and C#: Object-oriented versions of C
39
Common Programming
Languages
Java: High-level, object-oriented programming language
frequently used for Web-based applications
Platform independence is one of Java’s biggest advantages
Any operating system or browser that understands Java (compiled Java
programs) can run Java bytecode applications
Is one of the most popular programming languages today
40
Common Programming
Languages
41
Common Programming
Languages
Python: Open-source, dynamic, object-oriented language that
can be used to develop a variety of applications
Gaming, scientific, database, and Web applications
Only recently gaining a following
42
Common Programming
Languages
Ruby: Open-source, object-oriented language that can be used
to create general-purpose or Web applications
Uses a syntax that is fairly easy to read and write, allowing programmers to
create database-driven Web applications easily and quickly
43
Summary
Approaches to Program Design and Development
The Program Development Life Cycle (PDLC)
Tools for Facilitating Program Development
Programming Languages
44