chapter 1

advertisement
CHAPTER 1
INTRODUCTION TO COMPUTERS
Computer Systems:
-
What is a computer?
It is a system made of two major components:
Hardware: The physical equipment
Software: The collection of programs (instructions) that allow the hardware to do its
job.
Computer Systems:
- The hardware component of the computer system consists of five parts:
1. Input Devices: is usually a keyboard where programs and data are entered into the
computer. Other examples: mouse, pen.
2. Central Processing Unit: executes instructions, such as arithmetic calculation,
comparisons among data, and movement of data inside the system.
3. Primary storage: a place where the programs and data are stored temporarily during
processing. Volatile.
4. Output Device: is usually a monitor or a printer where the output will be shown.
Output on a monitor is called a soft copy and on a printer is known as hard copy.
5. Auxiliary or Secondary Storage: is used for I/O. Information is stored permanently.
1
DR. G. ALKADI
Computer Software:
-
Is divided into two categories:
1. System Software: consists of programs that manage the hardware resources of a
computer and perform required information processing tasks. These programs
are divided into three classes:
a. Operating Systems: provides services such as a user interface, file and
database access, and interfaces to communication systems. Keeps the
system operating in an efficient manner while allowing the users access to
the system.
b. System Support Software: provides system utilities and other operating
services. Examples of system utilities are sort program and disk format
programs. Operating services consist of programs that provide
performance statistics for the operational staff and security monitors to
protect the system and data.
c. System Development Software: includes the language translators that
convert programs into machine language for execution, debugging tools to
assure that the programs are error-free, and computer-assisted software
engineering (CASE).
2. Application Software:
a. General-purpose software: is purchased from a software developer and
can be used for more than one application. Examples MS Word, Excel,
Access.
b. Application-specific software: can be used only for its intended purpose.
They cannot be used for other generalized tasks.
Computer Languages
-
-
-
Machine Language: The only language understood by a computer. The instructions
must be in stream of 0s and 1s b/c the internal circuit is made of switches,
transistors and other electronic devices that can be in one of two states off or on.
0 represents the off state and 1 represents the on state.
Symbolic Language: uses symbols, mnemonics, to represent various machine
language instructions.
Assembler: used to translate symbolic code into machine language.
High-level Languages: portable to many different computers, allowing the
programmer to concentrate on the application problem at hand rather than the
intricacies of the computer. Must be translated to machine language “compiled.”
The following is a multiplication program:
2
DR. G. ALKADI
//
/*
P01-03 The multiplication program in C++
This program reads two integer numbers from the keyboard and prints their product.
Written by: Author
Date:
11-23
*/
#include <iostream.h>
int main (void)
{
//
Local Declarations
int number1;
int number2;
int result;
//
}
/*
Statements
cin >> number1;
cin >> number2;
result = number1 * number2;
cout << result;
return 0;
// main
Results
35
15
*/
Writing, Editing, Compiling and Linking Programs:
-
Text Editor: used to write the program and allows user to enter, change and store
data.
After you complete a program, you save your file to disk. The file is known as
source file.
Compiler: translate the source file into machine language. C++ compiler has two
components:
1. Preprocessor:
 Reads the source code and prepares it for the translator. It scans
for special commands known as preprocessor directives.
 These directives tell the preprocessor to look for special libraries,
make substitutions in the code, and in other ways prepare for the
code for translation into machine language.
 The result is the translation unit.
2. Translator:
 Converts the program into machine language.
 Reads the translation unit and writes the resulting object modules
to a file that can be combined with other precompiled units to form
the final program.
3
DR. G. ALKADI
-
Linking Programs: The linker assembles I/O functions, and mathematical library
functions that exist elsewhere and must be attached to your program.
Program Execution:
- Once the program is linked, it is ready for execution. A system command, such as
run, loads your program into primary memory and executes it.
- The loader brings the program into memory.
System Development:
- System development Life Cycle “Waterfall Model”:
1. Systems Requirements: The systems analyst defines requirements that specify
what the proposed system is to accomplish.
2. Analysis: Looks at different alternatives from a system point of view.
3. Design: determines how the system will be built. The functions of the individual
programs that will make up the system are determined, and the design of the
files and/or the databases is completed.
4. Code: programs are written. This is what we are going to discuss in class.
5. System Test: All of the programs are tested together to make sure the system
works as a whole.
6. Maintenance: focuses on keeping the system working once it has been put into
production.
4
DR. G. ALKADI
Program Development:
- It is a multi-step process that requires you understand the problem, develop a
solution, write the program, and then test it.
Understand the Problem:
- Begin by reading the requirements statement carefully.
Develop the Solution:
Three tools will help you in the task:
1. Structure Chart:
a. Shows the functional flow through your program. It shows how you are
going to break your program into logical steps; each step will be a
separate module.
b. This step is done before you write your program.
c. Structured walk through: you will walk your review team through your
structure chart to show how you are planning to solve the objectives of
your programs.
d. The intent of the review is to increase quality and save time. The
earlier a mistake is detected, the easier is to fix it.
2. Pseudocode: Is part English, part logic. It describes precisely what the
program being designed is to do.
3. Flowchart: Appendix C on Page 754 shows the instructions for creating
flowcharts.
Test the Program: can be very tedious and time-consuming part of program
development. Two types of testing:
1. Blackbox testing: is done by the system test engineer and the user.
a. Testing the program without knowing what is inside it.
b. Blackbox test plans are developed by looking only at the requirements
statement.
2. Whitebox testing: is the responsibility of the programmer.
a. Assumes that the tester knows everything about the program.
b. The programmer knows exactly what is going inside the program by
testing every possible situation.
Errors: There are three general classifications of errors:
1. Specification Errors: occurs when the problem definition is either incorrectly
stated or misinterpreted. Should be caught during formal blackbox testing.
2. Code Errors: usually generate a compiler error message. They are the
easiest to correct.
3. Logic Errors: most difficult to find and correct. Can be corrected only by
thorough blackbox testing.
http://cs.selu.edu/~jhowatt/161/getdevcpp.html
5
DR. G. ALKADI
Download