Presentation on theme: "Programming Domains Scientific Applications"— Presentation transcript:
1 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..
2 Programming Domains (con’d) Business ApplicationsThe 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.
3 Programming Domains (con’d) Artificial IntelligenceAI 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
4 Programming Domains (con’d) Systems Programming LanguagesThe 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.
5 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.
6 Programming Domains (con’d) Special-Purpose LanguagesA 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.
7 Language Evaluation Criteria ReadabilityWritabilityReliabilityCost
8 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: Ccount = count + 1count += 1count++++countOrthogonality – 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 languageOrthogonality 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.
9 ReadabilityControl 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.ExamplesGoto statements vs Loops
10 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.
11 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?)
12 WritabilityWritability is a measure of how easily a language can be used to create programs for a chosen problem domain.
13 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 abstractionData abstraction
14 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.
15 Reliability Type checking Exception Handling Aliasing Type checking is simply testing for type errors in a given program, either by the compiler or during program executionException HandlingAliasingReadability and Writability
16 CostThe ultimate total cost of a programming language is a function of many of its characteristics.Cost of training programmersCost of writing programs in the languageCost of compiling programsCost of executing programsCost of compilersCost of poor reliability
17 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.
18 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.
19 The von Neumann computer Architecture Memory (stores both instructions and data)Results of operationsInstructions & DataInput & Output DeviceArithmetic and Logic UnitControl UnitCentral Processing Unit
20 Influences on Language Designs Programming Methodologies(1960s) Structured ProgrammingProcess-Oriented(1970s) Object-Oriented ProgrammingData AbstractionEncapsulationInheritancePolymorphism
21 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 executionDisadvantage(s):- programs should be error-free before execution.
22 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
23 Influences on Language Designs 3. Hybrid Implementation SystemsA compromise between compilers and pure interpreters.
24 Evolution of Programming Languages (read Zuse’s Plankalkul) linkZ1 computer
25 Names, Bindings, Type Checking, and Scopes Name. A name is a string of characters used to identify some entity in a program.Design IssuesWhat 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?
26 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.
27 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 APPLEREAL = 3.4
28 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
29 VariablesA 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.
31 BindingBinding 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.
32 Binding (con’d)Example: Consider the following C assignment statement, whose variable count has been defined as shown:int count;…….count = count + 5;
33 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 timeType 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 timeMeaning of the operator symbol: bound at compile timeInternal representation of the literal 5: bound at compiler design time.
34 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.
35 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
36 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.
37 Next: Chapter 5 Data Types Concepts of Programming Languages, 3rd EditionRobert W. Sebesta