Overview
• Summary (Previous Lesson)
• Classification of Programming Languages
• Selecting a Suitable Computer Language
• Examples (Assembly, C, C++, JAVA, .NET,
PROLOG etc)
• Stages of Computer Programming
• Characteristics of a Good Computer Program
2 Budditha Hettige ([email protected])
Summary (Previous Lesson)
• How Problem Solve by machine? – Input, Output, Process
• What is Program? – The sequence of instructions
• What are the Programming Languages – JAVA, C++, Assembly, VB.NET, C#
• Compilers and Interpreters – C++ Compiler
• Tools and Tips for Programming – Text Editor, Compiler
• Programming IDEs – NetBeans, Visual Studio etc
3 Budditha Hettige ([email protected])
Programming language
generations
This classification was used to indicate increasing
power of programming styles
1. First-generation programming languages
2. Second-generation programming languages
3. Third-generation programming languages
4. Fourth-generation programming languages
5. Fifth-generation programming languages
4 Budditha Hettige ([email protected])
First-generation programming
language
• Is a machine-level programming language
• No translator was used to compile or assemble the
first-generation language
• The instructions in 1GL are made of binary
numbers, represented by 1s and 0s
• Advantage
– The code can run very fast and very efficiently because
the instructions are executed directly by the CPU
• Disadvantage
– When an error occurs, the code is not as easy to fix
5 Budditha Hettige ([email protected])
Second-generation programming
language
• Assembly languages.
• Properties
– The code can be read and written by a
programmer
– The language is specific to a particular processor
family and environment
• Used in kernels and device drivers
6 Budditha Hettige ([email protected])
Third-generation programming
language
• Languages are more programmer-friendly
• Example
– C, C++, C#, Java, BASIC and Pascal
• Support structured programming.
• Must be translated into machine language by a
compiler or interpreter
• Advantage
– Easier to read, write, and maintain
7 Budditha Hettige ([email protected])
Fourth-generation programming
language
• Designed to reduce programming effort
• Consist of – Set of libraries
– CRUD generators
– Report generators
– DBMS
– Visual design tool and integration API
• Different types of 4GLs – Table-driven (codeless) programming
• PowerBuilder
– Data management • SAS, SPSS
– Report-generator programming languages • Oracle Developer Suite
8 Budditha Hettige ([email protected])
Fifth-generation programming
language
• Based on solving problems using constraints given
to the program, rather than using an algorithm
written by a programmer
• Are used mainly in Artificial Intelligence research
• Example
– Prolog, OPS5, and Mercury
9 Budditha Hettige ([email protected])
Selecting a Suitable Computer
Language
• How readable is the language, to humans?
• How easy is it to write the program in this particular
language?
• How reliable is the language?
• How much would it cost to develop using a given
language?
• How complicated is the syntax going to be?
• Does the language have standards for greater
readability? For instance Java has standards for
naming, commenting and capitalization
10 Budditha Hettige ([email protected])
Example
• Assemble Language Program
– Device drivers, Virus
• C / C++ Program
– Device drivers , DLLs
• JAVA / Visual C++ Program
– Desktop applications, Web Applications
• Prolog
– AI based applications, Games, Translators
11 Budditha Hettige ([email protected])
Stages of Computer Programming
1. Plan to solve the problem
2. Analysis the problem
3. Design the Solution
4. Implementation
5. Program Testing
6. Program maintenance and update
12 Budditha Hettige ([email protected])
Plan to solve the problem
• Is to identify the scope of the project
• Estimate the work involved
• Create a project schedule
• Begins with requirements that define the software to
be developed.
• The project plan is developed to describe the tasks
13 Budditha Hettige ([email protected])
Analysis the problem
• is a complete description of the behavior of a
system
• Consist of
– Functional requirements
– Non-functional requirements
• Methods for the analysis
– Interview
– Questionnaires
– Observation etc.
14 Budditha Hettige ([email protected])
Design
• Software design is a process of problem-solving and planning for a software solution
• Types – Top down
– Bottom up
– Module design
• Use to describe – Algorithm
– Flowchart
– Pseudo code
15 Budditha Hettige ([email protected])
Design cont.…
• Algorithm – An instance of logic written in software by
software developers to be effective for the
intended "target" computer(s) for the target
machines to produce output from given input
– One problem can be solve through the different
Algorithm
16 Budditha Hettige ([email protected])
Design cont.…
• Flowcharts: – is a type of diagram that
represents an algorithm or
process
– Gives diagrammatic
representation solution to a
given problem
– Flowcharts are used in
analyzing, designing,
documenting or managing a
process or program
19 Budditha Hettige ([email protected])
Example
• Draw a flow chart to search the
valid login for the given user
name and password
23 Budditha Hettige ([email protected])
Implementation
• An implementation is a realization of a
technical specification or algorithm as a
program, software component through
computer programming
• implementations may exist for a given
specification or standard
– Example World Wide Web Consortium-
recommended specifications
• After implement
– Source code, together with documentation to
make the code more readable.
24 Budditha Hettige ([email protected])
Program Testing
• is an investigation conducted to provide
information about the quality of the
product
• A primary purpose of testing is to detect
software failures
• Test
– White box test
– Black box test
25 Budditha Hettige ([email protected])
Program Maintenance and Update
• Is the modification of a software product after delivery to correct faults
• Maintenance may span for 20 years, whereas development may be 1-2 year
• User guide, Maintenance manual need to provides
• Example
– Windows XP (Development few years, Maintenance ….)
– Provides set of software updates patches etc.
26 Budditha Hettige ([email protected])
The Characteristics of a Good
Computer Program Reliability:
The program should provide correct results at all times and should be free from errors.
Maintainability:
The existing program should be able to change or modify to meet new requirements.
Portability:
The program should be able to transfer to a different computer system.
Readability:
The program must be readable and understandable with the help of documentation.
Performance:
The program should handle the task more quickly and efficiently.
Storage saving:
The program should be written with the least number of instructions
27 Budditha Hettige ([email protected])
Exercise 1. What are the advantages and disadvantages of the
each generations of the programming languages
2. What is the best programming language to develop
following type of applications?
1. Calculator
2. Payroll management system
3. Device driver
4. Intelligent game
3. Draw a flowchart for the following
1. Enter two number from key bard and print average
2. Enter three number and find the maximum number
3. Process of the ATM machine
28 Budditha Hettige ([email protected])