28
Introduction to Computer Application (IC) • MH Room 517 • Time : 7:00-9:30pm

Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Embed Size (px)

Citation preview

Page 1: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Introduction to Computer Application (IC)

• MH Room 517

• Time : 7:00-9:30pm

Page 2: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Chapter 1

Introduction to Computers

Page 3: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Computer Languages

• To write a program for a computer, you must use a computer language

• History of Computer Languages:– Machine Languages (1940 - )– Symbolic Languages (1950 - )– High-level Languages (1965 -)– Natural Languages (1990 -)

Page 4: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 5: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Machine Languages• In the earliest days of computers, it is the only

programming languages available• Each computer (CPU) has its own machine

language - streams of 0s and 1s• An example is given in Figure ‘Program 1-1 of the

text book• The reason that the instruction must be in streams

of zeros and ones is that the internal circuit of a computer is made of switches, transistors, and other electronic devices that can be in one of two states: off and on

Page 6: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 7: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Symbolic Languages

• Machine Languages were not convenient to use• In 1950s, Grace Hopper, a mathematician

developed the concept of converting programs into machine language

• These early programming languages simply mirrored the machine languages using symbols, to represent the various machine language instructions

• See Program 1-2 for an example

Page 8: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 9: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Symbolic Languages

• However, a symbolic language is not understood by a computer, it must be translated to the machine language

• A special program called an assembler is used to translate symbolic code into machine language

• These symbolic languages are also known as assembly languages

Page 10: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

High-level Languages

• Symbolic Languages require programmers to concentrate on the hardware

• Working with symbolic languages was also very tedious because each machine instruction had to be individually coded

• High-level languages are written in plain english text which is more readable and understandable

• They are also portable to many different computers

Page 11: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

High-level Languages

• This allows the programmer to concentrate on the application problem at hand rather than the details of the computer

• They are designed to relieve the programmer from the details of the assembly language

• Similar to symbolic languages, high-level languages must be converted to machine language

• See Program 1-3 for an example

Page 12: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

• The computer understands only machine language• Procedure of turning a C program into machine

language:– Writing and Editing

– Compiling

– Linking (with required library modules)

• An executable file will then be formed

Page 13: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Writing and Editing• A text editor software is used to write and edit

programs• It helps to enter, change, and store character data• Differences between text processing and program

writing: programs are oriented around lines of code rather than characters and lines

• A text editor could be a generalized word processor• It is usually provided together with the compiler• The program text is stored as a source file

Page 14: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Compiling Programs• After a source file is stored on the disk, it needs to

be translated into machine language• This is the job of the compiler• The C compiler is actually two separate programs:

the preprocessor and the translator• The preprocessor reads the source code, scans for

special commands • It tell the compiler to look for special code

libraries, make substitutions in the code, and prepares for the translation

Page 15: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Compiling Programs• The result of preprocessing is called the translation

unit• After preprocessing, the translator does the work of

actually converting the program into machine language• It reads the translation unit and writes the resulting

object module to a file • An object module is the code in machine language• Even though the output of the compiler is machine

language code, it is not yet ready to run: i.e. not executable

Page 16: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Linking Programs

• A C program is made up of many functions• Some of these functions are written by you and are

a part of your source program• However, there are other functions, such as

input/output process and mathematical library functions, that exist elsewhere

• These must be attached through a linker which assemble all of these functions, yours and the systems’ into the final executable program

Page 17: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Execution• Once your program has been linked, it is ready for

execution• To execute your program under Visual C, press

Ctrl F5• Getting the program into memory is the function

of an operating system program known as the loader

• It locates the executable program and reads it into memory

Page 18: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

System Development• System Development is a critical process that

determines the overall quality and success of your program

• If you carefully design your program using good structured development techniques, your programs will be efficient, error free, and easy to maintain

• Large-scale, modern programming projects are built using a series of interrelated phases: system development life cycle

• One example is the waterfall model (Figure 1-11)

Page 19: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 20: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

System DevelopmentSystem requirements: defines requirements that

specify what the proposed system is to accomplish

Analysis: looks at different alternatives from a system point of view

Design: determines how the system will be built

Code: Actually process of program text writing

System Test: All of the programs are test together

Maintenance: keeps the system working

Page 21: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

• When you are given the assignment to develop a program, a program requirements statement will be given

• You should be given an overview of the complete project so that you will understand how your part fits into the whole

• You need to determine how to take the inputs and convert them into outputs : Program Design

• An example is given below

Page 22: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

Example: Calculate the square footage of your house

1st step: Understand the Problem:• What is the definition of square footage ?• How is the square footage going to be used ?

– For insurance purposes ?

– To paint the inside or outside of the house ?

– To carpet the whole house ?

• Is the garage included ?• Are closets and hallways included ?

Page 23: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

2nd step: Develop the solution:• Three tools will help

– Structured Charts

– Pseudocode

– Flowcharts

• A structure chart shows the functional flow through the program (Figure 1-12)

• Pseudocode is part English, part program logic, the purpose is to describe what the program being designed is to do

Page 24: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 25: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

• Pseudocode requires defining the steps to accomplish the task in sufficient detail so that they can be converted into a computer program

• See Program 1-4• Most of the statements in the pseudocode are

easily understood• Flowcharting: Appendix C of the text book

contains complete instructions for creating flowcharts

Page 26: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 27: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm
Page 28: Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm

Program Development

• Writing the program: Two approaches- Top-Down Design, Bottom-Up Design

• Test the Program: Testing can be a very tedious and time-consuming part of program development

• Two types of testing: Blackbox Testing, Whitebox testing

• Blackbox: testing the program without knowing what’s inside it

• Whitebox: Assumes that you know everything about the program