The document summarizes key points from a lecture on software programming. It discusses the five steps of programming: specification, design, coding, testing, and maintenance. It also covers different programming languages from machine language to natural languages. Object-oriented programming and visual programming are introduced as well. Common programming languages mentioned include C++, Python, and .NET.
6. Program design
2nd
Algorithm:
Set of finite steps that solves a problem
Algorithms are of many types
Algorithms may be classified into:
1. Optimal algorithms
(solves the problem to give the ‘best’ result)
2. Non-optimal algorithms
(may or may not provide acceptable results)
7. Program design
Classes of algorithm (non-exhaustive):
1. Deterministic vs. non-deterministic;
2. Exact vs. approximate algorithms;
3. Optimal vs. non-optimal algorithms;
Some algorithmic design paradigm:
1. Divide and Conquer algorithms;
2. Probabilistic algorithms;
3. Greedy algorithms; many others.
8. Program design
Heuristics:
Set of steps that usually solves a problem;
Solution may be non-optimal;
Good heuristics provide non-optimal but
acceptable solution for difficult problems;
Used when optimal algorithms are
complex/ non-existent.
9. Program design
components of design process:
1) Macro planning: high-level program
logic; (modularization)
2) Micro planning: the detailed planning;
(how to implement logic)
What to do?how to do it?
11. Program design
Program’s design details:
2 ways to show details:
i) Pseudocode: describes logic and
processing flow in human-language
statements
ii) Flow chart: graphically represents
logic flow.
Most projects use both methods
14. Program coding
3rd
1) Select the appropriate programming
language
2) Follow the Syntax of the chosen
programming language
15. Program coding paradigms
1)Structured Programming:
also called procedural programming
because it uses functions or procedures
Benefits:
reuse code written as function
programs are modular/ structured
2) Object Oriented Programming:
(to be covered later)
16. Common instructions
1. Input: from keyboard, file, or some device
2. Output: to display, file, or some device
3. Maths (logic): addition, multiplication, etc.
Control Structures
1. Sequence: instructions executed in sequence
2. Selection: conditional execution (if-then-else)
3. Iteration: some action repeatedly (do while)
Program coding
21. 1GL: Machine language
1st
• Written in binary
• Different for every CPU
• Used for programming
computers in the earliest
days of computers.
• Computers only understand this language
22. 2GL: Assembly language
2nd
LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
• Symbolic representation of machine language.
– opcodes
– operands
– labels
• More readable to human (not computer).
add A, B 1000111000010110
• Easy to translate to machine language.
Machine languageAssembly language
Machine language
Assembly language
23. 3GL- High-level language
3rd
•Supports structured and object-oriented
programming (OOP)
•Abstracts the hardware implementation
from the programmer
•Code is reusable and portable
•May be compiled/ or interpreted
26. 4GL-Very high-level languages
4th
Non procedural high-level specification
language.
4GL open up the development
environment to a wider population
Examples:
Database query language: SQL;
General use: PowerBuilder;
27. 5GL- Natural languages
5th
Algorithms do not have to be specified
Aims to make the programmer redundant
May not be created yet
Will create software automatically
31. Object Oriented Programming
Also called OOP
Intuitive method of programming
Code reuse
Code used in many projects
Speeds up program development
Simplifies program development
Enhances structured programming
32. Object Oriented Programming
Develops objects
All real world items are objects
Contains data about the item
Contains functionality
Object encapsulates both into one package
33. Visual Programming
Programming is done using a graphical
interface;
No actual coding is done;
Code is generated through specification of
functionality using menus and graphical
manipulation of program elements;
Intended to be user friendly.
Algorithm
Set of steps
Always leads to a solution
Steps are always the same
Flowcharts can describe algorithms
Structured tool for drawing algorithms
Algorithms appear in all programs
Some types of algorithms are:
Divide and conquer algorithm
Greedy algorithm
Heuristic
Set of steps
Solution is usually found
Solution may not be optimal
Used when algorithms fail
Algorithm is nonexistent or too complex
Appear in more complex applications
Forensics
Data mining
Anti-virus software
Deterministic algorithms solve the problem with exact decision at every step of the algorithm whereas non-deterministic algorithm solve problems via guessing although typical guesses are made more accurate through the use of heuristics.
Exact or approximate: While many algorithms reach an exact solution, approximation algorithms seek an approximation that is close to the true solution. Approximation may use either a deterministic or a random strategy. Such algorithms have practical value for many hard problems.
Divide and conquer. A divide and conquer algorithm repeatedly reduces an instance of a problem to one or more smaller instances of the same problem (usually recursively) until the instances are small enough to solve easily. One such example of divide and conquer is merge sorting. Sorting can be done on each segment of data after dividing data into segments and sorting of entire data can be obtained in the conquer phase by merging the segments. A simpler variant of divide and conquer is called a decrease and conquer algorithm, that solves an identical subproblem and uses the solution of this subproblem to solve the bigger problem. Divide and conquer divides the problem into multiple subproblems and so conquer stage will be more complex than decrease and conquer algorithms. An example of decrease and conquer algorithm is the binary search algorithm.
Choice in a "greedy" algorithm is made of what looks best for the moment. It does not give accurate answer to many problems. But when it works, it will be the fastest method.
Used when the optimal solution may take a very long time, and an acceptable solution in shorter time through heuristic means is more acceptable.
Heuristic
Set of steps
Solution is usually found
Solution may not be optimal
Used when algorithms fail
Algorithm is nonexistent or too complex
Appear in more complex applications
Forensics
Data mining
Anti-virus software
Algorithm
Set of steps
Always leads to a solution
Steps are always the same
Flowcharts can describe algorithms
Structured tool for drawing algorithms
Algorithms appear in all programs
Heuristic
Set of steps
Solution is usually found
Solution may not be optimal
Used when algorithms fail
Algorithm is nonexistent or too complex
Appear in more complex applications
Data mining
Anti-virus software
http://www.shk-dplc.com/cfo/bin/litigate/figure1.jpg
Each module must be of manageable size
Each module should be independent and have a single function
The functions of input and output are clearly defined in separate modules.
Each module has a single entry point and single exit point
If one module refers to or transfers control to another module, the latter module always returns control to the point which it was called by the first module.
http://www.shk-dplc.com/cfo/bin/litigate/figure1.jpg
Each module must be of manageable size
Each module should be independent and have a single function
The functions of input and output are clearly defined in separate modules.
Each module has a single entry point and single exit point
If one module refers to or transfers control to another module, the latter module always returns control to the point which it was called by the first module.
http://www.shk-dplc.com/cfo/bin/litigate/figure1.jpg
Each module must be of manageable size
Each module should be independent and have a single function
The functions of input and output are clearly defined in separate modules.
Each module has a single entry point and single exit point
If one module refers to or transfers control to another module, the latter module always returns control to the point which it was called by the first module.
The above general kinds of instruction are common to all programming languages.
Easier to use than 3GL
Coded in a visual IDE
Tools reduce the amount of code
Object oriented programming
Microsoft .Net is a language
Dream Weaver is an 4GL IDE