Custom Search

15 June 2008

IT_Chapter_13A

What Is a Computer Program?

Computer programs

Also called software

Are a list of instructions

Instructions are called code

CPU performs the instructions

Three types

Operating system

Utility

Application

Software Is Stored In Many Files

Executable files

Contain the instructions for the CPU

Have extensions of .exe, or .com

Dynamic link libraries

Partial executable file

Used to support executable files

Have .dll extensions

Initialization files

Contain configuration settings for software

Have a .ini extension

Modern programs use the registry

Help files

Contain information about the software

Information is indexed and searchable

Provides an online manual

Have a .chm or .hlp extension

Batch files

Used to automate tasks

Hold a series of OS commands

Have a .bat extension

Hardware/Software Interaction

Program execution

Software executes at the CPU level

Code to play a sound

Code generates an interrupt

CPU tells the sound card to play

Sound card plays the file

Programmer creates the code

Code

Statements written in a programming language

Writing code can be tedious

Code must be perfect

Order of steps must be exact

Writing code is quite exciting

Problems are solved

New ideas are formed

Machine code

Recall that computers think in binary

Code is translated into machine code

CPU executes the machine code

CPUs have a unique machine code

Programming languages

Simplifies the writing of code

English is used to describe the binary

Original code is called source code

Several hundred languages exist

\

Compilers and interpreters

Converts source code into binary

Allows code to execute

Checks source code for correctness

Compiler

Creates an executable file

Contents are called object code

Executable can run on its own

Each language has its own compiler

C++ and Java are compiled languages

Interpreter

Runs program one line at a time

More flexible than compilers

Slower than compilers

Always needed to execute program

Visual Basic and Perl are interpreted

Planning a Computer Program

Plans

The steps to solve a problem

Describe the expected results

Programming without a plan is difficult

Planning Tools

Pseudo code

Natural language statements that
resemble code

Describes what must be done

Can be written by non programmers

Programmers develop unique versions

Input-processing-output (IPO) charts

Determines what is needed

Input column

Data inputted by the user

Processing column

Pseudo code describing the problem solution

Output column

Desired output from the program

How Programs Solve Problems

Program control flow

Order program statements are executed

Typically executed in order

Constructs can change the flow

Decision statements

Loops

Algorithm

Set of steps

Always leads to a solution

Steps are always the same

Flowcharts can describe algorithms

Structured tool for drawing algorithms

Algorithms appear in all programs

Heuristic

Set of steps

Solution is usually found

Solution may not be optimal

Used when algorithms fail

Algorithm is nonexistent or too complex

Appear in more complex applications

Data mining

Anti-virus software

Structured Programming

Programming using defined structures

Creates easy to read code

Programs are efficient and run fast

Several defined structures

Sequence structure

Describes the flow of the program

Typically executed in order

Branching statements allow multiple flows

Selection statement

Also called conditional statement

Performs a true or false test

Determines which code to execute next

Repetition statements

Also called looping structures

Repeats a section of code

Until an exit condition is reached

Object Oriented Programming

Also known as OOP

Enhances structured programming

Intuitive method of programming

Code reuse

Code used in many projects

Speeds up program development

Simplifies program development

Develops objects

All real world items are objects

OOP develops code versions

Contains data about the item

Contains functionality

Object encapsulates both into one package

No comments:

Post a Comment