CSC099
Foundation Computing II
Introduction to Computer and
Programming Language
PUSAT ASASI
UiTM Dengkil
Learning Outcomes :
•Overview of computer and its application
•Computer components
•Evolution of Programming Languages
•To describe the function of programming languages.
•To explore existing programming languages.
•Introduction to C Programming
•The Programming Process using C programming
January 31, 2023 2
Introduction
• Computer – an electronic devices consist of hardware and
software and perform tasks and produce the output
• Computer – is a device that can perform computation and
logical decisions billion times faster than human being can.
• Programming Language – language for computer consist
of a vocabulary and a set of rules that can be understood
by the computer
3
Categories of Computers
• Individuals
• Desktop : PC, iMac
• Personal Digital Assistant (PDA)
• Laptop
• Organizations
• Supercomputers
• Mainframes
• Servers
• Minicomputers
4
Computer Components
Computer
Hardware Software
• Any part of the computer • The set of computer
that can be physically touch programs that enables the
• Input and Output devices hardware to perform
different tasks.
• Application
• System
5
Computer Software
Software
System Software Application Software
• Operating systems (OS) • Microsoft Office
• System utilities • Adobe Photoshop
6
Computer Hardware
7
Central Processing Unit (CPU)
•The ‘heart’ 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
8
Main Memory (RAM)
• Volatile
9
Coding Schemes
• Each printable and non-printable character is represented by unique
number in memory.
• Encoding – method to encode character to unique number
• ASCII (American Standard Code for Information Interchange)
• Originally, ASCII used 7 bits equals one character; 128
characters; used by minicomputers and personal computers.
• After that, ASCII was extended to be 8 bits equals one
character; 256 characters.
• 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.
10
11
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
January 31, 2023 12
Understanding Software Programming
• Some tasks are complex
• Requires creative thought
• Requires human touch
• Some tasks are candidates for automation
• Works with electronic information
• Repetitive
• Follows a series of clear steps
13
The Importance of Programming
• A career in programming offers
• Plentiful jobs
• Strong salaries
• Telecommuting is often easy to arrange
• Computer programs exist for many tasks
• Programming necessary when no existing software for
task
14
The Importance of Programming
Add
features
that
support
personal
needs
Successfully Create
complete miniprograms
projects (macros)
Basic
knowledge of
programming
Create
Add custom
custom commands
applications
15
Type of programming languages
•Low-level: Written mainly in binary or
machine code (0’s/1’s) .
•High-level: closer to human language
16
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’
January 31, 2023 17
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
18
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
January 31, 2023 19
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
ADD for Addition
MULT for Multiply
January 31, 2023 20
Assembly Language
• Low level language.
• Unique to particular computer.
• Use mnemonics symbols. E.g. “MULT” –Multiply
• Easier to understand.
• A program is written in source code (text file) and translated into
machine language by an assembler.
21
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
January 31, 2023 22
Many Languages for Many Projects
• Programming languages have been developed to balance
conflicting goals
23
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)
January 31, 2023 24
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 into machine
language
25
Some Well-Known High-Level Programming
Languages
26
Visual Basic
27
Visual Basic
• Advantages of Visual Basic
– Prototyping is form of rapid application
development (RAD)
– Developers create prototype then generate
system documents
– RAD is alternative to waterfall approach
– Used to build Windows applications
28
C and C++
Provides higher-level
programming features
Allows direct manipulation
of system memory and CPU
registers
Code runs fast and uses
small amount of memory
Basic components are
common to many
languages
29
Java
• Programmers use various languages when information needs to
be collected from networked computers
– Java is an object-oriented language
• Is a good choice for these applications
• Popular because it uses a large set of existing
classes
• Classes exist for many graphical objects
• Can run on many CPUs and with many operating
systems
30
Java
Compile once and run on many platforms
31
Objective C
• Most popular language for writing Mac OS X applications
32
JavaScript and VBScript
Scripting languages
– Allows decisions and calculations
– Adds interactivity to web pages
33
ASP, JSP, and PHP
• How interactive web pages are built
– Several languages adapt the HTML page to
user’s selections
• Active Server Pages (ASP)
• JavaServer Pages (JSP)
• PHP (Hypertext Preprocessor)
– User supplies information that is translated
into a request using database query language
34
ASP, JSP, and PHP
• Interactive web pages
35
Programming Languages
36
Building Mobile Applications
Special languages and supporting tools help speed development
of applications for mobile devices like smart phones and tablets
Specific features include GPS capability, software keyboards,
and touch-sensitive screens
User interface must take smaller screen size into account
37
Mobile Applications
Xcode 4
38
Mobile Applications
• Tools for building apps for Android devices
– Android software development kit (SDK) is
required
– Uses well-known IDEs with special plug-ins
• Build iOS apps (iPhone, iPad)
• Objective C language
39
Mobile Applications
Corona and Magmito support several different
devices and save time for simple applications
For specific features and ultimate performance,
custom programming is still required.
40
Natural Language
o Like our natural language (such as Malay, English, French, or Chinese)
o Its use is still quite limited.
o Tools that allow end users to create or customize computer programs
with natural language.
o For example “make me an app that suggests new careers paths to me
based on people with similar skills and experiences who have
successfully improved their salary and quality of life with a new
career.” (John Spacey, 2016)
41
Examples :
To calculate the salary = rates X hours
• Machine language
100100 010001 //Load
100110 010010 //Multiply
100010 010011 //Store
• Assembly language
LOAD rate
MULT hour
STOR salary
• High-level language – C Programming
salary = rate * hours;
42
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
January 31, 2023 43
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
44
Example of a C Program
45
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)
46
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
47
High Level Language
to Machine Language
(Executable file)
Programmer
Code
Code
Executable Code
48
Flow of Information During Program Execution
49
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, BloodShed DevC++, etc.
50
Code Blocks IDEs
51
References
• Technology in Action, 15th Edition, Pearson, Alan Evans, Kendall
Martin and Mary Anne Poatsy. Chapter 10.
• C How to Program, 7th Edition, Pearson, Paul Deitel and Harvey
Deitel
• C Programming a Q & A Approach, Mc Graw Hill, H.H. Tan, T.B.
D’Orazio, S.H.Or and Marian M.Y.Choy
• C Program Design for Engineers, 2nd Edition, Addison Wesley
Jeri R. Hanly and Eliot B. Koffman
January 31, 2023 52
Thank You
THE END
53