440 likes | 907 Views
Programming Domains. Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point arithmetic computations.
E N D
Programming Domains Scientific Applications Typically, scientific applications have simple data structures but require large numbers of floating-point arithmetic computations. For some scientific applications where efficiency is the primary concern, like those that were common in the 1950’s and 1960’s, no subsequent language is significantly better than FORTRAN. .
Programming Domains (con’d) Business Applications The use of computers for business applications began in the 1950’s. The first successful high-level language for business was COBOL which appeared in 1960. Business languages are characterized, according to the needs of the application, by elaborate input and output facilities and decimal data types. With the advent of microcomputers came new ways of businesses, especially small businesses, to use computers. Two specific tools, spreadsheet systems and database systems, were developed for business and now are widely used.
Programming Domains (con’d) Artificial Intelligence AI is a broad area of computer applications characterized by the absence of exact algorithms and the use of symbolic computations rather than numeric computation. Symbolic computation means that symbols, consisting of names rather than numbers, are manipulated. The first widely used programming language developed for AI applications was the functional language LISP (Scheme) which appeared in 1959. An alternative approach to these applications appeared in the early 1970’s: logic programming using Prolog language
Programming Domains (con’d) Systems Programming Languages The operating system and all of the programming support tools of a computer system are collectively known as its systems software. Systems software is used almost continuously and therefore must have execution efficiency. A language for this domain must have low-level features that allow the software to external devices to be written. In the 1960’s and 1970’s, some computer manufacturers, such as IBM, Digital, and Burroughs (now UNISYS) developed special machine-oriented high level languages for systems software on their machines. For IBM mainframe computers, the language was PL/S, a dialect of PL/I; for Digital, it Is BLISS, a language at a level just above assembly language; for Burroughs, it was Extended Algol. The UNIX operating system is written almost entirely in C, which was made it relatively easy to port, or move, to different machines.
Programming Domains (con’d) Very High-level Languages (VHLLs) The languages in the category called very high-level have evolved slowly over the past 25 years. The various scripting languages for UNIX are examples of VHLLs. A scripting language is one that is used by putting a list of commands, called script, in a file to be executed. The first of these languages, named shell, began as a small collection of commands that were interpreted to be calls to system subprograms that performed utility functions, such as file management and simple file filtering. Other VHLLs are awk, for report generation, tcl combined with tk, which provide a method of building X Windows applications. The perl is a combination of shell and awk.
Programming Domains (con’d) • Special-Purpose Languages • A host of special-purpose languages have appeared over the past 40 years. • They range from RPG, which is used to produce business reports, to APT, which is used for instructing programmable machine tools, to GPSS, which is used for systems simulation.
Language Evaluation Criteria • Readability • Writability • Reliability • Cost
Readability • The ease with which programs can be read and understood. • Overall Simplicity – A language that has a large number of basic components is more difficult to learn than one with a small number of basic componenets. examples: C count = count + 1 count += 1 count++ ++count • Orthogonality – in a programming language means that a relatively small set of primitive constructs can be combines in a relatively small number of ways to build the control and data structures of the language • Orthogonality is closely related to simplicity. The more orthogonal the design of a language, the fewer exceptions the language rules require. Fewer exceptions means a higher degree of regularity in the design, which makes the language easier to learn.
Readability • Control Structures. The structured programming revolution of the 1970s was a reaction to the poor readability caused by the limited control statements of some of the languages of the 1950s and 1960s. • Examples • Goto statements vs Loops
Readability • Data Types and Structures. • The presence of adequate facilities for defining data types and data structures in a language is another significant aid to readability.
Readability • Syntax Considerations • The syntax, or form, of the elements of a language has a significant effect on the readability of programs. • Examples: • Identifier Forms (length, case sensitivity) • Special Words (* & + %) • Form and Meaning (Appearance does not always suggest their function?)
Writability Writability is a measure of how easily a language can be used to create programs for a chosen problem domain.
Writability • Simplicity and Orthogonality • Support for Abstraction • Abstraction means the ability to define and then use complicated structures or operations in ways that allow many of the details to be ignored. • Process abstraction • Data abstraction
Writability • Expressivity • Expressivity in a language means that there are very powerful operators that allow a great dean of computation to be accomplished with a very small program.
Reliability • Type checking • Type checking is simply testing for type errors in a given program, either by the compiler or during program execution • Exception Handling • Aliasing • Readability and Writability
Cost • The ultimate total cost of a programming language is a function of many of its characteristics. • Cost of training programmers • Cost of writing programs in the language • Cost of compiling programs • Cost of executing programs • Cost of compilers • Cost of poor reliability
Influences on Language Design Computer Architecture - the basic architecture of computers has a crucial effect on language design. Most of the popular languages of the past 35 years have been designed around the prevalent computer architecture, called the von Neumann architecture. These languages are called imperative languages.
Influences on Language Design • Computer Architecture (con’d) • In a von Neumann computer, both data and programs are stored in the same memory. The central processing unit (CPU), which actually executes instructions is separate from the memory. Therefore, instructions and data must be piped, from the memory to the CPU. Results of operations in the CPU must be moved back to memory.
The von Neumann computer Architecture Memory (stores both instructions and data) Results of operations Instructions & Data Input & Output Device Arithmetic and Logic Unit Control Unit Central Processing Unit
Influences on Language Designs • Programming Methodologies • (1960s) Structured Programming • Process-Oriented • (1970s) Object-Oriented Programming • Data Abstraction • Encapsulation • Inheritance • Polymorphism
Implementation Methods • Programming languages can be implemented by any of the three general methods. 1. Compilation – programs are translated to machine language which can then be executed directly on the computer. Advantage(s): - very fast program execution Disadvantage(s): - programs should be error-free before execution.
Implementation Methods 2. Pure Interpretation – The interpreter program acts as a software simulation of a machine whose fetch-execute cycle deals with high-level language program statements rather than machine instructions. This software simulation obviously provides a virtual-machine for the language. Advantage: - Allows easy implementation of many source-level debugging operations. Disadvantage: - Requires more space
Influences on Language Designs 3. Hybrid Implementation Systems A compromise between compilers and pure interpreters.
Evolution of Programming Languages (read Zuse’s Plankalkul) link Z1 computer
Names, Bindings, Type Checking, and Scopes • Name. A name is a string of characters used to identify some entity in a program. • Design Issues • What is the maximum length of a name? • Can connector characters be used in names? • Are names case sensitive? • Are special words reserved words or keywords?
Names (con’d) • Special Words • Special words in programming languages are used to make programs more readable by naming actions to be performed. They also are used to separate the syntactic entities of programs. In most languages, these words are classified as reserved words, but in some they are only keywords.
Names (con’d) • Keyword – is a word of a programming language that is special only in certain contexts. • Example (FORTRAN) Fortran is one of the languages whose special words are keywords. REAL APPLE REAL = 3.4
Names (con’d) • Reserved Word is a special word of a programming language that cannot be used as a name. As a language design choice, reserved words are better than keywords because the ability to redefine keywords can lead to readability problems
Variables • A program variable is nothing more than an abstraction of a computer memory cell or collection of cells. Programmer often think of variable as names for memory locations, although there is much more to a variable than just a name.
Variables (con’d) • Attributes • Name • Address • Aliases • Type • Value
Binding • Binding is an association, such as between an attribute and an entity or between an operation and a symbol. The time at which a binding takes place is called binding time.
Binding (con’d) • Example: Consider the following C assignment statement, whose variable count has been defined as shown: int count; ……. count = count + 5;
Binding (con’d) • Some of the bindings and their binding times for the parts of this assignment statement are as follows: • Set of possible types for count: bound at language design time • Type of count: bound at compile time. • Set of possible values of count: bound at compiler design time. • Value of count: bound at execution time with this statement. • Set of possible meanings for the operator symbol: bound at language definition time • Meaning of the operator symbol: bound at compile time • Internal representation of the literal 5: bound at compiler design time.
Binding(con’d) • Binding of Attributes to Variables A binding is static if it occurs before run time and remains unchanged throughout the program execution. If it occurs during run time or can change in the course of program execution, it is called dynamic.
Bindings(con’d) • Type Bindings • Explicit declaration – is a statement in a program that lists variable names and declares them to be of a particular type. • Implicit declaration – is a means of associating variables with types through default conventions instead of declaration statements. • Type inference
Bindings(con’d) • Static Variables • Are those that are bound to memory cells before program execution begins and remain bound to those same memory cells until program execution terminates.
Next: Chapter 5Data Types • P 191 • Concepts of Programming Languages, 3rd Edition Robert W. Sebesta