0% found this document useful (0 votes)
257 views41 pages

Chapter 1 - Intro To Programming Language

This chapter introduces programming languages and their importance, provides an overview of computer hardware and software components, discusses different categories of computers and programming languages, and explains the programming process using C programming including how source code is compiled into executable files through language translators.

Uploaded by

Syahir Hamidon
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
0% found this document useful (0 votes)
257 views41 pages

Chapter 1 - Intro To Programming Language

This chapter introduces programming languages and their importance, provides an overview of computer hardware and software components, discusses different categories of computers and programming languages, and explains the programming process using C programming including how source code is compiled into executable files through language translators.

Uploaded by

Syahir Hamidon
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1/ 41

CSC099

Foundation
Computing II

Chapter 1

Introduction to Computer
and Programming
Zamri bin Abu Bakar
Language PUSAT ASASI
UiTM PUNCAK ALAM
2

Why Study Programming


Languages?
provide you with a general body of
knowledge about programming languages
ability to reason critically about the
application of programming languages in
software engineering work.
3 3/27/17

Objectives :
Revision :
Overview of computer and its application
Computer components
Evolution of Programming Languages
Introduction
to C Programming
The Programming Process using C
programming
4

Introduction
Computer an electronic devices consist of
hardware and software and perform tasks and
produce the output

Programming Language language for


computer consist of a vocabulary and a set of
rules that can be understood by the
computer
5

Categories of Computers
Individuals
Desktop : PC, iMac
Personal Digital Assistant (PDA)
IPhone or Smart Phone

Organizations
Supercomputers
Mainframes
Servers
Minicomputers
6

Computer Components
Computer

Hardware Software
Any part of the computer The set of computer
We can physically touch programs that enables the
Input and Output devices hardware to perform
different tasks.
Application
System
7

Computer Hardware

Zamri Abu Bakar CSC099 Sem 2 2012/2013


Central Processing Unit 8

(CPU)
Theheart of a computer
Comprised of 2 parts:-
Control Unit
Coordinate all the computer
instructions
Machine cycle Fetch, Decode,
Execute, Store
Arithmetic & Logic Unit (ALU)
To
perform mathematical
operations
9

Main Memory (RAM)


Volatile
10
11

Encoding Scheme
Each printable and non-printable character is
represented by unique number in memory.
Encoding method to encode character to unique
number
Common Encoding Scheme/Method
ASCII (American Standard Code for Information Interchange)
8 bits equals one character; 128 characters; used by
minicomputers and personal computers.
EBCDIC (Extended Binary Coded Decimal Interchange Code)
8 bits equals one character; 256 characters; used by
mainframe computers and IBM.
Unicode
16 bits (2 bytes ) equals one character; 65536 characters;
used for foreign language symbols.
Zamri Abu Bakar CSC099 Sem 2 2012/2013
12

Computer Software

Software

System Software Application Software


Operating systems (OS) Microsoft Office
System utilities Adobe Photoshop
13

Where are the application and System


Software?
14 3/27/17

Reasons for studying Concepts of


Programming Languages :
Increased capacity to express ideas and solve
problem
Studying programming languages may increase the
capacity and ability of students to express their ideas in a
formal, computational form.

Increased ability to automate process


Programs are built mainly so that simple, or even
complicated processes to be executed automatically.
15 3/27/17

What is Programming Language?

A set of rules, words and symbols are used to


write a computer program telling a
computer what to do.
The source codes (program) are compiled and
the executable files (*.exe) are produced.

program1
Error free

Compiled Executable
Programmer file (*.exe)
writes program & debug
16

Type of programming languages

High-level:closer to human language


Low-level: Written mainly in binary or machine
code (0s/1s) .

Zamri Abu Bakar CSC099 Sem 2 2012/2013


17 3/27/17

Generation of Programming
language
Machine language
Assembly language
High Level language

program machine language

Compiler
machine language program
Computers understand
People understand
binary(11011)
program
18 3/27/17

Machine Language
Binary number codes understood by a specific CPU.
Lowest level of language
Represent data and program instructions as 1s and 0s
The only language that computer directly understand
(Do not require translator)
Not convenient to read and use.
First generation language
Machine - dependent

Example:
To calculate wages = rates * hours in machine
language:
100100 010001 //Load
100110 010010 //Multiply
100010 010011 //Store
19 3/27/17

Assembly Language
Second generation language
Developed to replace 1s and 0s use in machine
language.
Use mnemonic codes : abbreviations that easy to
remember
Requires a translator to translate the assembly
program into machine language ( assembler).
Difficult to learn
Machine-dependent

A for Add
C for Compare
MP for Multiply
20 3/27/17

Comparison
A Machine-language Program Fragment and Its
Assembly-Language Equivalent
Memory Address Machine-Language Assembly-Language
Instructions Instructions

00000000 00000000 CLA

00000001 00010101 ADD A

00000010 00010110 ADD B

00000011 00110101 STA A


21

History of Programming Languages

Computer
language
evolution

The only language understood by a computer is machine language

Machine Language Assembly Language

COBOL BASIC Fortran Smalltalk Ada

Visual Basic C and C++ Pascal Java


22

Machine Language
Series of 1s and 0s (binary numbers)
1011010000000101
Difficult to write.
Low level language.
Computer only understand this language without
translation.
23

Assembly Language
Low level language.
Unique to particular computer.
Use mnemonics symbols. E.g. MUL Multiply
Easier to understand.
A program is written in source code (text file) and
translated into machine language by an
assembler.
24 3/27/17

High-Level Programming Language

Made easy for programmer to develop and


maintain program
Machine- independent (can run on may different
types of computers)
Have 3 categories : third, fourth and fifth
generation
Written in series of English-like words
Must be translated to machine code first
(Use translator)
25

High-Level Programming Language


Portable to many different computers.
Easier to read, write, and maintain than machine
and assembly languages.
Instruction are coded; programmers use this to
write programs.
Example : COBOL (Business), FORTRAN
(Scientific), BASIC, Pascal, C, C++, C#, Java etc.
Compiler/interpreter: translates a program (code)
written in a high-level language machine
language
26 3/27/17

Some Well-Known High-Level


Programming Languages
Language Application Area Origin Name
FORTRAN Scientific Programming Formula Translation

COBOL Business data Processing Common Business-Oriented


Language
Lisp Artificial Intelligent List processing

C System Programming Predecessor Language was named B

Prolog Artificial Intelligent Logic Programming

C++ Support objects and object Incremental modification of C (++ is


oriented programming the C incremental operator)

Java Supports Web Programming Originally name Oak


27

Some Well-Known High-Level


Programming Languages
28

Examples :
To calculate the wages = rates * hours
Machine language

100100 010001 //Load


100110 010010 //Multiply
100010 010011 //Store

Assembly language
LOAD rate
MULT hour
STOR wages

High-level language C Programming


wages = rate * hours;
29 3/27/17

Language Translator
Program need to translate because computer only understand machine
language
Assembler
Used in assembly language for translate the language to machine
language
Interpreter
Translates one program code statement at a time.
Immediately displays feedback when it finds error.
Compiler
Translating the source code from its original language into
machine code.
Converts the entire source program into machine language at one
time
Interactive Development Environment (IDE)
A program that provides user with an environment for editing,
debugging and compiling the source code the program on- line.
30

Natural Language
o Like our natural language (such as Malay,
English, French, or Chinese)
o Its use is still quite limited.
31

C Language
Is a structured programming language
High level language
Is a case sensitive language
Developed by Dennis Rithcie (1972)
ANSI define a standard on C (1983),
which was followed by ISO (1990)
Designed for writing system software
32

Example of a C Program
33

Program Development

A computer understands a program only if the


program is coded in its machine language.
Thus, programming language need to be
converted to machine language (executable file)
34

High Level Program to Executable Code


1. Programmer create and edit text file containing
the program (source code) with a text editor
and save it into file (source file)
2. Run
1. preprocessor to process the preprocessor directives
(begin with #).
2. compiler to:
Check that the program obeys the rules
Translate into machine language
(object code)
3. linker to connect hardware-specific code to machine
instructions, producing an executable code.
3. Loader : Loads executable file into main
memory
4. Execution : Execute the program
35

Coding Schemes
ASCII (American Standard Code for Information
Interchange)
8 bits equals one character; 128 characters;
used by minicomputers and personal
computers.
EBCDIC (Extended Binary Coded Decimal
Interchange Code)
8 bits equals one character; 256 characters;
used by mainframe computers and IBM.
Unicode
16 bits (2 bytes ) equals one character; 65536
characters; used for foreign language symbols.
36

High Level
Language to
Machine
Language
(Executable file)

Programmer

Code

Code

Executable Code
37

Flow of Information During Program


Execution
38

Integrated Development
Environments (IDEs)
An integrated development environment, or IDE,
combine all the tools needed to write, compile,
and debug a program into a single software
application.
Examples are Code Blocks, Microsoft Visual C,
Borland C Builder, CodeWarrior, etc.
39

Code Blocks IDEs


40 3/27/17

References
CHow to Program, Edition, Pearson, Paul
Deitel and Harvey Deitel
C Programming a Q & A Approach, Mc
Graw Hill, H.H. Tan, T.B. DOrazio, S.H.Or
and Marian M.Y.Choy
C Program Design for Engineers, 2nd
Edition, Addison Wesley Jeri R. Hanly and
Eliot B. Koffman
41

Self Exercises:
1. What is computer language?
2. Briefly explain what are the different types of computer
language?
3. What Is a Computer Language Translator?
4. What is the very first computer programming language in
history?
5. How many types of computer language?
6. State the differences between Machine Language and
Assembly Language. Give an example of instructions for each
language.
7. What is IDEs?

You might also like