Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
[CSE10200] Programming Basis
(프로그래밍 기초)
Lecture #2 - Chapter 1
Seungkyu Lee
Assistant Professor, Dept. of Computer Engineering
Kyung Hee University
Computer Systems
Computer Hardware
Computer Software
Types of software
Software
1.4
Computing Environments
Personal computing environment
Time-sharing environment
Time-sharing environment
Distributed computing
Computer language evolution
Why We Need High-Level Language
• Machine language: A binary-based language that a machine can understand
– Not human friendly
– Hardware dependent
Why We Need High-Level Language
• Assembly language: a one–to–one correspondence from a binary machine instruction to a more human-friendly mnemonics.
– Still quite hard for human programmers to develop big, structured program.
– Still hardware dependent
Why We Need High-Level Language
• High level language
– Getting away from hardware one code can be used for many different computers
– Strong abstraction from the details of the computer higher programming efficiency
– Natural language element easier to understand
The only language understood by a
computer is machine language.
Note:
Building a C++ program
Building a C++ program
Executing programs
My Exe.
Main memory
System development model
Program Development Process
1. Understand the problem
2. Develop a solution
3. Write a program
4. Test the program
An old programming proverb:
Resist the temptation to code.
Note:
1. Understand the Problem
Calculate the square meters of your house.
What is the definition of square meter? How is the square meter going to be used? -for insurance purposes? -to paint ? … Is the garage included? -…
2. Develop a Solution
• Structure chart
– Hierarchy chart
– Each step will be a separate module.
2. Develop a Solution
Algorithm Calculate Bathrooms 1 prompt user and read linoleum price 2 prompt user and read number of bathrooms 3 set total bath areas and baths processed to
zero 4 while ( baths processed < number of
bathrooms) 1 prompt user and read bath length and
width 2 total bath area =
3 total bath area + bath length * bath width
4 add 1 to baths processed 5 end while 6 bath cost = total bath area * linoleum price 7 return bath cost 8 end Algorithm Calculate Bathrooms
Pseudocode
A precise algorithmic
description of program
logic
Flowchart
Graphical version of
pseudocode
3. Write a Program
• Writing and editing programs
– Text editor
– Source file
• Compiling programs
– Compiler: preprocessor/translator
• Linking programs
– The linker assembles all of functions (source and system’s) into final executable program.
26/37
4. Test the Program
• Blockbox Test
• Whitebox Test
4. Test the Program
• Specification errors
– When the problem definition is either incorrectly stated or misinterpreted.
– They should be caught during blackbox testing.
• Code errors
– Compiler error message
• Logic errors
– They can be corrected only by thorough whitebox testing.
One set of test data
will never completely validate a
program.
Note: