CH 01
CH 01
Chapter 01
Introducing Computer
Programming
Intended Learning Outcomes
• Describe the purpose of the microprocessor's instruction set
• Explain the relationship between the instruction set and
machine language
• List some common tasks that computer programs perform
• Describe what programmers do
• Summarize the stages of the software development cycle
• Explain the importance of writing and communications
• Distinguish high-level languages and machine language
• Distinguish between a compiler and an interpreter
• Contrast standalone and network applications
• Distinguish between programming and markup languages
Chapter 1
What is a Computer Program?
What is a Computer Program?
• A computer is a programmable machine.
Chapter 1
The Microprocessor
• Contains includes the set of basic operations
(opcodes) that the computer can execute.
• This instruction set constitutes the
computer’s machine language.
• Different microprocessors contain different
instruction sets: a program that executes on
one computer may not execute on another.
Chapter 1
What do Programs DO?
Common Program Tasks
• Programs use the instruction set to:
– Provide a Graphical User Interface (GUI)
– Read and write data (input and output)
– Resolve logical expressions (make decisions)
– Perform numerical calculations
– Perform text-processing operations
– Communicate with other programs and devices
– Control hardware
Chapter 1
What do Programmers DO?
What do Programmers DO?
Programmers combine logic and creative thinking
to:
• Evaluate requirements
• Design applications
• Develop algorithms
• Code applications (write programs)
• Test applications (again, and again, and..)
• Provide user support and training
• Document and maintain software
Chapter 1
Evaluate Requirements
• Determine what a program should do:
– Read and listen carefully
– Ask questions
– Document thoroughly
• Critical for application development, why?
• Skills: read, listen, ask questions, document,
communicate effectively
Chapter 1
Design Applications
• Applications are often broken down into
multiple modules.
– Each module is developed separately by
programmers with most appropriate skills.
– Modules are developed concurrently.
– Some modules are reusable (can be used by
multiple applications).
– Each module is individually tested and
maintained.
Chapter 1
Designing Applications:
Client/Server Design
• Client applications:
– Provide an interface for the user.
– Call server applications as needed to process user
requests.
• Server applications:
– Receive requests from client applications.
– Process each request.
– Send back a response to the client application.
Chapter 1
Designing Applications:
Web Applications
• A Web application is an example of a
client/server application.
– Browser (client) sends a request when you click a
link, submit a form, or type a URL.
– The Web server receives and processes the
request, then returns the requested page.
– Your Web browser displays the Web page.
• We will develop many small Web applications.
Chapter 1
Designing Applications:
Client/Server Example
Chapter 1
Designing Applications:
Object Oriented Programming
• A modular design approach that is important
inmost modern software design.
• Introduced in Chapter 15
Chapter 1
Algorithm Development
• Before coding, a design is first converted into
algorithms.
• An algorithm is a set of unambiguous
instructions to perform a specific task.
• Algorithms are written as pseudocode, a mix of
English and programming language syntax that
programmers can understand.
• Pseudocode can be easily translated into any
programming language.
• Skills: attention to detail, logic, writing,
programming.
Chapter 1
Application Coding
• The algorithm for each application module is
coded into a programming language.
• Each module must be carefully tested to
ensure that it performs as expected.
• Skills: knowledge of programming languages,
coding, testing, debugging, writing, patience,
thoroughness, attention to detail.
Chapter 1
Application Testing
• Applications must be tested for correctness.
– Testing requires patience, attention to detail, and
thoroughness.
• Application must also be tested for usability.
– How do users respond? A well-written and correct
application may not be easy to understand or use.
• Skills: patience, thoroughness, attention to
detail, observation, humility!
Chapter 1
User Support, Training,
Software Maintenance
• Online and printed documentation for users.
• Documentation for software maintenance.
• Training materials and workshops.
• Software fixes and updates.
• Help desk support/troubleshooting.
• Skills: communication with technical and non-
technical people, ability to listen and explain,
patience, sense of humor!
Chapter 1
What is the Software
Development Cycle?
Software Development Cycle
• Evaluate requirements
• Design application
• Develop algorithms
• Code application
• Test application
• User support and software maintenance
Chapter 1
Career Paths
• Different steps in the software development
cycle can actually be career paths:
– Software designer
– Interface or graphics designer
– Application programmer, Web programmer
– Documentation specialist
– User support/trainer, usability expert
– Software tester
Chapter 1
What are Programming
Languages?
What are Programming Languages?
• A program is a sequence of instructions.
• The computer only understands its own machine
language (ML).
– ML is too low-level and time-consuming for
programmers to use.
• Programmers use high-level programming
languages.
– Each language consists of special words, symbols and
operators.
– Examples: C++, C#, Java, Ruby, BASIC, COBOL,
Fortran, Pascal, PHP, Python, perl, Android, iOS.
Chapter 1
Compilers and Interpreters
• A program written in a programming language
is referred to as source code.
– But source code cannot execute!
• The source code must be translated into
machine language in one of two ways:
– Using a language compiler.
– Using a language interpreter.
• Which one depends on the language used..
Chapter 1
Compiler-Based Languages
• The entire source code is compiled into an
executable file. The executable file:
– Contains machine language instructions.
– Can be distributed to end users for installation.
• The original source code is not distributed.
• Changes to the source code must be re-
compiled and the new version re-distributed.
• C++ is an example of a compiled language.
Chapter 1
Interpreter-Based Languages
• The source code is translated and executed by
the interpreter one line at a time:
– The source code and the interpreter is required
whenever the program is to be executed.
• This works well for server-based applications:
– The server includes the interpreter and stores the
source code (so it doesn’t need to be distributed).
– The source code can be changed any time; the
interpreter always runs the latest version.
• PHP is an interpreter-based language, often used
for server-based Web applications.
Chapter 1
Why So Many Languages?
• Different languages are designed for different
purposes.
– Java is designed as an object oriented language.
– PHP is designed for Web applications.
• New languages incorporate current design
strategies and may be optimized for specific
hardware or types of application.
• Many languages have a fairly similar syntax.
Chapter 1
What are Standalone and Network
Applications?
Standalone Applications
• A standalone application provides a complete
service on a local computer:
– Software is installed locally, usually compiled
– Interacts only with the computer’s operating
system, local hardware, and other local software.
– Examples are: word-processors, spreadsheets,
some games, image-processing software..
• Increasingly standalone applications include
network connectivity (updates, etc).
Chapter 1
Networked Applications
• A networked application runs on multiple
computers that interact over a network.
– Host/terminal applications: a host computer
delivers screens and programs to user terminals.
– Client/server applications: client programs submit
requests for processing by server programs.
– Server/server applications: server programs
process request from other server programs,
usually interpreted.
Chapter 1
What are Markup Languages?
Markup Languages
• A programming language provides syntax and
instructions to process data and run programs.
• A markup language provides syntax and
instructions to display, describe, or format data.
• Markup languages use tags to indicate the
purpose or appearance of text elements.
• When you select text in a word-processor and
mark the text as bold or indented or red, you are
using a markup language.
Chapter 1
HTML
Chapter 1
HTML and PHP
• You will learn basic program syntax, logic and
design using a combination of two languages:
– HTML markup language to format Web pages
and create user interfaces.
• You will also learn to use a style sheet language (CSS) to
define format styles .
– PHP programming language to process data and
generate results.
• You will also learn the basics of a database query
language (SQL) to work with databases.
Chapter 1
Chapter 1