Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.

Similar presentations


Presentation on theme: "An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language."— Presentation transcript:

1 An Introduction to Programming General Concepts

2 What is a program? A program is an algorithm expressed in a programming language. programming language An algorithm is a detailed sequence of actions to perform to accomplish some task. Named after an Iranian mathematician, Al-Khwarizmi. Technically, an algorithm must reach a result after a finite number of steps.

3 Algorithm: An Example To convert Celsius degrees to Fahrenheit: 1.multiply the temperature by 9 2.divide the result by 5 3.increase the result by 32

4 Algorithm: Key Elements Notice that there are 3 key elements of this example: 1.What to do – the operation 2.What to do it to – the data 3.When to do it – the sequence

5 Algorithm: Key Elements The operations that can be performed on data are defined for each programming language and associated with special symbols. The data elements that can be manipulated fall into 2 categories: The order in which the instructions are executed is determined by their sequence. literalvariable

6 Key Elements of Programs All programs are algorithms, but not all algorithms are programs. While the example demonstrates several key elements of algorithms, it omits an essential element of all programs: Input/Output (I/O)

7 Key Elements of Programs The key elements of programs are: –Input/Output How a program communicates with the user. –Logic The order in which activities are carried out. –Data Storage Manipulation

8 Evolution of I/O Early in the history of computing, programs were submitted on punch cards with all the data they required and executed together with other programs that used the same libraries. Output was to a line printer. Many computing tasks are well suited to this batch mode of processing. Later developments introduced interactive processing which allowed the user to provide data while the program was running. This normally takes place in a Question & Answer format.

9 Evolution of I/O The development of the Graphic User Interface (GUI) provided the opportunity for another development. The GUI is not restricted to interacting with the user one line at a time. It can present several options to the user and respond to whichever is selected.

10 Language Paradigms The evolution of I/O reflected changes in the way programmers looked at programming. Several paradigms have been developed. What is a paradigm? –A set of assumptions, concepts, values, and practices that constitute a way of viewing reality.

11 Programming Language Paradigms Imperative or procedural model –Algorithms are expressed as a hierarchy of tasks. FORTRAN, COBOL, BASIC, C, Pascal, Ada, and C++

12 Programming Language Paradigms Functional model –Computation is expressed in terms of the evaluation of functions. –A solution is expressed in terms of function calls. LISP, Scheme (a derivative of LISP), and ML

13 Programming Language Paradigms Logic programming –Based on symbolic logic –A “program” consists of a set of facts about objects, a set of rules about relationships between the objects, and a way to ask questions about the objects and their relationships. –PROLOG

14 Programming Language Paradigms Object-oriented paradigm –Views the world as interacting objects –Objects are active, and responsible for their own manipulation. SIMULA and Smalltalk C++ is as an imperative language with some object-oriented features. Java is an object-oriented language with some imperative features.

15 Asynchronous Processing Asynchronous processing: The concept that input and output can be accomplished through windows on the screen. –Clicking has become a major form of input to the computer. –Mouse clicking is not within the sequence of the program. –A user can click a mouse at any time during the execution of a program.

16 Event-driven Programming In VB we construct an interface of objects that the user can manipulate. Anything that can happen in the interface is called an Event. A VB project consists of the programs that will be executed when each Event occurs. Hence the term Event-driven programming.

17 Event-driven Programming Even though the approach is very different on the user end, ultimately Events invoke procedures, so the fundamental skills of programming haven’t changed much. In VB, as with most other programming languages, the programmer must deal with the 3 key elements: –Data –Flow of control –I/O


Download ppt "An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language."

Similar presentations


Ads by Google