0% found this document useful (0 votes)
3 views23 pages

Field of Technological Industries: Computer Science (ETP211) : (Lec4)

The document outlines the fundamentals of programming and software development, emphasizing the importance of structured programming techniques and the six-step Software Development Life Cycle. It discusses various programming languages, their characteristics, and the evolution of programming languages across five generations. Additionally, it provides an introduction to Python, including installation instructions and basic syntax for writing simple programs.

Uploaded by

alrashidy015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views23 pages

Field of Technological Industries: Computer Science (ETP211) : (Lec4)

The document outlines the fundamentals of programming and software development, emphasizing the importance of structured programming techniques and the six-step Software Development Life Cycle. It discusses various programming languages, their characteristics, and the evolution of programming languages across five generations. Additionally, it provides an introduction to Python, including installation instructions and basic syntax for writing simple programs.

Uploaded by

alrashidy015
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Field of Technological Industries

For All Programs

Computer Science (ETP211): (Lec4)

Dr : Wael Mohamed Fawaz Date : 22 / 10 / 2024


Programs and Programming
Program
• A list of instructions for the computer to follow to accomplish the task of processing
data into information
• Statements used in a programming language such as C++, Java, or Python
• Programs can be
• Prewritten/packaged

• Custom-made

Programming or Software Development


• Actually a problem-solving procedure
• List of instructions for the computer to follow to process data
• Follows a six-step process know as the System Development Life Cycle

© McGraw-Hill Education 2
Six-Step Software Development Life Cycle

The six steps are as follows:


1. Program specification
2. Program design
3. Program code
4. Program test
5. Program documentation
6. Program test

© McGraw-Hill Education Figure 13-1 3


Program Design

Plan a solution using structured programming techniques


• Techniques
• Pseudocode
• Flowcharts
• Logic structures

© McGraw-Hill Education Figure 13-5 4


Pseudocode

An outline of the logic of the program you will write


Summary of the program before it is written

© McGraw-Hill Education Figures 13-7 5


Flowcharts

Graphically present the


detailed sequence of steps
needed to solve a
programming problem

© McGraw-Hill Education Figures 13-8 and13-9 6


Logic Structures Sequence Repetition

Enables you to write


structured programs, which
take much of the guesswork
out of programming
• Sequential structure
• One program statement follows Selection
another

• Selection structure
• A decision must be made

• Repetition structure or Loop


Structure
• Describes a process that may be
repeated as long as certain
condition remains true

© McGraw-Hill Education Figures 13-10, 13-11, 13-12 7


Program Code

Writing the program is called


coding
• Characteristics of a good program
• Reliable
• Produces the correct output
• Catches common input errors
• Well-documented and understandable
• Structured programs – one of the best
ways to code effective programs
• Using logic structure

© McGraw-Hill Education Figure 13-13 8


Coding

Write the program


• A programming language
uses a collection of
symbols, words, and
phrases that instruct a
computer to perform
specific operations

© McGraw-Hill Education Figure 13-14 9


Programming Languages
Language Description

C++ Extends C to use objects or program modules that can be reused and
interchanged between programs
C# A programming language designed by Microsoft to extend C++ for
developing applications in the Windows environment
Java Primarily used for Internet applications; similar to C++; runs with a
variety of operating systems
JavaScript Embedded into web pages to provide dynamic and interactive content

Python General-purpose programming language that is simple and easy to


learn. Frequently used in introductory programming courses
Swift Uses graphical user interface and special code for touch screen
interfaces to create apps for Apple iOS devices

© McGraw-Hill Education Figure 13-15 10


Generations of Programming Languages

Levels or Generations
• Coding from machine languages to human or natural
languages
There are five distinct generations
• Lower level is closer to machine language
• Higher level is closer to human-like language

© McGraw-Hill Education 11
Five Generations

1st Gen: Machine languages


• Data represented in 1s and 0s

2nd Gen: Assembly languages


• Uses abbreviations or mnemonics that are automatically converted to the
appropriate sequence of 1s and 0s
3rd Gen: High level procedural languages (3GLs)
• Designed to express the logic – the procedures – that can solve general
problems. Translated into machine language with a compiler or an interpreter
4th Gen: Task-oriented languages (4GLs)
• Designed to solve specific problems

5th Gen: Problem and Constraint languages (5GL)


• Computer languages that incorporate the concepts of artificial intelligence to
allow a person to provide a system with a problem and some constraints and
then request a solution

© McGraw-Hill Education 12
Generation Samples

Listed below are samples of each generation programming


language in order from the 1st through the 5th

© McGraw-Hill Education Figure 13-23 13


Basic Python programs
Python!

Created in 1991 by Guido van Rossum (now at Google)


• Named for Monty Python

Useful as a scripting language


• script: A small program meant for one-time use
• Targeted towards small to medium sized projects

Used by:
• Google, Yahoo!, Youtube
• Many Linux distributions
• Games and apps (e.g. Eve Online)

© McGraw-Hill Education
Installing Python

Windows: Mac OS X:
Download Python from Python is already installed.
http://www.python.org Open a terminal and run python or
Install Python. run Idle from Finder.
Run Idle from the Start Menu.
Linux:
Chances are you already have
Python installed. To check, run
python from the terminal.
If not, install from your distribution's
package system.

© McGraw-Hill Education
Interpreted Languages

interpreted
• Not compiled like Java
• Code is written and then directly executed by an interpreter
• Type commands into interpreter and see immediate results

Java: Runtime
Code Compiler Computer
Environment

Python: Code Interpreter Computer

© McGraw-Hill Education
The Python Interpreter

Allows you to type commands one-at-a-time and see results


A great way to explore Python's syntax
• Repeat previous command: Alt+P

© McGraw-Hill Education
Our First Python Program

Python does not have a main method like Java


• The program's main code is just written directly in the file
Python statements do not end with semicolons

hello.py
1 print("Hello, world!")

© McGraw-Hill Education
The print Statement

print("text")
print() (a blank line)

• Escape sequences such as \" are the same as in Java


• Strings can also start/end with '
swallows.py
1 print("Hello, world!")
2 print()
3 print("Suppose two swallows \"carry\" it together.")
4 print('African or "European" swallows?')

© McGraw-Hill Education
Comments

Syntax:
# comment text (one line)

swallows2.py
1 # Suzy Student, CSE 142, Fall 2097
2 # This program prints important messages.
3 print("Hello, world!")
4 print() # blank line
5 print("Suppose two swallows \"carry\" it
6 together.")
print('African or "European" swallows?')

© McGraw-Hill Education
Questions?

You might also like