Programming 1 DCT1123 Introduction To Programming Computer Programming Concept Problem Solving Flowchart Structure Programming Design Implementation Documentation Testing and Debugging.
Download
Report
Transcript Programming 1 DCT1123 Introduction To Programming Computer Programming Concept Problem Solving Flowchart Structure Programming Design Implementation Documentation Testing and Debugging.
Programming 1
DCT1123
Introduction To Programming
Computer Programming Concept
Problem Solving
Flowchart
Structure Programming Design
Implementation
Documentation
Testing and Debugging
OBJECTIVES
Understand
Computer Programming
Concept
Problem Solving
Design Flowchart
Structure Programming Design
Implementation of programming
Documentation in programming
Testing and Debugging programming
WHY LEARN PROGRAMMING?
To be a creator - Programming is like having access to the
absolute best set of legos in the world in almost unlimited
qualities
Automate Away Daily Drudgery - Programmers are famous
for being lazy--in fact, being lazy is one reason people are drawn
to programming. After all, why do something routine and
repetitive when you could have your computer do it for you?
Improve Your Computer Literacy and Know the Answer to
the "Why" Questions - People are often frustrated by technology
when it fails. Although operating systems such as Windows have
become much more stable, there are still many security holes
exploited every day. For a non-programmer, these issues are
mysteries: the machine that never makes mistakes is full of
problems, and who knows why?
HOW TO LEARN PROGRAMMING?
Look at the Example Code
Don't Just Read Example Code--Run It
Write your Own Code as Soon as Possible
Learn to Use a Debugger
Seek out More Sources
TYPES OF PROGRAMMING LANGUAGE
Procedural programming language – Fortran,
BASIC
Structural programming language – C, ADA,
Pascal
Object oriented programming language – JAVA,
VB, C#
HISTORY OF PROGRAMMING LANGUAGE
Before 1940: The Jacquard loom, invented in 1801, used holes in
punched cards to represent sewing loom arm movements in order
to generate decorative patterns automatically.
1940: first recognizably modern, electrically powered computers
were created
1950: 1960 – FORTRAN, LISP, COBOL
1967 – 1978: establishing fundamental paradigm – Simula, C,
Prolog,
The 1980s: consolidation, modules, performance – ADA, C++, Perl
The 1990s: the Internet age – PYTHON, VB, JAVA, PHP, ASP
PROGRAMMING
Program: self-contained set of instructions used
to operate a computer to produce a specific result
Also called software
Programming: the process of writing a
program, or software
PROGRAMMING
Machine language programs, also called
executables, consist of binary instructions
Each instruction has two parts:
Instruction part: the operation to be performed; also
called an opcode
Address part: memory address of the data to be used
Each class of computer has its own particular
machine language
PROGRAMMING STRUCTURE
Algorithm: the step-by-step sequence of
instructions that describe how the data is to be
processed to produce the desired output
Programming: the translation of the selected
algorithm into a language the computer can use
Pseudocode: English-like phrases used to
describe the algorithm
Formula: description of a mathematical
equation
Flowchart: diagram showing the flow of
instructions in an algorithm
– Flowcharts use special symbols
FLOWCHART
FLOWCHART
FLOWCHART: EXAMPLE
Figure 1.12 Flowchart for calculating
the average of three numbers.
PSEUDO CODE: EXAMPLE
Read NUMBER1, NUMBER2, NUMBER3
Compute AVERAGE as
((NUMBER1+NUMBER2+NUMBER3)/3)
Write (Display) AVERAGE
PROCESS OF PROGRAMMING
Identify problems – requirements, specification
Design a solution – pseudo code, flowchart
Program
Code - translating the design into an actual program,
written in some form of programming language
Compile - process of turning the program written in
some programming language into the instructions made
up of 0's and 1's that the computer can actually follow
Debug - task of looking at the original program,
identifying the mistakes, correcting the code and
recompiling it
IMPLEMENTATION
Write a program that could display following information
#include <iostream>
using namespace std;
int main()
{
cout << “Umar";
cout << "\n123 Jalan Cempaka";
cout << "\nChukai, Kemaman";
cin.ignore();
Microsoft
the
// this line is optional, it is used
// to keep the program from ending on
// systems/compilers so the user can see
output
return 0;
}
DOCUMENTATION IN
PROGRAMMING
/* my second program in C++ with more comments */
#include <iostream>
using namespace std;
int main ()
{
cout << "Hello World! "; // prints Hello World!
cout << "I'm a C++ program"; // prints I'm a C++ program
return 0;
}
COMMON PROGRAMMING MISTAKES
Starting to write the program before fully
understanding the requirements and the algorithm
to be used
Undeclared variables
Uninitialized variables
Using a single equal sign to check equality
Undeclared Functions
Extra Semicolons
Misusing the && and || operators
REFERENCES
http://www.cprogramming.com/whyprogram.html
http://www.giac.org/cissp-papers/97.pdf
http://www.cs.bham.ac.uk/~rxb/java/intro/2programming.html