Friday, December 2, 2011
What is Computer Programming
By: razi.smartcomputing123@gmail.com
What is Computer Programming?
Computer Programming is …
the activities of writing set of instructions that will be executed by a computer machine.
A person who writes computer program is called …
a programmer.
Programming Activities
Programming activities involves:
Analyze user requirement
Design the program
Code the program
Test the program
Operate the program
1.Analyze User Requirement
Finding out:
What is the problem to be solved?
What are the constraints associated with the program?
What is the input/output that the program should get/produce?
Set the program objectives
INPUT
PROCESS
OUTPUT
integer1,
integer2
LET integer3 =sum of integer1 and integer2
integer3
A simple Input-Process-Output box showing the user requirement
2. Design The Program
Narrative Format (Pseudo-Code)
BEGIN
READ integer1, integer2
LET integer3=integer1 + integer2
PRINT integer3
END
Visual Format (Flow Chart)
BEGIN
READ integer1, integer2
LET integer3=integer1 + integer2
PRINT integer3
END
3. Code The Program
#include «iostream»
Using namespace std;
Int main(void){
int integer1,integer2,integer3;
cout««“Enter two integers:”;
cin»»integer1;
cin»»integer2;
integer3=integer1+integer2;
cout««“The sum is:”;
cout««integer3;
system(“PAUSE”);
return 0;
}
Enter two integers:
1
2
The sum is:
3
C++ Source Code Sample
C++ Console Output Sample
4. Test The Program
Test Case is …
a list of input values to be given to the program during runtime together with the expected outcome from the computer.
This helps to …
check whether a program is running according to its specified objectives.
(Test Cases for the program design in the previous slides)
5. Operate The Program
Install to the targeted platform
Training and support
Maintenance
Many types of programming languages
Programming languages…
Language used to construct the program codes
Various types exist…
To support different needs, focus and orientation of programming works
Popular ones are …
C, C++, Java, Visual Basic etc.
Programming Paradigm
The way programmer looks at problem-solving using computers
Procedure-oriented
Program is build from combination of code blocks (procedures)
Object-oriented
Problem-solving involves interaction between entities (objects) that incorporate data and functions.
Commonly Used Paradigm
Procedure-oriented programming
Why?
Simple
Easy to learn and apply
Practical
Available as…
Standalone (C++)
Script (VBA)
Which Language To Start?
It could be …
C++
It provides a starting point before moving to other languages such as Java, PHP etc.
Visual Basic
It provides a starting point for windows-based platform
Or whatever language that you may have found suitable reference and instructor to begin with :-)
Microsoft released a Visual Basic for kids called “Small Basic”
It is so ‘basic’ that a person could easily learn programming
Program Control Structures
Defines how program codes/statements should be executed by computer.
Generally…
Sequential
Execute from top to bottom (default)
Selection
Selectively Execute certain statements
Loop
Repeatedly Execute certain statements
Sequential Control Structure
Statements are executed one after another in a top-down direction.
Selection Control Structure
When the program control reaches a CHOICE point(diamond symbol), it must decide which branch to execute next.
Decision is based on the conditional statement (logic value, i.e TRUE or FALSE) that is placed at CHOICE point.
Loop Control Structure
When a program control reaches a CHOICE point, it must repeatedly execute certain instructions until a loop terminating condition is met.
The terminating condition can be determined either during programming or runtime.
Next?
Let’s start the coding!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment