Lecture 9
Programming Languages
& Program Development
Programming is the creation of software
applications.
Programmers are the people who create the
software applications.
A programming language is used by
programmers to create software that the
computer understands.
-2-
Programming Languages
& Program Development
Syntax is the vocabulary and rules of a
programming language.
Source code, the programming instructions in
their original form, which need to be translated
into a form that the computer can understand.
-3-
Development of Programming Languages
Five distinct programming language generations
Non-
Machine Assembly High Level Natural
Procedural
Language Language Languages Languages Languages
-4-
1st Generation: Machine Language
Based on binary numbers
The only programming
language that a computer
(CPU) understands directly
Machine dependent:
Each family of processors has
its own machine language
-5-
2nd Generation: Assembly Language
Assembly language
Machine dependent
Programs use:
Mnemonics, brief abbreviations for program instructions which
makes assembly language easier to use
than the machine language
Base-10 (decimal) numbers
Must be translated into machine language
-6-
2nd Generation: Assembly Language cont.
The danger of writing
spaghetti code is especially
great caused by GOTO
statements
GOTO statements make code
difficult to follow and prone to
errors
-7-
3rd Generation: High Level Languages
Do not require programmers to know details relating
to the processing of data
Machine independent
Easier to read, write, and maintain than assembly
and machine languages
Source code must be translated by a language
translator
-8-
3rd Generation: High Level Languages
Fortran Program Java Program
3rd Generation: High Level Languages
Translators
Compilers translate source code into object
code (object program)
Interpreters translate source code one line
at a time and execute instructions without
creating an object code
-10-
3rd Generation: High Level Languages
Compilers and Interpreters
-11-
Compilation
Compilation: Converting source code into object program
After compilation, programmers have an executable program
(object program)
-12-
Interpreter
Interpreter translates source code line by line
Each line is executed before the next line is processed
Programmers do not have to wait for the entire program to
be reprocessed each time they make a change
-13-
Compilation vs. Interpretation
• The compilation process takes longer than the
interpretation process because in compilation, all of the
lines of source code are translated into machine language
before any lines are executed.
• The finished compiled program runs faster than an
interpreted program because the interpreter is constantly
translating and executing as it goes.
• The interpreter immediately displays feedback when it
finds a syntax error. Thus, the programmer can correct any
errors or debug the code before the interpreter evaluates
the next line. They immediately see the results of changes
as they are making them in the code.
-14-
Types of High Level Languages
(Not mutually exclusive)
Procedural
High Level Languages
Event-driven
Visual
OOP
Web-based
-15-
Types of High Level Languages
Procedural Languages
A sequence of instructions to run, which uses program
control structures ( IF, Loops, Functions…)
Examples: PASCAL, BASIC, COBOL, FORTRAN
Event-driven Languages
Waits for events (mouse click, button press…) to process a
defined set of instructions (event handler)
Examples: C++, Javascript
-16-
Types of High Level Languages
Visual Languages
Allow programmer to manipulate items visually on a form
setting their layout and properties.
Creating Graphical User Interface (GUI) applications.
Examples: Visual Basic, Visual C++, Delphi
Web-based Languages
Uses special coding instructions to indicate style and
layout of text and other elements of web sites.
Mark-up and scripting languages.
Examples: HTML, XML, ASP
-17-
Types of High Level Languages
OOP (Object Oriented Languages)
Coding is attached to basic prebuilt items called objects,
which include:
Data
Attributes that define the data
Procedures or operations called methods
An interface to exchange messages with other objects
Relies on reusability
Makes information hiding (encapsulation) a reality
Examples: C#, Java, Python
-18-
4th Generation: Non-Procedural Languages
Non-procedural languages
Do not require step-by-step procedures to achieve the
appropriate programming outcome
Allows complex operations to be processed in one statement
Examples
Database report generators
Query languages: Structured Query Language (SQL)
-19-
5th Generation: Natural Languages
Natural language
Non-procedural
Uses everyday language to program
Example: Prolog
-20-
Sample Code for Language Generations
~-----------------------------------------------------------------------------------------------------------0-----------------------------------------------------------------------------------------------------------~
I GENERATION SAMPLE CODE
1GL Machine Bits describe the commands to the CPU.
1110 0101 1001 1111 0000 10111110 0110
2GL Assembly Words describe the commands to the CPU.
ADD Register 3, Register 4, Register 5
3GL FORTRAN, BASIC, C, Java Symbols describe the commands to the CPU.
TotalPay =Pay +OvertimePay
4GL SOL More powerful commands allow complex work to be done in a single sentence.
SELECT isbn, title, price, price*0.06 AS sales_tax FROM books WHERE
price>100.00 ORDER BY title;
5GL PROLOG Programmers can build applications without specifying an algorithm. Find all
the people who are Mike's cousins as:?-cousin (Mike, family)
-21-
One Size Doesn’t Fit All
~-----------------------------------------------------------------------------------------------------------0-----------------------------------------------------------------------------------------------------------~
FEATURES TYPICAL SETTING
CIC++ and C# • Can create compact code that executes quickly • Used in industrial applications such as
• Provides high- and low-level access banking and engineering
Java • Is architecture neutral • Used to create applets that can be
• Is object oriented delivered over the web
Objective C • Has a framework for writing iOS applications • Used to create applications for OS X and
Apple mobile devices
Visual Basic • Is easy to learn and use • Used in prototype development
• Is object oriented • Used to design graphical user interfaces
• Has a drag-and-drop interface
WEB TECHNOLOGIES FEATURES TYPICAL SETTING
AJAX • Uses a combination of existing technologies like • Creates websites that can update without
JavaScript, CSS, and XM:L the user refreshing the page
HTML5 • Latest version of HTML • Introduces tags like <video> and supports
drag and drop
VB Script • Is similar in syntax to Visual Basic • Creates code that lives on the client
• Has classes that represent buttons, drop-down machine and adds interaction to web
lists, and other web page components pages
XML • Enables users to define their own tags • Facilitates exchange of information from
web services
JSON • Format defined with name/value pairs • Very common format for exchange of
information from web services -22-
Gr Catn u
Top Programming Languages of 2016
-23-
Program Development Life Cycle (PDLC)
An organized plan for
breaking down the task
of program development
into manageable parts
-24-
PDLC Phases
Analysis
Deploym
Design
ent
Testing Coding
-25-
1. Analysis
Defining the problem
Interviews, questionnaires and observation
System analysts collect the user requirements and
specify the program specifications specs
Specs define IPO
Input data
Processing
Output data
Specs also include the appearance of user interface
-26-
2. Design
Program design identifies components of the
program
Top-down program design breaks program into
small, manageable, highly focused subroutines
Structured design uses control structures
Algorithm
They are not mutually exclusive
-27-
Desk Checking
An important design tool
The main purpose of desk checking the algorithm is to
identify major logic errors early, so that they may be
easily corrected
Logic errors are bugs that cause program to run
incorrectly and produce undesired outputs
Test data needs to be walked through each step in the
algorithm, to check that the instructions described in the
algorithm will actually do what they are supposed to
-28-
3. Coding
Process of creating SW applications
Programmers use programing languages to
convert algorithms into source code
Syntax errors
Mistakes in the construction of the programming
commands
Must be corrected for the program to run
-29-
3. Coding cont.
• Integrated Development Environment (IDE) helps
programmers write and test their programs.
-30-
3. Coding cont.
Version Control SW
• SW tools that help team members manage changes
to the source code over time
• Keeps track of every modification by each
contributor
• Developers can turn back to earlier versions to help
fix any mistakes
• Example tools:
Git, CVS, SVN, Mercurial and Bazaar….
-31-
4. Testing
Assessing the functionality of SW program
Two main categories: Dynamic and static
Static Testing
Manual or automated review for
Code (static code reviews)
Requirements and design documents (technical reviews)
Dynamic Testing
Check the functional behavior of a SW unit by entering test
data and comparing results to the expected results
-32-
Dynamic Testing Opacity
Opacity (view of code)
Black-box testing
Tester has no knowledge of code
Often done by someone other than the coder
White-box testing
Testing all possible logic paths in the software unit
Deep knowledge of the logic
Makes each program statement execute at least
once
-33-
5. Deployment and Maintenance
Deployment
All processes involved in getting new SW up and running
properly in its environment, including installation,
configuration running, testing and making necessary
changes
Maintenance
Evaluate the program on a regular basis
-34-
Documenting the Program
Throughout the PDLC
Documentation includes
Program design work
Overview of program functionality
Thorough explanation of main features
Tutorials
Reference documentation of program commands
Description of error messages
-35-
Complete
The ----- phase of PDLC includes identifying syntax
errors.
Testing all possible logic paths in the software unit, with
thorough knowledge of the logic is called -----.
----- allows complex operations to be processed in one
statement, e.g. report generators and query languages.
----- testing checks functional behavior of SW by entering
test data and comparing results to expected results.
----- are brief abbreviations for program instructions that
make assembly language easier to use.
Interviews, questionnaires and observation are employed
in the ----- phase of PDLC.
-36-
Complete
----- is the vocabulary and rules of a programming
language.
----- is the only programming language that a computer
(CPU) understands directly.
----- converts source code into object program.
----- are mistakes in construction of programming
commands which must be corrected for program runs.
----- are the processes involved in getting new SW up and
running properly in its environment.
----- and ----- are machine dependent languages.
----- code is full of GOTO statements, which make code
difficult to follow and prone to errors.
-37-
Complete
The compilation process takes ----- time than the
interpretation process.
----- testing is conducted when tester has no knowledge of
code.
Assessing the functionality of SW program is called -----.
The main purpose of ----- the algorithm is to identify
major logic errors early to be easily corrected.
Evaluating the program on a regular basis is called -----.
----- translates source code one line at a time and execute
instructions without creating machine code.
Phases of PDLC are -----, -----, -----, ----- and -----.
-38-
Differentiate Between
Source and machine code
White and black box testing
Logic and syntax errors
Compiler and interpreter
Dynamic and static testing
-39-
Thank You