0% found this document useful (0 votes)
47 views62 pages

Chapter 1.0

The document discusses introductory concepts of programming including defining terms like program, programmer, and programming language. It also describes the different types of programming languages from machine language to assembly language to high-level languages as well as explaining the process of writing, compiling, and executing a computer program. The document serves as an overview and introduction to fundamental programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views62 pages

Chapter 1.0

The document discusses introductory concepts of programming including defining terms like program, programmer, and programming language. It also describes the different types of programming languages from machine language to assembly language to high-level languages as well as explaining the process of writing, compiling, and executing a computer program. The document serves as an overview and introduction to fundamental programming concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 62

DEC 2012 – FUNDAMENTAL

PROGRAMMING

Noted prepared by:


Pn. Wan Fazlini Idayu binti Wan
Fakari (013-7023854)
Chapter 1 : INTRODUCTORY CONCEPTS
 

1.1 Introduction To Programming


1.1.1 Know the programming language
1.1.2 Explain the background of C programming.
1.1.3 Describe the sample of C program.
1.1.4 Explain the compile and execute programs.
 
1.2 Know the definition and types of programming.
1.2.1 Define the following terms:
• Programme
• Programmer
• Programming language
 
1.2.2 Describe the various types of programming languages
 
1.3 Understand the types of programming and structure programming methodology.
1.3.1 Explain the following types of programming:
• Structured programming
• Modular programming
• Object-Oriented programming
Chapter 1 :
INTRODUCTORY CONCEPTS
Pn. Wan Fazlini Idayu binti Wan
Fakari
1.1 Introduction To
Programming
The process of writing, testing and maintaining
the source code of the computer program

What ?

Computer Programming

How to program ?
•Requires knowledge in the application domain
•Follow the steps in software development method
Programming is a problem-solving
activity

To solve problems To ease daily process


occurred in life e.g.: transaction,
with the assistance payroll, accounting,
of computer registration, information
exchange etc.
6
1.1.1 Know the programming language
A set of symbol, word, code or
instructions which is understood by What ?
computer

Programming Language ?
Method of communication for which
computers could understand and execute Function?
the instructions written in source code.
A programming
language is
therefore a Hello! What can I
do to you?
practical way
for us (humans)
to give
instructions to
a computer.

Tell me 1 + 1 is
equal to what???
1.1.2 Explain the background of C programming.

C History

• Derived from the BCPL language by


Martin Richards (1967).
• Ken Thompson developed a B language from BCPL
language(1970).
• Evolved into the C language by Dennis Ritchie (1970) at
Bell Telephone Laboratories Inc. (now the AT & T Bell
Laboratories).
• C language was first used on a computer Digital
Equipment Corporation PDP-11 to fully use in UNIX
1.1.2 Explain the background of C programming.

Why use C?

• the portability of the compiler;


• the standard library concept;
• a powerful and varied repertoire of operators;
• an elegant syntax;
• ready access to the hardware when needed;
• and the ease with which applications can be optimised by
hand-coding isolated procedures
• C is often called a "Middle Level" programming language. This
is not a reflection on its lack of programming power but more
a reflection on its capability to access the system's low level
functions.
Reference: http://www.le.ac.uk/users/rjm1/cotter/page_04.htm
1.1.3 Describe the sample of C program.
1.1.3 Describe the sample of C program.
#include <stdio.h>

main()
{
printf("hello, world\n");
return 0;
}

Examples of C programming
1.1.4 Explain the compile and execute programs.

• computer program run through the following steps:


Edit : Source code (type the program)

Compile : If no syntax errors  Object Code

Link : Link to library function  exe mode

Run : Output (check for any semantic errors)


1.1.4 Explain the compile and execute programs.

Compile: Translate a program from source


code to assembly code.

Assemble: Translate a program from


assembly code to object code (sometimes
these two steps are combined and called
compiling).

Link: Pull together all of the functions


needed for the program (both user
defined objects and system libraries) and
arrange that locations of functions and
variables are known. This step creates the
executable.

Load: Move the executable into computer


memory.

Execute: Run the program.

Reference: http://www-ee.eng.hawaii.edu/~tep/EE160/Notes/Intro/cprogram.html
1.1.4 Explain the compile and execute programs.

Reference: http://c.camden.rutgers.edu/c_resources/c_programming/
http://c.camden.rutgers.edu/c_resources/c_programming/
1.2 Know the definition and
types of programming.
1.2.1 Define the following terms:

• Programme
• Programmer
• Programming language
1.2.1 Define the following terms:

Programme:
• A set of step-by-step instructions that tells a
computer to perform a specific task and to produce
the required results.
• written by the programmer
• Produced through programming

19
1.2.1 Define the following terms:

Programme.
 (computer science) a sequence of instructions that
a computer can interpret and execute; "the
program required several hundred lines of code“
A sequence of instructions, stored in any medium,
that can be interpreted and executed by a
computer; - called most frequently a program. This
term is used both for the written program (a
document) and for its corresponding electronic
version stored or executed on the computer.
1.2.1 Define the following terms:

Programme.

A computer program is a series of organized


instructions that directs a computer to perform
tasks. Without programs, computers are
useless.
1.2.1 Define the following terms:
Programmer
• A Programmer is a person who designs, writes and
test computer programs.
 Programmers usually have an extensive background in some form of
computer coding language, which may include XML, HTML, or SQL.
 Programmers are essential to the development of computers because
without the coding that is necessary to make a computer work
properly, the machine would be useless.
 Programmers may specialize in one area or may write instructions for
a wide range of systems or programs.
1.2.1 Define the following terms:

Programmer.
 Individual that composes instructions for computer systems to refer to
when performing a given action.
Define the following terms:
What is programming?
1.2.1

Programming
• Programming is a process of designing/
creating a program.
• It is a communication technique to explain the
instructions to the computer.
• Used to produce the program.

24
1.2.1 Define the following terms:

Programming Language.
a set of conventions in which instructions for the
machine are written.
A high-level language used to write computer
programs, as COBOL or BASIC, or, sometimes, an
assembly language.
An artificial language used to write instructions
that can be translated into machine language and
then executed by a computer.
1.2.1 Define the following terms:

Programming Language.
C language

assembly
Language
Motorola I.C
1.2.2 Describe the various types of
programming languages

Asse High
Mac level
mbl lang
hine
y uage
evel l an guage
Low l

27
1.2.2 Describe the various types of
programming languages

Category Explanation
Machine Binary number codes understood by
language a specific CPU
Assembly Mnemonic codes that correspond to
language machine language instructions
High level Machine-independent programming
language language that combines algebraic
expressions and English symbols.

Computer programmers usually only involve in


writing high level language
28
1.2.2 Describe the various types of
programming languages

#1: Machine Level Language


 Machine languages are the only Programming
languages understood by computers. While easily
understood by computers, machine languages are
almost impossible for human to use because they
consist entirely of numbers (binary bits i.e. 0 or 1).
1.2.2 Describe the various types of
programming languages

#1: Machine Level Language


1.2.2 Describe the various types of
programming languages

#1: Machine Level Language


 Advantages:
the programs are written in binary form,
there is no need of assemblers or compilers to
convert the codes to machine readable form so the
execution is fast.
This also leads to smaller file size.
1.2.2 Describe the various types of
programming languages

#1: Machine Level Language


 Disadvantages:
It is extremely difficult to learn , as program codes are
to be written in binary form.
It is machine dependent so program written on one
computer cannot be run on another computer of the
same type.
As they are machine dependent proper knowledge of
CPU architecture (addressing methods, register types
etc) is a must.
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


 Assembly language is a type of programming
language ,which is used to program computers,
microprocessors, microcontrollers, and other
(usually) integrated circuits.
They implement a symbolic representation of the
numeric machine codes and other constants
needed to program a particular CPU architecture.
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


 An assembly language is thus specific to certain
physical or virtual computer architecture. An
assembly language programmer must understand
the microprocessor’s unique architecture (such as
its registers and instruction).
Program written in assembly language is
converted to binary codes using special programs
called assemblers.
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


binary
Assembler

PC architecture
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


 In assembly language a mnemonic is a code, usually from
1 to 5 letters, that represent an operational code (op-
code), followed by one or more numbers (the operands).
Op-code or operation code is between one and three
bytes in length and uniquely defines the function that is
performed. It is the data that represents a microprocessor
instruction.
1.2.2 Describe the various types of
programming languages
#2: Low Level or Assembly Language
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


Advantages:
Program written in assembly language are simpler than
program written in machine codes as use of binary codes
to represent operational codes is replaced by words
(mnemonics).
Program written for a family of microprocessors need
not be rewritten i.e. machine dependence is somewhat
reduced.
Less knowledge of CPU architecture compared to
machine level language is required.
1.2.2 Describe the various types of
programming languages

#2: Low Level or Assembly Language


Disdvantages:
Requirement of knowledge of CPU architecture
is not completely eliminated.
Assembly Languages are to be converted into
binary codes using assemblers so final
executable file size is large compared to
machine level ones.
1.2.2 Describe the various types of
programming languages

#3: High Level Language


High level programming languages are those
programming language which use normal
everyday word to represent the executable
operational codes.
These types of programming language follow
strictly followed rule for writing these instruction.
This rule is known as syntax.
1.2.2 Describe the various types of
programming languages

#3: High Level Language


High level languages are easy to learn as they
avoid the need to understand the complex CPU
architecture and also because the commands are
in plain understandable English form.
These programs written in plain English form
following syntax are converted in machine
understandable form using either compilers or
interpreters.
Computer only
understands
machine language.

So, computer need


translator call:
-Assembler
-Compiler or interpreter.

Assembler:
assembly machine

compiler or interpreter
high level machine
42
Assembly
code

Assembler

Object code
(machine language)
43
1.2.2 Describe the various types of
programming languages

#3: High Level Language


Advantages.
 They are easy to understand and user friendly.
 It reduces the complexity of programming as need of knowledge
of CPU architecture is eliminated.
 High level programs are very easy to maintain than machine and
lower level languages. In machine and lower level languages,
instructions are difficult and very hard to locate, correct and
modify but in high level language, it is very easy to understand and
modify when desired.
1.2.2 Describe the various types of
programming languages

#3: High Level Language


Advantages.
Each high-level language provides a large number of
built-in functions or procedures that can be used to
perform specific tasks during designing of new
programs. In this way, a large amount of time of
programmer is saved.
 Program written in high-level language is machine
independent. It means that a program written on one
type of computer can be executed on another type of
computer.
1.2.2 Describe the various types of
programming languages

#3: High Level Language


Disadvantages.
The additional process of compilation needs more
machine time than the straight assembly process.
 There is no control of hardware part while writing high
level programs.
 The programs have to be compiled every time a
change is made.
1.2.2 Describe the various types of
programming languages
1.2.2 Describe the various types of
programming languages
1.3 Understand the types of
programming and structure
programming methodology
1.3.1 Explain the following types of programming:

• Structured programming
• Modular programming
• Object-Oriented programming
1.3.1 Explain the following types of programming:

#1: Structured programming


 Structured programming is a programming
paradigm/technique aimed on improving the clarity,
quality, and development time of a computer program by
making extensive use of subroutines, block structures
and for and while loops.
Top-down approach.
The most popular structured programming languages
include C,C++, Ada, and Pascal.
1.3.1 Explain the following types of programming:

#1: Structured programming


 Split the task into modular/specific box to make
program much more easier to develop
1.3.1 Explain the following types of programming:

#2: Modular programming


 Modular programming is a software design technique
that increases the extent to which software is
composed of separate, interchangeable components
called modules by breaking down program functions into
modules, each of which accomplishes one function and
contains everything necessary to accomplish this.
1.3.1 Explain the following types of programming:

#2: Modular programming


 Conceptually, modules represent a separation,
and improve maintainability by enforcing logical
boundaries between components.
Explain the following types of programming:
1.3.1

Modular programming (2)


#2: Modular programming
Main program
data

module1 module2
data+data1 data+data2

procedure2 procedure3
procedure1

55
1.3.1 Explain the following types of programming:

#3: Object Oriented programming


 Object-oriented programming (OOP) is a
programming paradigm using "objects" – data
structures consisting of data fields and methods
together with their interactions – to design
applications and computer programs.
1.3.1 Explain the following types of programming:

#3: Object Oriented programming


 Programming techniques may include features such
as data abstraction, encapsulation,
messaging, modularity, polymorphism, and
inheritance. Many modern programming
languages now support OOP, at least as an option.
The most popular object-oriented programming
languages include Java, Visual Basic, C#, C++, and
Python.
1.3.1 Explain the following types of programming:

#3: Object Oriented programming


Everything in OOP is grouped as self
sustainable "objects"
Compare between the following types
of programming:
Structured programming
Modular programming
Object-oriented programming

* Discuss in group and list the answer.


* We will discuss in next class.
59
Types of programming

Structure Modular Object


Programming Programming Oriented
Programming

Definition - - -

Language use Ada, Pascal, C….

Step used -top to bottom


approach
-
Advantage/
disadvantage
Level moderate High level

60
Types of programming
Structured Programming/
 Object Oriented Programming
Modular programming

Structured Programming is designed which


Object Oriented Programming is designed
focuses on process/ logical structure and then
which focuses on data.
data required for that process.

Structured programming follows top-down Object oriented programming follows bottom-


approach. up approach.

Structured Programming is also known as Object Oriented Programming supports


Modular Programming and a subset of inheritance, encapsulation, abstraction,
procedural programming language. polymorphism, etc.

In Structured Programming, Programs are divided In Object Oriented Programming, Programs


into small self contained functions. are divided into small entities called objects.

Structured Programming is less secure as there is Object Oriented Programming is more secure
no way of data hiding. as having data hiding feature.

Structured Programming can solve moderately Object Oriented Programming can solve any
complex programs. complex programs.

Structured Programming provides less Object Oriented Programming provides more


reusability, more function dependency. reusability, less function dependency.

Less abstraction and less flexibility. More abstraction and more flexibility.
References:-
• http://fresh2refresh.com/cprogramming/c-language-history/
• http://www.le.ac.uk/users/rjm1/cotter/page_05.htm
• http://
infotechcreations.blogspot.com/2011/08/what-is-c-programm
ing-language.html
• http://www-ee.eng.hawaii.edu/~
tep/EE160/Notes/Intro/cprogram.html
• http://c.camden.rutgers.edu/c_resources/c_programming/
• https
://freefeast.info/difference-between/difference-between-stru
ctured-programming-and-object-oriented-programming-struc
tured-programming-vs-object-oriented-programming
/

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy