Introduction to Computing
Outline
Programming: A Five Step Procedure Five Generations of Programming Languages Some High Level Languages Object-Oriented Programming Internet Programming
Programming: A Five-Step Procedure
Program
A list of instructions that the computer must follow to process data into information
Programming
A five step process for creating that list of instructions
Programming: A Five-Step Procedure
Five Steps
1. Clarify the programming needs 2. Design the program 3. Code the program 4. Test the program 5. Document and maintain the program
Programming: Step 1
Clarify the Programming Needs
Clarify objectives and users Clarify desired outputs Clarify desired inputs Clarify the desired processing Double check the feasibility of implementing the program Document the analysis
5
Programming: Step 2
Design the program
To design the solution, one first needs to create an algorithm Algorithm
Is a formula or set of steps for solving a particular problem To be an algorithm, a set of rules must be unambiguous and have a clear stopping point
Programs can be planned out by the use of control structures
Sequence Selection Iteration
6
Programming: Step 2
Sequence
Statement
Statement
Programming: Step 2
Selection
Programming: Step 2
Iteration
Programming: Step 3
Code the Program
Select the appropriate high-level programming language
A programming language is a set of rules that tells the computer what operations to do Examples: C, C++, Java, etc.
Code the program in that language, following the syntax
Syntax the rules of a programming language
10
Programming: Step 4
Test the program
Program testing involves running various tests and then running real-world data to make sure the program works Two principles techniques for alpha testing: deskchecking and debug Desk-checking: proofread the code Debug
Detect, locate, and remove all errors in a computer program Syntax errors- cause by typographical errors and incorrect use of the programming language Logic errors- cause by incorrect use of control structures
Run real-world data beta testing
11
Program needs to be tested in the real world environment
Programming: Step 5
Document and Maintain the Program
Write user documentation Write operator documentation
Tells computer operators what to do when the software malfunctions
Write programmer documentation
Tells new programmers how to maintain the software
Maintain the program
Maintenance: any activity designed to keep programs in working condition, error-free, and up-to-date
12
Five Generations of Programming Languages
First Generation, 1945 - machine language
Basic language of the computer - binary digits - varies from machine to machine (not platform independent)
Second Generation, 1950s - assembly language
Assembly Language - assembles abbreviations - requires an assembler to run
Third Generation, 1960s - high level languages Includes
English like languages such as COBOL, and Basic. Requires and interpreter or a compiler Compiler - translates code into machine language BEFORE it is run.
pro - faster runtime
Interpreter - translates code to machine language on the fly while it is running
13
pro - can be platform independent
Five Generations of Programming Languages
Fourth Generation, 1970 - very high level languages
4GL for short Includes Report Generators, Query languages, and Application Generators
Fifth Generation, 1980s - natural languages
An attempt to emulate human thought and speech. Considered Artificial Intelligence.
14
Five Generations of Programming Languages
Machine Language 1945
The basic language of computer, representing data as 1s and 0s Lowest of all languages Each CPU model has its own machine language Faster, but less user friendly
15
Five Generations of Programming Languages
Assembly language 1950
Low level language that uses abbreviations instead of numbers Easier to program than machine language, but still requires a lot of learning Assembler translates assembly language into machine language
16
Five Generations of Programming Languages
High level languages - 1950s-1960s
Resembles some human language such as English Examples: Cobol, Pascal, C, BASIC, FORTRAN Compilers translates high level languages into machine language before the computer executes the program Is not computer specific
17
Five Generations of Programming Languages
/****************************************************************** * * Purpose: Program to demonstrate the 'while' statement. * Date: 20-Feb-2004 * Author: M J Leslie. * ******************************************************************/ #include <stdio.h> main() { int i=1; /* Define an integer variable. */ /* * i <= 10 expression is evaluated. If TRUE the * block is executed. */ while (i <= 10) { printf ("i is %d\n", i); i++; } 18 }
Five Generations of Programming Languages
Very high level language 1970s
More user oriented and allows users to develop programs with fewer commands compared to high level languages Examples: SQL, Intellect, NOMAD, FOCUS
19
Five Generations of Programming Languages
Natural language - 1980s
Comprises ordinary human languages Comprises programming languages that use human language to give people a more natural connection with computers Artificial Intelligence (AI) attempts to develop machines capable of emulating human qualities, such as learning, reasoning, communicating, seeing, and hearing
20
Some High Level Languages
Fortran - short of Formula Translator - for Math
Adv - can handle complex mathematical and logical expressions Dis - does not handle input and output as well as other languages
COBOL - Common Business Oriented Language - for Business
Adv- machine independent Dis- it is very wordy and lengthy
C - for portability and scientific use
Adv - works well with microcomputers Dis - difficult to learn.
BASIC - the Easy language
Adv - easy to use Dis - processing is slow
Pascal - the simple language
21
Adv - easy to learn, graphics abilities, appropriate for scientific use Div - limited input/output capabilities
Object-Oriented Programming
Objects are concepts of code that can be reused for similar applications It is a self-contained module. Methods are used to process and object. Encapsulation Inheritance Polymorphism C++ is a common object oriented language Visual programming - allows users to create simple program using a GUI instead of writing code
22
Internet Programming
HTML - Hypertext Markup language XML - extensible markup language VRML - Virtual Reality Markup Language - make 3D web environments Java - platform independent interpreted language similar to C++ Javascript - developed independently from Java, used in web browser to create dynamic websites ActiveX - Also for creating interactive web pages developed by Microsoft, features reusable components. Currently in competition with Java for the next step in Web technology.
23