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

01 - Introduction

Uploaded by

assematia08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

01 - Introduction

Uploaded by

assematia08
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

Computers &

Programming
CSE 011, Level-0
Computer and Systems Engineering
Department
Faculty of Engineering - Alexandria
University
Welcome
We wish you a successful and fruitful semester

2
Course Code & Policy
• Attending the lectures is mandatory
• Always use your academic email in communications with us
• Questions and discussions
• In lectures, or
• Office hours, or
• Microsoft Teams
• There is no Website or Social medial forums for the course.
• In case of vacations or days off, please attend the lecture or
the lab with any other group that suits your timetable.

4
Grades Policy

Online Sheets (almost Weekly) 5% -- 10 sheets


Labs (Bi-Weekly) 15% -- best 5 out of 6
Midterm 20% -- MCQ
Final Exam 60% -- MCQ

5
Teams

Use code: 5gpa3pe 6


Teams

Use code: 5gpa3pe 7


Go here to answer your
Weekly Sheets

Announcements Only
(Grades, Timetable changes, … )

Students Discussions &


Questions

Download Labs
8
2

The lectures are found in


the lectures folder in class
materials
1
Labs

Even Sections & Odd Sections in alternative weeks


Please check Microsoft Teams (General Channel) for
the announcements on the dates

10
References

Charles R. Severance
Python for
Everybody
Book website:
https://www.py4e.com/

11
References

Understandin Deborah Morley


g Computers Charles S. Parker
Today &
Tomorrow
Available on Google Books

12
Course Contents
Week Lecture Reference
1 Introduction Python for All: Chapter 1
2 Variables, expressions and statements Python for All: Chapter 2
3 Conditional Execution Python for All: Chapter 3
4 Functions Python for All: Chapter 4
5 Loops and Iterations Python for All: Chapter 5
6 Strings & Lists Python for All: Chapter 6 & 8
7 Dictionary & Tuples Python for All: Chapter 9 & 10
8 Midterm
9 Introduction to Database Systems Understanding Computers: Chapter 14
10 Using Databases & SQL Python for All: Chapter 15
11 Hardware (Processing and Memory) Understanding Computers: Chapter 2
12 Computer Networks and Internet Understanding Computers: Chapter 7
13 Introduction to Machine Learning
13
Lecture 1

Program Development &


Programming Languages
In this lecture

• Why
• Computer Systems main functions
• Computer Systems main components
• Program Development Life Cycle
• Programming Languages
• Translators and Compilers
• Algorithms Design

15
Why do we study this course?

• Computers are built for one purpose


To do Things for Us

• We need to speak their language to


describe what we want done

• If we knew this language, we could tell


the computer to do tasks on our behalf
that were repetitive

16
Why do we study this course?

• The kinds of things computers can do


best are often the kinds of things that
we humans find boring

• Delegating this boring stuff to


computer, gives you more time for you
can do best: creativity, intuition, and
inventiveness

17
Computer Definition

“A computer is an electronic device that works based on a


set of instructions that are stored in its memory. It receives
data and process it using programs to produce information.
Furthermore, it can store data and information for later
usage.”

18
Computer Functions

Computers have four main functions

Input

Storage Processing

Output
19
Computer System

• A computer systems has four main components

Software Data

Hardware

Information
20
Computer System: Data vs. Information
• Data are the set of facts such as Data
symbols, words, pictures, video,
numbers that represents the inputs to
the computer

• Information is the data after being


processed such as reports, statistics,
charts that are produced as outputs Information
from the computer

21
Computer System: Hardware

Hardware are the physical components of the computer

Hardware

22
Computer System: Software

• Software: a set of ordered and detailed instructions that are


being loaded into main memory and instruct the computer
to perform the needed operations from it.
Software

23
Software Types

• System Software are all the software that control and supervise
computer components (both software and hardware).
Example: Operating Systems (e.g., Windows, Unix, Mac, Android, ….)

• Applications Software are all the software that count on the


existence of an underlying system software and the services
provided by it.
Examples: Games, spreadsheet editors, drawing software, music
players, database management software, ….

24
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
25
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
26
1. Problem Analysis
• Clearly specify and understand the problem
• Programmers need accurate and detailed
requirements Input
• You must define
• Inputs: the data received from the users
• Outputs: the desired outcomes and the Time
Table
screens and the formats
Specs
• Features and specifications and approve
it from the customer
• Time Plan to complete the development
• Programming Language that will be used
and how the program will interact with Output
other programs
Programming
Language

27
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
28
2. Program Design

• In this phase, the programmer writes the Algorithm which is


represented by defined logical steps that aim to find a solution
for the Problem with the desired outcomes.
• You can write the Algorithm using
• Pseudocode: writing ideas in an English-like language
without machine-specific details. It can then be easily
transformed into a programming language
• Flowchart: drawing figures that explains the steps in a visual
representation

29
Pseudocode vs Flowchart
Example: Given a length in meter, calculate it in centimeter

Flowchart Pseudocode
Start • Read length in meter
• Multiply length by 100
Read length in • Write length to represent its value in
meter centimetre

More
Length in about
cm = 100 * Flowcharts at the end
length in m of the lecture
Write length in
centimeter

End

30
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
31
3. Program Coding

• In this phase, we transform the Algorithm into a Program written using


one of the Programming Languages
• A Programming Language is a set of rules used to write a program.
Programming languages can be classified to:
• Low-Level Languages
• High-Level Languages
• In order to write a program using a programming language, the
developer needs
• An application named Integrated Development Environment (IDE).
The IDE helps the developer to write the program and correct the
errors.
• An application to transform the program into machine language
(Compiler or Interpreter)

32
Low-level Languages

• Programs written using it are machine instructions


• Every line is a machine instruction
• Can be categorized as
• Machine Language
• Assembly Language

33
Machine Language – Low Level

• This is the only language that the computer can understand


directly.
• Its instructions are Bit Strings that represent the different
commands
A Bit is a single unit that takes one of two values: 0 or 1
• Uses Registers which are small and limited memory units
inside the processor.

34
Assembly Language – Low Level

• Limitations
• Each processor type has its own Assembly language.
• The developer must be fully aware of the processor design.
• Very detailed and needs long time and big effort to write.
• Advantages
• Fully utilizes the processor.
• Programs written using assembly languages execute faster.

35
High-level Languages
• Aims
• Increase programmers’ productivity
• The programmer doesn’t need to understand the hardware details.
• Its commands are English-like (e.g., print, input, copy).
• High-level languages processors are needed to transform the programs
written using a high-level language into a low-level language.
• Examples: FORTRAN, Pascal, (C, C++, and C#), Java, Python :
• Advantages:
• Loosely coupled to hardware
• Easy to learn
• Easy to find and correct errors
• Save time and effort

36
Language Processor

Transform the program written by any high-level language


or assembly language to the equivalent program written in
machine language.

Source Language Object


program processor program

37
Language Processor
Language Processor Types
• Assembler: transforms the language written in assembly to
its equivalent machine code.
• Compiler: transforms all the source program into object
program before its execution.
• Interpreter: translates and executes the source program line
by line.
• Each high-level language has its own Compiler or Interpreter

Source Language Object


program processor program

38
Language Processor
What is the difference between compilers and
interpreters?

• Programs that use interpreters are slower than the programs that use
compilers because interpreters translate the program each time the
program is executed.

• Compiled programs need more memory than the program that uses
the interpreter.

• Interpreted programs are easy to stop at any line then resume its
execution which makes it easier to test and modify.

39
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
40
4. Program Debugging and Testing

We need to make sure that the program is error-free and do


what it was designed to do.

• Debugging: make sure the program has no errors. Errors


(Bugs) can be either:
• Compile-Time errors
• Run-Time errors
• Logical errors

• Testing: The program is tested using test scenarios that have


specific input data. The program is tested more than once
and with all possible cases.

41
Compile-Time error
X = Y * 10o0

Run-Time error
Input Z
X=Y/Z

Logical error
Input x
Input y
z=x-y
Print “sum =”, z

42
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
43
5. Program Maintenance

• This is done after the customer starts using the


software, and this includes:
• Fixing errors and bugs that were not discovered during
the development
• Addressing new customer needs
• Handling any changes to the problem that the program is
solving
• Updating the program with any technology changes

44
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design

Progra
Debugging
& Testing m
Coding
45
Program Development Life Cycle (PDLC)

Problem
Analysis

Progra
Program
Maintenance m
Design
Documentation

Progra
Debugging
& Testing m
Coding
46
Documentation

• Done in all the Program Development Life Cycle.

• Useful for the programmer, as this can serve as a reminder


of the basic idea of the program whenever the programmer
returns back to it.

• Useful for any other programmer to continue the


development or doing the maintenance of the program.

47
Flowcharts

48
Flowcharts

• One of the common methods in Algorithms design.


• Set of shapes with specific meaning (e.g., circle, rectangle,
ellipse, parallelogram, rhombus, … ).
• Shapes are connected with arrows represent the flow.

49
Main Flowchart symbols

start end Terminal

Z=X+Y Computational Step (process)

Input X Input / Output

X>Y Decision Making

Abs(x) Predefined Process

1 2
Connector
50
Flowcharts Control Structures

• All algorithms can be written


T F T using
• Sequential Structure
F • Optional Structure
.
.
• Repetitive Structure
.
.

F For I=1 to 10
T
T
F T
T Next I
Read length in F
F
meter
F
Length in cm = 100 *
length in m
51
Flowcharts Guidelines

• Make it clear and easy to trace.


• The symbols order needs to be logical.
• The flow of Arrows needs to be from Up-to-Down and from
Left-to-Right.
• The Computational step has only one in-arrow to it and one
out-arrow.
• The Decision Making step has only one in-arrow and two
out-arrows.
• The Terminals have either one in-arrow and one out-arrow.
• Use Connectors in large flowcharts.
• There must be Start and End nodes.

52
Example
Start

Input A, B

X=A
Write an algorithm that
SUM=0 prints the sum of numbers
that are divisible by 5
No starting from a number A
X<=B
that is divisible by 5 and
Yes
ending with the nearest
number that is less than or
SUM=SUM+X Print SUM
equal to a number B.
X=X+5

End
53
Thank You …

You might also like