Programming Domains - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Programming Domains

Description:

They range from RPG, which is used to produce business reports, to APT, which is ... programs should be error-free before execution. Implementation Methods ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 54
Provided by: badendcc
Category:

less

Transcript and Presenter's Notes

Title: Programming Domains


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 1950s and 1960s, no
    subsequent language is significantly better than
    FORTRAN.
  • .

2
Programming Domains (cond)
  • Business Applications
  • The use of computers for business applications
    began in the 1950s.
  • 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 (cond)
  • 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 1970s logic programming
    using Prolog language

4
Programming Domains (cond)
  • 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 1960s and 1970s, 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 (cond)
  • 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 (cond)
  • 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.

7
Language Evaluation Criteria
  • Readability
  • Writability
  • Reliability
  • Cost

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 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.

9
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

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
Writability
  • Writability 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 abstraction
  • Data abstraction

14
Writability
  • Expressivity
  • Expressivity in a language means that there are
    very powerful operators that allow a great deal
    of computation to be accomplished with a very
    small program.

15
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

16
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

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 (cond)
  • 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)
Instructions Data
Results of operations
Input Output Device
Arithmetic and Logic Unit
Control Unit
Central Processing Unit
20
Influences on Language Designs
  • Programming Methodologies
  • (1960s) Structured Programming
  • Process-Oriented
  • (1970s) Object-Oriented Programming
  • Data Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

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 execution
  • Disadvantage(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 Systems
  • A compromise between compilers and pure
    interpreters.

24
Evolution of Programming Languages
  • (read Zuses Plankalkul) link

Z1 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 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?

26
Names (cond)
  • 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 (cond)
  • 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

28
Names (cond)
  • 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
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.

30
Variables (cond)
  • Attributes
  • Name
  • Address
  • Aliases
  • Type
  • Value

31
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.

32
Binding (cond)
  • Example Consider the following C assignment
    statement, whose variable count has been defined
    as shown
  • int count
  • .
  • count count 5

33
Binding (cond)
  • 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.

34
Binding(cond)
  • 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(cond)
  • 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(cond)
  • 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
  • P 191
  • Concepts of Programming Languages, 3rd Edition
  • Robert W. Sebesta

38
DATA TYPES
  • Primitive Data Types are types which are not
    defined in terms of other types.
  • Examples in C
  • int
  • char
  • float
  • double
  • Void

39
DATA TYPES
  • Examples in Pascal
  • Char
  • Boolean
  • Integer
  • Real
  • String

40
DATA TYPES
  • Numeric Types
  • Integer is the most common primitive numeric data
    type is integer. Many computers now support
    several sizes of integers.
  • An integer value is represented in a computer by
    a string of bits, with one of the bits, typically
    the leftmost, representing the sign.
  • Most computers now use a notation called twos
    complement to store negative integers, which is
    convenient for addition and subtraction.

41
DATA TYPES
  • Floating-Point data types model real numbers, but
    the representations are only approximations for
    most real values.
  • Floating point values are represented as
    fractions and exponents.
  • Floating point types have values ranges that are
    defined in terms of precision and range.

42
DATA TYPES
  • Decimal (quite similar to Float?)
  • Most larger computers that are designed to
    support business systems applications have
    hardware support for decimal data types.
  • Decimal data types store a fixed number of
    decimal digits, with the decimal point at a fixed
    position in the value. These are the primary
    data types for business data processing and are
    there fore essential to COBOL.

43
DATA TYPES
  • Boolean types are perhaps the simplest of all
    types. Their range of values has only two
    elements, one for true and one for false. They
    were introduced in ALGOL 60 and have been
    included in most general-purpose languages
    designed since 1960.

44
DATA TYPES
  • Character Type are stored in computers as numeric
    codings. The most commonly used coding is ASCII
    (Americal Standard Code for Information
    Interchange)

45
Next Character String Type
  • P. 197 Concepts of PLs 3rd ed. Robert W. Sebesta.

46
Character String Types
  • A character string type is one in which the
    objects consist of sequences characters.
  • Design Issues
  • should strings be a primitive or simply a special
    kind of character array?
  • Should strings have static or dynamic length?

47
Character String Types
  • Strings and Their Operations
  • If strings are not defined as a primitive type,
    string data is usually stored in arrays of single
    characters.

48
Character String Types
  • String Length Options there are several design
    choices regarding the length of string objects.
  • First, the length can be static and specified in
    the declaration. (static length string)
  • The second option is to allow strings to have
    varying length up to a declared and fixed maximum
    set by the variables definition, as exemplified
    by the strings in C and C. (limited dynamic
    length)
  • The third option is to allow strings to have
    varying length with no maximum. (dynamic length
    strings)

49
Character String Types
  • Evaluation
  • String types are important to the writability of
    a language. Dealing with strings as arrays can
    be more cumbersome than dealing with a primitive
    string type. The addition of strings as a
    primitive type to a language is not costly, in
    terms of either language or compiler complexity.
    Therefore, it is difficult to justify the
    omission of primitive string types in some
    contemporary languages. Of course, the
    availability of standard libraries of string
    manipulation subprograms can remove this
    deficiency when strings are not included as a
    primitive type.

50
Array Types
  • What is an array?

51
Arrays
  • An array is a homogeneous aggregate of data
    elements in which the individual element is
    identified by its position in the aggregate,
    relative to the first element. The individual
    data elements of an array are of some previously
    defined type, either primitive or otherwise.

52
Arrays
  • Design Issues
  • The primary design issues specific to arrays are
    the following
  • What types are legal to subscripts?
  • When are subscript ranges bound?
  • When does array allocation take place?
  • How many subscripts are allowed ?
  • Can arrays be initialized when they have their
    storage allocated?

53
Record Types
  • A record is a possibly heterogeneous aggregate of
    data elements in which the individual elements
    are identified by names.
Write a Comment
User Comments (0)
About PowerShow.com