0% found this document useful (0 votes)
22 views

Chapter One - Introduction

Uploaded by

ShaggY
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)
22 views

Chapter One - Introduction

Uploaded by

ShaggY
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/ 25

Programming I (in C++)

Chapter 1:
Introduction

FOP -- Chapter One -- Introduction 1


06/27/2024
Outline of Topics

◦ What is computer programming?


◦ Why study programming?
◦ Types of programming languages
◦ Programming paradigms

FOP -- Chapter One -- Introduction 2


06/27/2024
1.1. What is Computer Programming?

Recall …
Software Categories (from introductory
courses …)
System Software
◦ Programs written for computer systems
 Compilers, operating systems, …

Application Software
◦ Programs written for computer users
 Word-processors, spreadsheets, & other
application packages

FOP -- Chapter One -- Introduction Lemma N. 3


06/27/2024
1.1. What is Computer Programming?
A Layered View of the Computer
Application Programs
Word-Processors, Spreadsheets,
Database Software, IDEs,
etc…
System Software
Compilers, Interpreters,
Preprocessors, etc.
Operating System, Device Drivers
Machine with all its hardware

FOP -- Chapter One -- Introduction 4


06/27/2024
1.1. What is Computer Programming?

Operating System (OS)


· Provides several essential services:
◦ Loading & running application programs
◦ Allocating memory & processor time
◦ Providing input & output facilities
◦ Managing files of information

FOP -- Chapter One -- Introduction 5


06/27/2024
1.1. What is Computer Programming?

Computer Program:
Series of instructions to a computer to
accomplish a task.
◦ Instructions must be written in a way the
computer can understand.
Programs are written in programming
languages
◦ Pieces of the same program can be written in
different Programming Languages

FOP -- Chapter One -- Introduction 6


06/27/2024
1.1. What is Computer Programming?

Programming languages are used to write


programs. E.g. Java, C, C++, …
A Programming Language is
◦ A special purpose and limited language
◦ A set of rules and symbols used to construct
a computer program
◦ A language used to interact with the
computer
Programmer: A person who writes computer
programs.
FOP -- Chapter One -- Introduction 7
06/27/2024
1.2. Why study Programming?
Increased capacity to express programming
concepts
Improved background for choosing
appropriate languages
Increased ability to learn new languages
Understanding the significance of
implementation
Increased ability to design new languages
Overall advancement of computing

FOP -- Chapter One -- Introduction 8


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
A) Machine languages
 The representation of a computer program which is
actually read and understood by the computer.
◦ A program in machine code consists of a sequence
of machine instructions.
Instructions:
◦ Machine instructions are in binary code
◦ Instructions specify operations and memory cells
involved in the operation.

FOP -- Chapter One -- Introduction 9


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages

A) Machine languages
• Use binary code
• Machine-dependent
• Not portable

Example:

FOP -- Chapter One -- Introduction 10


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
B) Assembly languages
A symbolic representation of the machine
language of a specific processor.
Is converted to machine code by an assembler.
Usually, each line of assembly code produces one
machine instruction (One-to-one correspondence).
Programming in assembly language is slow

FOP -- Chapter One -- Introduction 11


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
B) Assembly languages
Error-prone but is more efficient in terms of
hardware performance.
Mnemonic representation of the instructions and
data

Example:
Load Price
Add Tax
Store Cost

FOP -- Chapter One -- Introduction 12


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
B) Assembly languages
Use mnemonics
Machine-dependent
Not usually portable

FOP -- Chapter One -- Introduction 13


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
C) High-level languages
A programming language which use
statements consisting of English-like keywords
such as "FOR", "PRINT" or “IF“, ... etc.
Each statement corresponds to several
machine language instructions (one-to-many
correspondence).
Much easier to program than in assembly
language.

FOP -- Chapter One -- Introduction 14


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
C) High-level languages
Data are referenced using descriptive names
Operations can be described using familiar
symbols
Example:
Cost := Price + Tax

FOP -- Chapter One -- Introduction 15


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
C) High-level languages
 Use mathematical notations (translated via
compilers)
 Example:
grossPay = basePay + overTimePay
 Interpreter – Executes high level language
programs without compilation.

FOP -- Chapter One -- Introduction 16


06/27/2024
1.3. Types of Programming Languages
Three types of programming languages
C) High-level languages
Uses English-like language
Machine-independent
Portable (but must be compiled for different
platforms)

Examples:
Pascal, C, C++, Java, Fortran, ..

FOP -- Chapter One -- Introduction 17


06/27/2024
1.4. Programming Paradigms

Programming paradigms are the result of


people’s ideas (thoughts!) about how programs
should be constructed.
Major classes of paradigms
A) Imperative (also called Structured or
Procedural) Programming
consists of actions to effect state change, principally
through assignment operations or side effects.
◦ Fortran, Algol, Cobol, PL/I, Pascal, Modula-2, Ada,
C

FOP -- Chapter One -- Introduction 18


06/27/2024
1.4. Programming Paradigms

B) Functional Programming
Focuses on function evaluation; avoids
updates, assignment, mutable state, side
effects
Example: LISP, ML, Haskell
C) Object-Oriented Programming
Is based on real world objects that embed
both data and operations.
Example: SmallTalk, C++, Java

FOP -- Chapter One -- Introduction 19


06/27/2024
1.4. Programming Paradigms

Which paradigm to choose?

 Depends on the problem and the application


domain at hand …

FOP -- Chapter One -- Introduction 20


06/27/2024
1.4. Programming Paradigms
Characteristics of a good Programming Language
A good computer program should have following
characteristics:
 Simplicity: Should be easier to learn and understand.
 Portability: refers to the ability of an application to run on
different platforms (operating systems) with or without
minimal changes.
 Readability: The program should be written in such a way
that it makes other programmers or users to follow the logic
of the program without much effort.
 Efficiency: it utilizes the least amount of memory and
processing time.

FOP -- Chapter One -- Introduction 21


06/27/2024
1.4. Programming Paradigms
Characteristics of a good Programming Language
 Structural: If a program is developed structurally, it becomes
more readable, and the testing and documentation process also
gets easier.
 Flexibility: A program should be flexible enough to handle
most of the changes without having to rewrite the entire
program.
 Generality: if a program is developed for a particular task,
then it should also be used for all similar tasks of the same
domain.
 Documentation: A well-documented application is useful for
further modification and change and to other programmers
because even in the absence of the author, they can understand
it.
FOP -- Chapter One -- Introduction 22
06/27/2024
CYP:
- What is Programming?
- Why study programming?
- List and describe the types of programming
languages, and their pros and cons.
- List and describe the major programming
paradigms.
- Discuss the various characteristics of a good
programming language.
FOP -- Chapter One -- Introduction Lemma N. 23
06/27/2024
Student Resources

Group E-mail: [email protected]


Password: program12345
- Lecture Notes
- Exercises
- Reference materials
- Useful links to the web …

FOP -- Chapter One -- Introduction Lemma N. 24


06/27/2024
Next class …
- Algorithms
- Translation to Pseudocode and Flowcharts

FOP -- Chapter One -- Introduction Lemma N. 25


06/27/2024

You might also like