Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
31 views

18 - l1 C++ Lab Introduction of Computer Programming

The document discusses the evolution of programming languages from early machine languages to modern high-level languages. It covers first-generation languages like machine code, second-generation assembly languages, popular third-generation procedural languages like FORTRAN and COBOL, and the rise of fourth-generation declarative languages. The document also discusses structured programming, modular programming, and the transition to modern object-oriented languages.

Uploaded by

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

18 - l1 C++ Lab Introduction of Computer Programming

The document discusses the evolution of programming languages from early machine languages to modern high-level languages. It covers first-generation languages like machine code, second-generation assembly languages, popular third-generation procedural languages like FORTRAN and COBOL, and the rise of fourth-generation declarative languages. The document also discusses structured programming, modular programming, and the transition to modern object-oriented languages.

Uploaded by

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

Introduction to Computer

Programming
EPE-2A
Programming Languages…
Machine Language Assembly Language
Fortran
Pascal
COBOL
BASIC Ada
Visual Basic
C and C++ Java
Smalltalk

• Programming languages are artificial languages created


to tell the computer what to do
• They consist of vocabulary and a set of rules
(grammar/syntax) to write programs
• The software development life cycle (SDLC) is an
organized method of software development
C++ Predecessors

• Early procedural languages included


– FORTRAN: Formula Translation
– ALGOL: Algorithmic Language
– COBOL: Common Business Oriented Language
– BASIC: Beginners All-purpose Symbolic Instruction
Code
– Pascal
–C
– Smalltalk, Simula, etc. were the object-oriented
predecessors of C++
Third-Generation and Fourth-Generation (High-
Level) Languages

The Evolution
of Programming Languages
First-Generation Languages
• Machine language:
– Consists of binary numbers
(0s and 1s)
– Is the earliest programming
language
– Is the only language the
computer understands
without translation
• It is machine dependent; each
family of processors has its own
machine language
Second-Generation Languages
• Assembly language:
– Resembles machine language
– Is a low-level language
– Uses brief abbreviations for
program instructions.
– Abbreviations are called
mnemonics
– A program is written in source
code (text file) and translated
into machine language by an
assembler
Third-Generation Languages

• Procedural languages:
– Are high-level languages that tell the computer
what to do and how to do it
– Create programs at a high level of abstraction
– Are easier to read, write, and maintain than
machine and assembly languages
– Use a compiler or interpreter to translate code
– Fortran and COBOL are third-generation languages
Compilers and Interpreters

• An interpreter translates source code one line at a time and


executes the instruction
• A compiler is a program that changes source code to object code,
all in one shot
• Example of an interpreted language: BASIC; a compiled language:
C
The Great Software Crisis of the 60’s
• Spaghetti Code and the Great Software Crisis:
– goto statements resulted in programs that were
difficult to follow
– This made them difficult to modify, maintain, and
even develop!
– This problem led to the software crisis of the 1960s
• Programs were not ready on time
• Programs exceeded their budgets
• Programs contained too many errors
• Customers were not satisfied
• Management was also very frustrated!
Structured Programming to the rescue…

• Structured programming languages:


– Were developed to improve software
development
– Include Algol and Pascal
– Are well-structured and organized
– Forbid the use of goto statements
– Use three fundamental control structures
• Sequence, Selection, Repetition
Modular Programming Languages developed in
the 70’s…

• Modular programming languages:


– Were developed because of problems in structured
programming languages
– Are used to create programs that are divided into
separate modules
• Each module carries out a special function
– Require specified input to produce specified output
Fourth-Generation Languages
• Fourth-generation languages are non-procedural, high-level specification
languages
– They do not force programmers to follow procedures to produce results
(they’re very close to English, sometimes)
• Types of fourth-generation languages include:
– Report generators
• Languages for printing database reports (generate a program to generate the
report)
– Query languages
• Languages for getting information out of databases (generate a program to
process a query or generate a form)
– Also include visually-oriented languages
• More ambitious 4GL environments attempt to automatically generate whole
systems from the outputs of CASE tools, specifications of screens and reports,
and possibly also the specification of some additional processing logic, including
data flow diagrams, entity relationship diagrams, entity life history diagrams
• Fifth-generation languages
– These include artificial intelligence and neural networks oriented languages
SKIP: Object-Oriented Programming

• Object-oriented programming (OOP):


– Relies on component reusability
• The ability to produce program modules that perform a
specific task
– Eliminates the distinction between programs and
data
– Uses objects that contain data and procedures
SKIP: Objects
• Objects are units of information that contain data as well as
methods that process and manipulate the data
• Classes of objects:
– Hierarchy or category of objects
– Objects at the top of the category are broader in
scope than the subclass objects
– Objects near the bottom are narrower in scope
• Inheritance refers to an object’s capacity to “pass on” its
characteristics to its subclasses
Programming Language Classification
• Computer languages (not just programming languages!) can be classified into two general
categories: Imperative and Declarative
• Imperative languages include:
– Generic/General Programming Languages
• They allow user-defined data types, data abstraction, polymorphism, etc.
– Procedural Programming Languages
– Object-Oriented Programming Languages
• Declarative languages include:
– Functional Programming Languages (e.g., Haskell, Scheme, etc.)
– Logical Programming Languages (e.g., Prolog)
– Even Markup Languages like HTML
• They’re not programming languages because they don’t allow for the three fundamental
control structures but they do declare what pages should look like, etc.
• Procedural Programming (structured and modular):
– An important methodology for dealing with complexity is structured programming
– Structured Programming requires well-organized, structured code that uses the three
fundamental control structures (sequence, selection, repetition)
– Complex tasks need to be broken down into simpler subtasks  this is modular
programming
– Procedural programming reduces complex problems to collections of simple, interconnected
modules – it combines structured and modular programming!
• It is up to the programmer to implement procedural programming
3GL Programming Languages
• Most high-level programming languages can
be categorized into one of three main
categories:
– Procedural Languages (FORTRAN, BASIC, COBOL,
Pascal, etc.)
– Object-Oriented Languages (Smalltalk, Effiel,
etc.)
– Hybrid Languages allow both OO and Procedural
(such as C++)
3GL vs. 4GL
• 3GL: Procedure-oriented (structured) languages
– Programmers concentrate on the procedures used in the program
• Procedure: a logically consistent set of instructions which is used to
produce one specific result
• 3GL: Object-oriented languages
– Items are represented using self-contained objects
• Can be used to create programs for graphical windows environments
• 4GLs: fourth-generation languages
– Permit users to access and format information without the need for
writing any procedural code
• Use high-level English-like instructions to specify what to do, not how
to do it .
Procedural Programming Basics

• The purpose of most application programs


is to process data to produce specific results

Basic procedural operations.


What Can a Procedural Program Do?

• A linear, procedural program is structured to


instruct a computer to:
– Read Input
– Calculate
– Store data
– Write Output
– Work in a sequential progression (Sequence)
– Compare and branch (Selection)
– Iterate or Loop (Repetition)
Advantages of Procedural Programming
• Easier to test and debug
– Structured walkthroughs of the code
• “goto-less”
– I.e., they’re well-structured and include the three fundamental
control structures
• Standard method for solving a problem
• A single program can be written by more than one
programmer
– By dividing the program up into modules
• Programs can share routines (again, because of
modularization)

You might also like