Introduction to Programming session 3 Instructor: Reza Entezari-Maleki Email: entezari@ce.sharif.edu 1 Fall 2010 These slides are created using Deitel s slides Sahrif University of Technology
Outlines Common Softwares (Cont'd) Programming Language History of C and C++ Other Programming Languages 2
Common Softwares Operating System Compilers Assemblers Interpreters 3
What does the computer understand? Computer only understands machine language instructions. 4
Assembler Instructions written in assembly language must be translated to machine language instructions : Assembler does this One to one translation : One AL instruction is mapped to one ML instruction. AL instructions are CPU specific. 5
Compiler Instructions written in high-level language also must be translated to machine language instructions : Compiler does this Generally one to many translation : One HL instruction is mapped to many ML instruction. HL instructions are not CPU specific but compiler is. 6
7 Translation from HLL to ML
Interpreter An interpreter translates high-level instructions into an intermediate form, which it then executes. In contrast, a compiler translates high-level instructions directly into machine language. Compiled programs generally run faster than interpreted programs. The advantage of an interpreter, however, is that it does not need to go through the compilation stage during which machine instructions are generated. This process can be time-consuming if the program is long. The interpreter, on the other hand, can immediately execute high-level programs. For this reason, interpreters are sometimes used during the development of a program, when a programmer wants to add small sections at a time and test them quickly. 8
Programming Language (2) A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine, to express algorithms precisely, or as a mode of human communication. Many programming languages have some form of written specification of their syntax (form) and semantics (meaning). Some languages are defined by a specification document. For example, the C programming language is specified by an ISO Standard. Other languages, such as Perl, have a dominant implementation that is used as a reference. 9
Programming Language (2) A programming language is a notation for writing programs, which are specifications of a computation or algorithm. Some, but not all, authors restrict the term "programming language" to those languages that can expressall possible algorithms. 10
History of C and C++ History of C Evolved from two other programming languages BCPL and B Typeless languages Dennis Ritchie (Bell Laboratories) Added data typing, other features Development language of UNIX Hardware independent Portable programs 1989: ANSI standard 1990: ANSI and ISO standard published ANSI/ISO 9899: 1990 11
History of C and C++ History of C++ Extension of C Early 1980s: Bjarne Stroustrup (Bell Laboratories) Provides capabilities for object-oriented programming Objects: reusable software components Model items in real world Object-oriented programs Easy to understand, correct and modify Hybrid language C-like style Object-oriented style Both 12
C++ Standard Library C++ programs Built from pieces called classes and functions C++ standard library Rich collections of existing classes and functions Building block approach to creating programs Software reuse 13
Java Java 1991: Sun Microsystems Green project 1995: Sun Microsystems Formally announced Java at trade show Web pages with dynamic and interactive content Develop large-scale enterprise applications Provide applications for consumer devices Cell phones, pagers, personal digital assistants, 14
Visual Basic, Visual C++ and C# BASIC Beginner s All-Purpose Symbolic Instruction Code Mid-1960s: Prof. John Kemeny and Thomas Kurtz (Dartmouth College) Visual Basic 1991 Result of Microsoft Windows graphical user interface (GUI) Developed late 1980s, early 1990s Powerful features GUI, event handling, access to Win32 API, object-oriented programming, error handling Visual Basic.NET 15
Visual Basic, Visual C++ and C# Visual C++ Microsoft s implementation of C++ Includes extensions Microsoft Foundation Classes (MFC) Common library GUI, graphics, networking, multithreading, Shared among Visual Basic, Visual C++, C#.NET platform Web-based applications Distributed to great variety of devices Cell phones, desktop computers 16
Visual Basic, Visual C++ and C# C# Anders Hejlsberg and Scott Wiltamuth (Microsoft) Designed specifically for.net platform Roots in C, C++ and Java Easy migration to.net Event-driven, fully object-oriented, visual programming language Integrated Development Environment (IDE) Create, run, test and debug C# programs Rapid Application Development (RAD) Language interoperability 17
Other High-level Languages FORTRAN FORmulaTRANslator 1954-1957: IBM Complex mathematical computations Scientific and engineering applications COBOL COmmon Business Oriented Language 1959: computer manufacturers, government and industrial computer users Precise and efficient manipulation of large amounts of data Commercial applications 18
Other High-level Languages Pascal Prof. NiklausWirth Academic use 19
Structured Programming Structured programming (1960s) Disciplined approach to writing programs Clear, easy to test and debug, and easy to modify Pascal 1971: NiklausWirth Ada 1970s - early 1980s: US Department of Defense (DoD) Multitasking Programmer can specify many activities to run in parallel 20
The Key Software Trend: Object Technology Objects Reusable software components that model real world items Meaningful software units Date objects, time objects, paycheck objects, invoice objects, audio objects, video objects, file objects, record objects, etc. More understandable, better organized and easier to maintain than procedural programming Favor modularity Software reuse Libraries o MFC (Microsoft Foundation Classes) 21