Vous êtes sur la page 1sur 57

Introduction to Computer Science

By
Dr. Ahmed Taha
Lecturer, Computer Science Department,
Faculty of Computers & Informatics,
Benha University
1

LOGO

LOGO

Book Title:
New Perspectives on Computer Concepts,
2014, Comprehensive
Authors:
June Jamrich Parsons, Dan Oja
Publisher:
Course Technology;
Edition:
16 edition (January 30, 2013)

LOGO

Book Contents
#

Chapter Title

Computers and Digital Basics

Computer Hardware

Computer Software

Operating Systems and File Management

Local Area Networks

The Internet

The Web and E-mail

Digital Media

The Computer Industry: History, Careers, and Ethics

10

Information Systems Analysis and Design

11

Databases

12

Computer Programming

LOGO

Computer Programming

Contents
1

Programming Basics

Programming Languages Classes

Programming Languages Generations

Programming Paradigms

Program Development Life Cycle

Programming Tools
7

LOGO

Programming
Basics

LOGO

Computer Program
A Computer program, is
series of instructions that tells
a computer how to carry out
processing tasks.

These programs form the


software that sets up a
computer to do a specific task.
When a computer runs software, it performs the
instructions to carry out a task.

LOGO

Computer Programming
Computer programming is
the craft of writing useful,
maintainable, and extensible
source code which can be
interpreted or compiled by a
computing system to perform
a meaningful task.
Programming a computer can be performed in one of
numerous languages, ranging from a higher-level language
to writing directly in low-level machine code.

10

LOGO

Computer Programming & Software Engineering


Computer programs are developed by computer
programmers or software engineers.
Computer programmers mainly focus on coding computer
programs, whereas software engineers tend to focus on
designing and testing activities.
Computer programming involves a broad set of activities
that include planning, coding, testing, and documenting.
Most computer programmers participate to some extent in
all of these phases of program development, but focus on
the coding process.
11

LOGO

Computer Programming & Software Engineering


Software engineering is a development process that uses
mathematical, engineering, and management techniques to
reduce the cost and complexity of a computer program
while increasing its reliability and modifiability.

It is used on large software projects where cost overruns


and software errors might have disastrous consequences.

12

LOGO

Programming Languages
A programming language is a set of keywords and
grammar rules designed for creating instructions that a
computer can ultimately process or carry out.
Computer programs can be compiled or interpreted.
A keyword, or command, is a word with a predefined
meaning for the compiler or interpreter that translates each
line of program code into machine language.

13

LOGO

Programming Languages
An instruction for a computer program consists of keywords
and parameters, formed into sentence-like statements
according to a set of syntax rules.

Keywords can be combined with specific parameters, which


provide more detailed instructions for the computer to carry
out.
Keywords and parameters are combined with punctuation
according to a series of rules called Syntax
14

LOGO

Programming Languages
Classes

15

LOGO

Programming Languages Classes


Programming
Languages

Low-level Languages

It includes commands specific to a


particular CPU or microprocessor
family.

Low-level languages require a


programmer to write instructions
for the lowest level of the
computers hardware.

High-level Languages

Examples: machine language


and assembly language

16

It uses command words and


grammar based on human
languages to provide what
computer scientists call a level of
abstraction that hides the
underlying low-level assembly or
machine language.

Examples: BASIC, Java, Ada, and


C++

LOGO

Programming Languages Classes


Low-level assembly commands

High-level Pascal command

LDA 5
STA Num1
LDA 4
ADD Num1
STA Total
END

Total:=5+4

A single high-level command does the work of multiple lowlevel commands.

17

LOGO

Programming Languages
Generations

18

LOGO

Programming Languages Generations

5th generation

Natural language
4th generation

Very High level language


3rd generation

2nd generation

1st generation

High level language

Assembly language

Machine language
19

LOGO

Programming Languages Generations


1st Generation
Machine languages were the first languages available for
programming computers.
A machine language is specific to a particular CPU or
microprocessor family.
For example, the machine language for a modern Intel i7 processor
includes unique commands that were not included in the machine
language of earlier Intel 8088 microprocessors.

20

LOGO

Programming Languages Generations


2nd Generation
An assembly language allows programmers to use abbreviated
command words, called op codes, such as LDA for load, rather than
the 1s and 0s used in machine languages.
It is machine specificeach assembly language command
corresponds on a one-to-one basis to a machine language
Instruction.
An assembly language is useful when a programmer wants to
directly manipulate what happens at the hardware level.
Today, programmers sometimes use assembly languages to write
system software, such as compilers, operating systems, and device
drivers.
21

LOGO

Programming Languages Generations


3rd Generation
It used easy-to-remember command words, such as PRINT and
INPUT, to take the place of several lines of assembly language op
codes or lengthy strings of machine language 0s and 1s.

Examples:
COBOL and Fortran, were used extensively for business and scientific
applications
Pascal and BASIC were popular teaching languages
C and C++ remain popular today for system and application software
development
Objective-C is the programming language used to develop iPhone and iPad apps
Java is used for Android apps.

22

LOGO

Programming Languages Generations


4th Generation
It used more closely resemble human languages, or natural
languages, than do third-generation languages.
It eliminates many of the strict punctuation and grammar rules that
complicate third-generation languages.
Examples:
SQL and RPG

23

LOGO

Programming Languages Generations


4th Generation
A single command written in a fourth-generation language can
replace many lines of third generation code.
PUBLIC SUB Sort(Kids As Variant, inLow As Long, inHi As Long)
DIM pivot As Variant
DIM tmpSwap As Variant
DIM tmpLow As Long
DIM tmpHi As Long
tmpLow = inLow
tmpHi = inHi
pivot = Kids((inLow + inHi) \ 2)
WHILE (tmpLow <= tmpHi)
WHILE (Kids(tmpLow) < pivot And tmpLow < inHi)
tmpLow = tmpLow + 1
WEND
WHILE (pivot < Kids(tmpHi) And tmpHi > inLow)
tmpHi = tmpHi - 1
WEND
IF (tmpLow <= tmpHi) THEN
tmpSwap = Kids(tmpLow)
Kids(tmpLow) = Kids(tmpHi)
Kids(tmpHi) = tmpSwap
tmpLow = tmpLow + 1
tmpHi = tmpHi - 1
END IF
WEND
IF (inLow < tmpHi) THEN Sort Kids, inLow, tmpHi
IF (tmpLow < inHi) THEN Sort Kids, tmpLow, inHi
END SUB

SORT TABLE Kids on Lastname

24

LOGO

Programming Languages Generations


5th Generation
It allow programmers to use graphical or visual tools to construct
programs instead of typing lines of code.

What is the best programming language?


Hundreds of programming languages exist, and each has unique
strengths and weaknesses.
Although it might be possible to select the best language for a
particular project, most computer scientists would find it difficult to
agree on one all-around best language

25

LOGO

Programming Languages Examples


Language

Description

Ada

A high-level programming language developed under the direction of


the U.S. Department of Defense and originally intended for military
applications.

Alice

An object-oriented language that provides a drag-and-drop interface for


creating 3-D animations.

BASIC

(Beginners All-purpose Symbolic Instruction Code): Developed by John


Kemeny and Thomas Kurtz in the mid-1960s, BASIC is a simple,
interactive programming language.

Visual Basic
C

Developed in the early 1970s by Dennis Ritchie at Bell Laboratories, C is


used today for a wide range of commercial software.

C++, C#, and


Objective-C

Languages derived from C that provide object-oriented (OO) capabilities

Pascal

Named in honor of Blaise Pascal, who invented one of the first


mechanical adding machines, Pascal is a third-generation language
developed to teach students programming concepts.

26

LOGO

Programming Languages Examples


Language

Description

Java

A C++ derivative developed by Sun Microsystems used extensively for


Web-based programming.

JavaScript

Not to be confused with Java, JavaScript is an interpreted language


most commonly used for client-side Web scripting.

LISP

(LISt Processing): Developed in 1959 by famed artificial intelligence


researcher John McCarthy, LISP is used for artificial intelligence
applications.

Prolog

(PROgramming in LOGic): A declarative language developed in 1972 and


used for artificial intelligence applications.

COBOL

(COmmon Business Oriented Language): A procedural language


developed in the early 1960s and used extensively for mainframe
business applications.

Fortran

(FORmula TRANslator): One of the original third-generation languages;


developed in the 1950s and is still used today for scientific applications.

Visual Basic

A Windows-based software development kit created by Microsoft in the


early 1990s and designed for developing Windows-based applications

27

LOGO

Programming Paradigms

28

LOGO

Programming Paradigm
Programming paradigm refers to a way of conceptualizing
and structuring the tasks a computer performs.
Some programming languages support a single paradigm.

Other programming languages-referred to as multiparadigm languages-support more than one paradigm.

29

LOGO

Programming Paradigm
Paradigm

Languages

Description

Event-driven

Visual Basic, C#

Focuses on selecting user interface


elements and defining event-handling
routines that are Triggered by various
mouse or keyboard activities

Procedural

C, BASIC, Pascal, COBOL,


Fortran, Ada

Emphasizes linear steps that provide


the computer with instructions on
how to solve a Problem or carry out
a task

Objectoriented

Smalltalk, C++, Java, Scratch

Formulates programs as a series of


objects and methods that interact to
perform a specific task

Declarative

Prolog

Focuses on the use of facts and rules


to describe a problem

30

LOGO

Program Development
Life Cycle

31

LOGO

Program Development Life Cycle (PDLC)


The Program Development Life Cycle is a process that
ensures good software is built.
Analyze the
problem
Maintain the
program

Design the
program

Formalize the
solution

Code the
program
Test and debug
the program
32

LOGO

Program Development Life Cycle (PDLC)


Step 1: Analyze the problem
Precisely define the problem to be solved, and write program
specifications descriptions of the programs inputs, processing,
outputs, and user interface.

Step 2: Design the program


Develop a detailed logic plan using a tool such as pseudocode,
flowcharts, object structure diagrams, or event diagrams to group
the programs activities into modules; devise a method of solution or
algorithm for each module; and test the solution algorithms.

33

LOGO

Program Development Life Cycle (PDLC)


Step 3: Code the program
Translate the design into an application using a programming
language or application development tool by creating the user
interface and writing code; include internal documentation
comments and remarks within the code that explain the purpose of
code statements.

Step 4: Test and debug the program


Test the program, finding and correcting errors (debugging) until it is
error free and contains enough safeguards to ensure the desired
results.

34

LOGO

Program Development Life Cycle (PDLC)


Step 5: Formalize the solution
Review and, if necessary, revise internal documentation; formalize
and complete end-user (external) documentation.

Step 6: Maintain the program


Provide training and support to end users; correct any unanticipated
errors that emerge and identify user-requested modifications
(enhancements). Once errors or enhancements are identified, the
program development life cycle begins again at Step 1.

35

LOGO

Program Design

36

LOGO

Program Design
In general, an algorithm is a set of steps for carrying out a
task that can be written down and implemented
An algorithm for a computer program is a set of steps that
explains how to begin with known information specified in a
problem statement and how to manipulate that information
to arrive at a solution.
Algorithms are usually written in a format that is not specific
to a particular programming language.
The most well-known methods used to write an algorithm
are: structured English, pseudocode, and flowcharts
37

LOGO

Program Design
Structured English is a subset of the English language
with a limited selection of sentence structures that reflect
processing activities.
Pseudocode is a notational system for algorithms that has
been described as a mixture of English and your favorite
programming language.
Flowchart is a graphical representation of the way a
computer should progress from one instruction to the next
when it performs a task.

38

LOGO

Program Design
Structured English

39

LOGO

Program Design
Pseudocode

40

LOGO

Program Design
Flowchart

41

LOGO

Program Design
Flowchart

42

LOGO

Program Coding

43

LOGO

Program Coding
The process of coding a computer program depends on:
The programming language you use
The programming tools you select
The programming paradigm that best fits the problem youre trying
to solve.

Programmers can use a text editor, program editor, or VDE


to code computer programs.

44

LOGO

Program Coding
A text editor is any word processor that can be used for
basic text editing tasks, such as writing e-mail, creating
documents, or coding computer programs. (Ex: Notepad ).
A program editor is a type of text editor specially designed
for entering code for computer programs. Features vary, but
can include helpful programming aids, such as keyword
colorizing, word completion, keyboard macros, and search/
replace.

45

LOGO

Program Coding

text editor such as


Notepad (top) allows
programmers to enter
lines of code using a
familiar word processing
interface

46

LOGO

Program Coding
A program editor (bottom) offers tools more targeted to programmers.

47

LOGO

Program Coding
A VDE (visual development
environment) provides
programmers with tools to build
substantial sections of a program
by pointing and clicking rather
than typing lines of code.
A typical VDE is based on a form
design grid that a programmer
manipulates to design the user
interface for a program

48

LOGO

Program Coding
VDE

49

LOGO

Program Testing &


Documentation

50

LOGO

Program Testing & Documentation


Testing often consists of running the program and entering
test data to see whether the program produces correct
results.
If testing does not produce the expected results, the
program contains an error, sometimes called a bug.
occurs when an instruction does not

Syntax errors

Error types

follow the syntax rules, or grammar


occurs when a program runs

Runtime errors

Logic errors

Ex: Division by zero

error in the logic or design of a program


Ex: using wrong formula to calculate the area
51

LOGO

Program Testing & Documentation


Programmers can locate errors in a program by reading
through lines of code, much like a proofreader.
They can also use a tool called a debugger to step through
a program and monitor the status of variables, input, and
output.
A debugger is sometimes packaged with a programming
language or can be obtained as an add-on.

52

LOGO

Programming Tools

53

LOGO

Programming Tools
Some programmers like to obtain programming tools a la
carte by picking up a compiler from one Web site, selecting
an interactive debugger from another Web site, and using
any handy editor, such as Notepad.

More typically, programmers download or purchase an


SDK or IDE that contains a collection of programming tools.

54

LOGO

Programming Tools
An SDK (software development kit) is a collection of
language-specific programming tools that enables a
programmer to develop applications for a specific computer
platform, such as Windows PCs.

A basic SDK includes a compiler, documentation about the


language and syntax, and installation instructions.
More sophisticated SDKs might also include an editor, a
debugger, a visual user interface design module, and APIs.

55

LOGO

Programming Tools
An IDE (integrated development environment) is a type of
SDK that packages a set of development tools into a
smooth programming application.
The modules in the applicationeditor, compiler, debugger,
and user interface development toolhave a uniform set of
menus and controls, which simplifies the programming
process.

56

LOGO

57

Vous aimerez peut-être aussi