Chapter 10: Behind the Scenes: Building Applications
Understanding Software Programming
Why would I ever need to create a program?
If the program does not already exist
If I’m not going to be a programmer, why do I need to know some programming?
Macros are custom built miniprograms
- Enable you to customize and automate various features of a software
- Can execute a complicated sequence of steps with a single command
The Life Cycle of an Information System
A system is a collection of pieces working together to achieve a common goal
An information system includes data, people, procedures, hardware, and software
System development life cycle (SDLC) is a ‘set of steps’ or organized process to
ensure that development proceeds in an orderly fashion
System Development Life Cycle
Why do I need a process to develop a system?
These programs are much more complex and…
- Need to be available for multiple operating systems
- Work over networked environments
- Be free of errors and well supported
What steps constitute the SDLC?
There are six steps often referred to as a waterfall system
1. Problem and opportunity identification: corporations generating ideas
2. Analysis: analysts explore in depth the problem to be solved and develop a
program specification (statement of goals and objectives)
3. Design: generating a detailed plan for programmers to follow
- Flowcharts are visual diagrams of a process
- Data-flow diagrams trace all data in an information system
4. Development and documentation: phase in which actual programming
takes place, also the first part of the program development life cycle (PDLC)
5. Testing and installation: testing the program to ensure it works properly
6. Maintenance and evaluation: performance must be monitored, bugs must
be detected, additional enhancements
The Life Cycle of a Program
What is programming?
Programming is the process of translating a task into a series of commands a
computer will use to perform that task - Identifying which parts of a tasks a computer can perform
- Describing those tasks in a highly specific and complete manner
- Translating this description into the language spoken by the computer’s
central processing unit (CPU)
How do programmers tackle a programming project?
Program development life cycle (PDLC)
1. Describing the problem: problem statement identifies the task to be
automated and describes hoe the software program will behave
2. Making a plan: problem is translated into steps (algorithms)
3. Coding: algorithm is translated into programming code
4. Debugging: programmers find and repair any errors in the code
5. Finishing the project: software is tested by programmers and clients
Describing the Problem: The Problem Statement
The problem statement is the starting point of programming work
- Is a clear description of what tasks the computer program must accomplish
and how the program will execute these tasks and respond to unusual
How do programmers create problem statements?
1. Data; the raw input users have at the start of the job, will be fed into program
2. Information: the result (output) that the users require at the end of the job,
program produces this information from data
3. Method: process of how program converts the inputs into correct outputs
How do programmers handle bad inputs?
Problem statement describes what program should do if input is invalid or gibberish
- Referred to as error handling
Problem statement also includes a testing plan
- Lists specific input numbers program would typically expect user to enter
Is there a standard format for a problem statement?
Most companies have their own format
All statements include the same basic components;
- Data that is expected to be provided (inputs)
- The information that is expected to be produced (outputs)
- Rules for transforming the input into output (processing)
- Explanation of how program will respond to invalid entries (error testing)
- Testing plan
Making a Plan: Algorithm Development
How do programmers represent an algorithm?
Flowcharts provide the visual representation of patterns the algorithm comprises
- Microsoft Visio popular flowcharting program Pseudocode is a text-based approach to documenting an algorithm
- Words describe the actions an algorithm will take
Developing an Algorithm: Decision Making and Design
How do programmers develop an algorithm?
Convert the problem statement into a list of steps/actions the program will take
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
What kinds of decision points are there?
Two main types
1. Binary decisions (“fork-in-the-road”) can be answered only yes or no
2. Loop, a decision that is a repeating loop, has important features
a. An initial value
b. A set of actions
c. A test condition
Control structures is the general term for keywords in a programming language
that allow programmer to control (redirect) flow of the program based on a decision
How do programmers create algorithms for specific tasks?
1. Top-Down Design
- Top-down design is a systematic approach in which a problem is broken
into a series of high-level tasks
- Would indentify three high-level tasks
o Get input
o Process data
o Output results
2. 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
- Categories are called classes
o Further defined by
Actions (methods or behaviors)
o An object is an example programmers create of each class
- Leads to reusability
- Generates a family of classes for each project
- Inheritance means that a new class can automatically pick up all of the data
and methods of an existing class and then extend and customize those to fit
its own specific needs
- The original class is called the base class
- The new modified class is called the derived class Coding: Speaking the Language of the Computer
How is a person’s idea translated into CPU instructions?
Coding is the act of translating an algorithm into a programming language
- Translated into patterns of 1s and 0z to be understood by the CPU
How exactly do programmers move from algorithm to code?
Once the programmer identifies the required information and the flow of how it will
be changed by each step of the algorithm, he/she can begin to convert the algorithm
into computer code in a specific programming language
Categories of Programming Languages
What exactly is a programming language?
A programming language is a kind of “code” for the set of instructions the CPU
knows how to perform
What kinds of programming languages are there?
Programming languages are classified in major groupings called generations
How have modern programming languages evolved?
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
- 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
- Makes 3GL languages easier for humans to read
Structured Query Language (SQL) is a database programming language that is an
example of a fourth-generation language (4GL)
A fifth-generation language (5GL) is considered the most “natural”
- Problem is presented in a series of facts or constraints
- EX PROLOG; PROgrammingLOGic
Do programmers have to use a higher-level programming language to solve a
problem with a computer?
Will sometimes write a program directly in the CPU’s assembly language
Higher-level programming languages offer portability
- Moving completed solutions from one type of computer to another
Creating Code: Writing the Program
What happens first when you write a program? All inputs/outputs of a program need to be stored in RAM while program is running
Each input/output item the program manipulates is called a variable
- Needs to be announced early in the program so memory can be set aside
A variable declaration tells the operating system that the program needs to
allocate storage space in the RAM
Can programmers leave notes to themselves inside a program?
Often will insert a comment (or remark) into program code to explain the purpose
of a section of code, to i