Programming Languages and uses
Programming Languages and uses
Non- r3 = 0
Machine Assembly High Level Procedural Natural
Language Language Language Language start_1nner:
Language r5 = r4 - r2
if (r3 >= r5) goto end_inner
1] 1st Generation: Machine sort2(r1+r3*4,r1+r3*4+4)
Language: r3 = r3 + 1
goto start_inner
• Based on binary numbers end_inner:
r2 = r2 + 1
• The only programming language goto start_outer
end_outer:
that a computer (CPU) understands return
directly
• Machine dependent: Each family 3] 3rd Generation: High Level
of processors has its own machine Languages:
language • Do not require programmers to
Program Fragment: Y = Y + X know details relating to the
Machine Language Code processing of data
(Binary Code)
• Machine independent
Dpcode
1100 0000
Address
0010 0000 0000 0000 • Easier to read, write, and maintain
1011 0000
1001 0000
0001 0000 0000 0000
0010 0000 0000 0000 than assembly and machine lang.
Memory Cell Definitions: • Source code must be translated by
Addr. Name Cell Contents a language translator
1000 X 32
2000 Y 18
1
• Translators: -The finished compiled program runs
-Compilers translate source code into faster than an interpreted program
object code (object program) because the interpreter is constantly
-Interpreters translate source code one translating and executing as it goes.
line at a time and execute instructions -The interpreter immediately displays
without creating an object code feedback when it finds a syntax error.
C++ Program Java Program
Thus, the programmer can correct any
errors or debug the code before the
Ready-to-use
interpreter evaluates the next line. They
program file Machine
Language
immediately see the results of changes as
Compiler 1 11 0 Interpreter
0 0 011001 they are making them in the code.
Data
-Procedural Languages:
+A sequence of instructions to run,
• Interpreter: which uses program control structures
-Interpreter translates source code line by (IF, Loops, Functions…)
line +Examples: PASCAL, BASIC, COBOL,
-Each line is executed before the next line FORTRAN
is processed
-Programmers do not have to wait for the -Event-driven Languages:
entire program to be reprocessed each +Waits for events (mouse click, button
time they make a change press…) to process a defined set of
instructions (event handler)
Source
Program +Examples: C++, Javascript
Interpreter Results
-Visual Languages:
Data
+Allow programmer to manipulate
items visually on a form setting their
• Compilation vs. Interpretation: layout and properties.
-The compilation process takes longer +Creating Graphical User Interface
than the interpretation process because (GUI) applications.
in compilation, all of the lines of source +Examples: Visual Basic, Visual C++,
code are translated into machine Delphi
language before any lines are executed.
2
-Web-based Languages: 5] 5th Generation: Natural
+Uses special coding instructions to
Languages:
indicate style and layout of text and other
elements of web sites. • Non-procedural
+Mark-up and scripting languages. • Uses everyday language to
+Examples: HTML, XML, ASP program
• Example: Prolog
-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 Sample Code for Language
+Examples: C#, Java, Python Generations:
Gen. Example Sample Code
4] 4 Generation:
th
1st Machine
Bits describe the commands to the CPU.
1110 0101 1001 1111 0000 10111110 0110
Non-Procedural Languages: Words describe the commands to the CPU.
2nd Assembly
• Non-procedural languages ADD Register 3, Register 4, Register 5
3
PROGRAM DEVELOPMENT LIFE • Desk Checking
CYCLE (PDLC): -An important design tool
• An organized plan for breaking -The main purpose of desk checking the
down the task of program algorithm is to identify major logic
development into manageable parts errors early, so that they may be easily
corrected
Analysis -Logic errors are bugs that cause
program to run incorrectly and produce
undesired outputs
Deployment Design -Test data needs to be walked through
PDLC
each step in the algorithm, to check that
Phases
the instructions described in the
algorithm will actually do what they are
supposed to
Testing Coding
3] Coding:
-PDLC Phases- • Process of creating SW applications
1] Analysis: • Programmers use programing
• Defining the problem languages to convert algorithms into
• Interviews, questionnaires and source code
observation • Syntax errors:
• System analysts collect the user -Mistakes in the construction of the
requirements and specify the programming commands
program specifications specs -Must be corrected for the program to
• Specs define IPO run
-Input data • Integrated Development
-Processing Environment (IDE) helps
-Output data programmers write and test their
• Specs also include the appearance programs.
of user interface
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
4
• Version Control SW: 5] Deployment and
-SW tools that help team members Maintenance:
manage changes to the source code over • Deployment: All processes
time involved in getting new SW up and
-Keeps track of every modification by
running properly in its environment,
each contributor
including installation, configuration
-Developers can turn back to earlier
versions to help fix any mistakes running, testing and making
-Example tools: Git, CVS, SVN, Mercurial necessary changes
and Bazaar…. • Maintenance: Evaluate the
program on a regular basis
5
#Exercises: 15. ................... testing is conducted when
• Differentiate between: tester has no knowledge of code.
1. Source and machine code 16. Assessing the functionality of SW
2. White and black box testing program is called ................... .
3. Logic and syntax errors 17. The main purpose of ................... the
4. Compiler and interpreter algorithm is to identify major logic errors
5. Dynamic and static testing early to be easily corrected.
20. Evaluating the program on a regular
• Complete: basis is called ................... .
1. The ................... phase of PDLC includes 21. ................... translates source code one
identifying syntax errors. line at a time and execute instructions
2. Testing all possible logic paths in the without creating machine code.
software unit, with thorough knowledge 22. Phases of PDLC are ................... , ................. ,
of the logic is called ................... . ................... , ................... and ................... .
3. ................... allows complex operations to
be processed in one statement, e.g. report
generators and query languages.
4. ................... testing checks functional
behavior of SW by entering test data and
comparing results to expected results.
5. ................... are brief abbreviations for
program instructions that make assembly
language easier to use.
6. Interviews, questionnaires and
observation are employed in the ...................
phase of PDLC.
7. ................... is the vocabulary and rules of
a programming language.
8. ................... is the only programming
language that a computer (CPU)
understands directly.
9. ................... converts source code into
object program.
10. ................... are mistakes in construction
of programming commands which must
be corrected for program runs.
11. ................... are the processes involved in
getting new SW up and running properly
in its environment.
12. ................... and ................... are machine
dependent languages.
13. ................... code is full of GOTO
statements, which make code difficult to
follow and prone to errors.
14. The compilation process takes
................... time than the interpretation
process.
6