ENG236: Introduction (1) - PowerPoint PPT Presentation

About This Presentation
Title:

ENG236: Introduction (1)

Description:

(Compile, link and load) Mapping. Computer Programming and Basic Software Engineering ... (Compile, link and load) Mapping. Intro/14. 14. Coding. Computer can ... – PowerPoint PPT presentation

Number of Views:23
Avg rating:3.0/5.0
Slides: 23
Provided by: hkpu
Category:

less

Transcript and Presenter's Notes

Title: ENG236: Introduction (1)


1
ENG236 Introduction (1)
THE HONG KONG POLYTECHNIC UNIVERSITY
Rocky K. C. Chang
2
Computer Programming and Basic Software
Engineering
References
  • J. Liberty, Teach Yourself C in 24 hours. SAMS,
    2005/2009 (electronic book in the library).
  • H. M. Deitel and P. J. Deitel, C How To
    Program, 6th Ed. Prentice Hall, 2008.
  • S. Prata, C Primer Plus. Fifth Edition, SAMS,
    2005.

3
Computer Programming and Basic Software
Engineering
Contents
  1. Introduction (week 1)
  2. A Taste of C (week 1)
  3. The Nuts and Bolts (weeks 2-5)
  4. Basic Software Engineering (weeks 6-7)
  5. Objects and Classes in C (weeks 8-9)
  6. Pointers and Arrays (weeks 10-13)
  7. Stream I/O
  8. Elementary Data Structure
  9. Building Graphical User Interface.

First semester
Second semester
4
Getting Started 1. What is Computer Programming?
5
Computer Programming
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
A systematic approach to instruct a computer
doing something for us.
Hardware
I/O devices
CPU
Memory
6
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Process of Computer Programming
Way of thinking
Computer
Computing Problems
Operating System
Hardware
Algorithms and Data Structures
Mapping
Coding
Application Software
High-level Language
Binding (Compile, link and load)
Details in the following slides
7
Computing Problems
Operating System
Hardware
Algorithms and Data Structures
Mapping
Coding
Application Software
High-level Language
Binding (Compile, link and load)
8
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Identify the Problem
  • Before writing a program, ask yourselves two
    questions
  • What is the problem I want to solve?
  • Do I really need to write a program to solve it?
  • A problem can often be so large that requires the
    co-operation of a few programs to solve it.
  • E.g. To design a computer game
  • - Design the story
  • - Design the graphics
  • - Design the motion

9
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
  • Do we need to write a program for the following
    problems?
  • Calculate the result of 1 1?
  • Play a piece of MP3 music using the computer?
  • Develop a Web page?

No. Just use your fingers!
No. Use application software such as Media Player.
Yes or no, depending on how complicated your Web
page is.
  • Usually we need to write a program if the problem
    is too complicated and specific to our needs.

10
Computing Problems
Operating System
Hardware
Algorithms and Data Structures
Mapping
Coding
Application Software
High-level Language
Binding (Compile, link and load)
11
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Find the Best Algorithm
  • A problem can be solved by different approaches
  • Using a clever approach can save you a lot of
    time in getting the result
  • E.g.
  • Calculate 1 2 3 4 5 6 7 8 9
    10 11 12
  • Solution?

11 additions
Use algorithm 12 x (1 12) / 2 78 1 addition,
1 multiplication, 1 division
Seems better, BUT ...
12
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
  • Consider the following situation
  • For a particular computer, it may take 10 ?s to
    compute an addition but uses 100 ?s to do a
    multiplication or division.
  • Calculate 1 2 3 4 5 6 7 8 9
    10 11 12
  • Do you still want to use algorithm?

? Algorithm needs to match with the hardware
architecture
13
Computing Problems
Operating System
Hardware
Algorithms and Data Structures
Mapping
Coding
Application Software
High-level Language
Binding (Compile, link and load)
14
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Coding
  • Computer can only understand 0 and 1.
  • The most direct way to communicate with the
    computer is to use 0 and 1.
  • ? Machine Language Programming
  • 0110001111000010
  • 0001000111100011
  • 0011000100001000
  • 1000001001010101

Machine Language Program
Very tedious and can make error easily
15
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Coding - Assembly Language
  • Assembly Language is created to help human
    instruct CPU to work.
  • By using a software tool called Assembler,
    assembly language programs can be converted into
    machine language programs.

Assembly Language
Machine Language
0110001111000010 0001000111100011 001100010000
1000 1000001001010101
LD R0, 05 ADD R0, 1234 SUB R0, 22 LD
2345, R0
Assembler
16
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Coding - High Level Language
  • Assembly language programming is still too
    complicated for general users.
  • They are very different from human languages.
  • e.g. Set W equal to W plus X minus Y divided by
    Z.
  • Repeat the next sequence of instructions until
    X is less than 0 or Y equals Z.
  • A high level language is needed to reduce the gap
    between human and computers.

17
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Details in the following slides
Executable Machine Language Program
Linker
1011010101 0101010101
.exe
Library
Object code
Give me the result of adding 1 to 10
Compiler
.cpp
High Level Program
18
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
  • Compiler Generate the object code.
  • Object code ? Similar to the machine language
    code but cannot be executed because of the
    missing of some information.
  • Linker Resolve the missing information from the
    library or other programs.

For a program, it is very common that some of the
information in the program needs to be obtained
from the Library provided by the programming
tool. It is the job of linker to obtain these
missing information.
19
Computer Programming and Basic Software
Engineering
1. What is Computer Programming?
Coding - High Level Languages
  • From time to time, high level languages (HLL) are
    designed for different purposes.
  • Earlier examples
  • BASIC for simple and general computing
    (obsolete for long)
  • COBOL for data processing (is still using
    in local banks)
  • FORTRAN for scientific computation (has
    been replaced by C or C)
  • Recent examples
  • Pascal a sophisticated but complicated
    HLL (replaced by C or C)
  • C a simple structural HLL for general
    computing (still in use)
  • Current examples
  • C the most well-known object-oriented (OO)
    language
  • Java an OO language designed with the
    concept of networking.

20
Computer Programming and Basic Software
Engineering
1. What is a Computer?
Programming - C
  • Object-Oriented programming concept is
    overwhelming.
  • OO Programming has the advantage of achieving
    reuse of software components.
  • The C programming language is created to
    implement the concept of OO programming.
  • C is an extension of the C language.
  • C has become the predominant language for the
    commercial software development.
  • Standardized by the American National Standards
    Institute (ANSI), C program is portable to
    different machines.

21
Homework
  • Install Visual Studio 2008 in your PC/notebook.
  • Locate the electronic book Teach Yourself C in
    24 hours.

22
Acknowledgments
  • The slides are based on the set developed by Dr.
    Frank Leung (EIE).
Write a Comment
User Comments (0)
About PowerShow.com