1 / 17

An Introduction to Programming

An Introduction to Programming. General Concepts. What is a program?. A program is an algorithm expressed in a programming language . An algorithm is a detailed sequence of actions to perform to accomplish some task. Named after an Iranian mathematician, Al-Khwarizmi.

keaton
Download Presentation

An Introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. An Introduction to Programming General Concepts

  2. What is a program? A program is an algorithm expressed in a 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: • multiply the temperature by 9 • divide the result by 5 • increase the result by 32

  4. Algorithm: Key Elements Notice that there are 3 key elements of this example: • What to do – the operation • What to do it to – the data • 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.

  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. • This type of processing is called asynchronous.

  16. Event-driven Programming In VB6 we construct an interface of objects that the user can manipulate. Anything that can happen in the interface is called an Event. A VB6 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 VB6, as with most other programming languages, the programmer must deal with the 3 key elements: • Data • Flow of control • I/O

More Related