CH 1
CH 1
Fundamentals
CSEB113 PRINCIPLES of
PROGRAMMING
by
Badariah Solemon
BS (May 2013)
Topics
1. Computer Programs and Programming
Introduction
Why Do Engineering Undergraduates Need to
Take Programming Course?
2. Programming Languages
3. The C Language
BS (May 2013)
Topic 1
COMPUTER PROGRAMS AND
PROGRAMMING
BS (May 2013)
Elements of a Computer
3
1
2
Applicatio
n
software
1
system
softwar
e
Hardware
Software
BS (May 2013)
Utility
Programs
Windows 8
Language
Translation
Compiler
Disk Cleanup
System Software
*Complete this list
BS (May 2013)
Microsoft Word
Application
Software
Embedded Systems
Computer programs that are embedded
into hardware to control its operations.
Example:
Telecommunication systems
Consumer electronics
Missiles and satellite
Smart cards
Medical equipment (e.g., electronic stetescope) and
medical imaging (e.g. MRI, CT)
Transportation systems
sscanf( "%s", astring );
BS (May 2013)
What is Programming?
Computer programming is:
not only about writing computer programs
the iterative process of designing, writing,
testing, debugging, and maintaining the
source code of computer programs
This source code is written in one or more
programming languages (such as C, C++, C#,
Java, Python, Smalltalk, etc.)
BS (May 2013)
Watch Me
Source: http://www.youtube.com/watch?v=sGyH9tBie4M
BS (May 2013)
BS (May 2013)
Topic 2
PROGRAMMING LANGUAGES
BS (May 2013)
10
What is a Programming
Language?1
11
What is a Programming
Language?2
BS (May 2013)
12
Types of Programming
Languages
printf (Hello);
total = quiz + assignment;
High-Level
Language
Assembly
Language
LOAD
LOAD A,
A, 9999
9999
LOAD
LOAD B,
B, 8282
8282
SUB
SUB BB
MOV
MOV C,
C, AA
Machine
Language
BS (May 2013)
13
1. Machine Language
The only language that is directly understandable by a
computers processor.
Certainly difficult for humans to understand
0001
1100
1000
0101
0101
1110
1000
0101
0110
1010
1111
0001
0001
1100
14
2. Assembly Language
Uses a mnemonic code to represent each machine
LOAD A, 9999
operation
in words and numbers
LOAD B, 8282
SUB B
MOV C, A
MOV C, A
00110101
01110111
15
3. High-level Languages1
Use more English words so easier to program in these
languages. Example:
printf (Hello);
total = quiz + test + assignment;
16
3. High-level Languages2
Example:
Java
PHP
Visual Basic
Objective-C
C++
C#
Python
Perl
Javascript
Ruby
Visual
Basic.NET
LISP
Pascal
Delphi
Ada
MATLAB
Lua
Bash
FORTRAN
BS (May 2013)
17
Topic 3
THE C LANGUAGE
BS (May 2013)
18
The C Language1
It was developed by Dennis Ritchie in the early
1970s at Bell Laboratories (now a part of
Lucent Technologies, Inc).
A high-level language that is highly portable.
C combines the power of high-level languages
with the power of assembly languages.
It has influenced the newly created high-level
language name Objective-C
which is the main programming language used by
Apple for the OS X and iOS operating systems and
their respective APIs, Cocoa and Cocoa Touch
frameworks.
BS (May 2013)
19
The C Language2
C is a highly imperative programming
language. This means:
It expresses what the program should
accomplish by prescribing how to do it in terms
of sequences of actions to be taken.
It was designed to be compiled using a
relatively straightforward compiler.
BS (May 2013)
20
21
C Programming
Environment
A modern C programming often made easy by the
BS (May 2013)
22
BS (May 2013)
23
Summary
Computers must be given instructions in the form of
computer programs before they can perform actions and
make decisions.
Programming is the iterative process of designing, writing,
testing, debugging, and maintaining the source code of
computer programs.
Conceptually, programming language is a framework within
which we organize our ideas about data (object we want to
manipulate) and procedures (how to manipulate the data).
In general, programming languages may be categorized as
1) machine language (also called machine code), 2)
assembly language, and 3) high-level languages.
C is a highly imperative programming language.
A modern C programming often made easy by the use of
integrated development environments (IDEs).
BS (May 2013)
24