Computers‎ > ‎

Programming Language Concepts

Programming Language Concepts Introduction:

DEF | Programming Language -  is a language that can be used to implement any possible algorithm

DEF | High Level Programming Language - has no machine dependent constructs
  • C++ is technically not a high level language because it is dependent on the machine, Ex: floats ; However often  c++ is still referred to as high level, as well as most languages higher than machine code and assembly
DEF | Orthogonality - the control and data structures (if/then, loops, etc) in a programming language are based off of  a small number of basic constructs that make a small set of control and data structures.  ALSO- every  combination of the basic constructs is LEGAL.

DEF | Von Neumann Architecture - Computer Architecture that has both data and programs stored in the same  memory. The CPU executes instructions separate from memory; as a result instructions from a program must  be moved from memory to the CPU and then back to memory.

DEF | Imperative Language - language designed after the Von Neumann Architecture; Variables are in the form of the memory cells of the machine, assignment statements are made based on the pipe from the memory cell to the  CPU, and Repetition is based on a previous operation, in sequence.

DEF | Static - The process/data is defined during the Compilation / Linking / Loading phase before the execution

DEF | Dynamic - The process/data is defined during execution time

Reasons for Studying Concepts of Programming Languages
  1. Knowing a wider variety of languages helps people express ideas better / develop better because constructs from one language may be used in another, or implemented by the programmer
  2. Helps the programmer choose the appropriate language for the job (faster developing, faster execution, ect)
  3. Increases the speed of learning new languages
  4. Understanding implementation helps the programmer understand the best use of different languages / find bugs
  5. Helps advance computing languages
Programming Domains: Where Are Different Programs Used
  1. Computers are used everywhere, and different languages have been developed for different uses of the computers EX: games vs missile control, the missile language must be very reliable or disaster could strike
  2. Scientific Applications - need large numbers of floating-point arithmetic, and need to be fast run-time (Fortran)
  3. Business Applications - need reports, accurate ways of storing and doing decimal arithmetic (rounding half a penny downwards 100 million times could be a problem.)
  4. Artificial Intelligence - needs symbolic computation, doing functions based on names ; usually requires linked list over arrays
  5. Systems Programming - Operating System and systems software must be efficient because of continual use, also must have low-lvl features to write to IO
  6. Web Software -  dynamic web content, some need for computations-- usually a scripting language like PHPO or JavaScript
Language Evaluation Criteria; What Makes A Good Language
  1. Readability - code is easy to read and understand (What makes this next)
    1. Language is appropriate to problem (if not the solution may be unnatural and odd looking-- consider a language that does not have addition property doing addition)
    2. No Tricks or Puzzles (doing things more than one way for a situation, etc)
    3. Structured control - no go to's , the form of the code should be close to 1 to 1 for execution
    4. Syntactic Consistency - if it looks different , then it should execute differently
  2. Simplicity - easy to use and learn
    1. A small definition size for language constructs - so all programmers know the same material
    2. NO feature multiplicity - meaning you can only do something one way; EX: not like c++ incrementing (i++, i=i+1, i+=1)
    3. NO operator overloading - because the definition of the overload is dependent on the programmers meaning
    4. Natural notation - EX: reads left to right, addition is in equation form not something weird looking
    5. Regularity of Notation - rules for something will always be the same, never be the same, or are the same one time (people have a hard time remember anything beyond that / special rules)
    6. NOTE: extreme simplicity can be a hindrance as can be the case with assembly
  3. Orthogonality - without orthogonality the language will have rule exceptions -- high orthogonality however will lead to general rules which can be used in different instances -- EX: a pointer should be able to point to all data types, not just integers; Also in C an array is passed to functions differently that a variable
    1. Too much Orthogonality is bad as well because there must be a basic construct to match the larger number of definitions, therefore the basic constructs are more numerous leading to higher numbers of definitions
  4. Syntax Design -
    1. Identifiers should be able to have long names that are identifiable to what they do
    2. Special Words - should be defined clearly; if the special words are too general then it is hard to tell what they are doing; EX: } then end of a block in C++ could be for an if or a loop
      1. ALSO: Special words should be restrictive and not used for variables
    3. Form and Meaning - should be uniform not dependent on case usage
  5. Writeable - the ease of creating a program for a specific problem(domain of the language)
    1. Adequate built in types and operators
    2. support for abstraction - extending the definitions and operators
    3. Ignore Implementation - don't have to worry something will work the same on two different machines
    4. Support for parallel programming and other paradigms ; EX - java can only do object oriented writing which may not be the most simplistic way of doing something
  6. Reliability - if the program performs as expected under all conditions it is reliable (informing us if it didn't perform as expected)
    1. Type Checking - checking for type errors (an integer cannot suddenly become an array)
    2. Private Boundaries are enforced
    3. Exception Handling - stopping run-time errors
    4. NO aliasing - because it relies on the programmer remembering when to change values
  7. Portable  - has been standardized preferably by a standardizing organization like ANSI or ISO
    1. Has lots of compilers for different hardware but will run the same
  8. Re-use of Code
    1. Libraries of functions
    2. libraries of data structures
      1. That are general as is the case of template in C++
      2. Inheritance - using what you want from a library and adding something specific
  9. Cost - the total cost must be reasonable for its functional use
    1. Cost of training programmer
    2. Cost of writing the program
    3. Cost of compiling the program (some compilers are very expensive)
    4. Cost of executing program - if the run time time to start the program is too long users will not buy it
    5. Cost of implementation - does the program only run on expensive hardware
    6. Cost of poor Reliability - a failure in a critical system can cause lawsuits etc. EX: a missile is launched and hits a home because its guidance program failed
    7. Cost of Maintenance - if the program must be watched daily it will require personnel
Influences on Language Design Beyond Evaluation Criteria
  1. Computer Architecture - Most of the computers are based on the Von Neumann Architecture and as a result the languages are imperative; Thus recursion is not as efficient and not used as often.
  2. Programming Design Methodologies - As programmers refine their needs to create programs, languages have changed. EX: top-down design and data-oriented program design (data abstraction)
  3. Language Categories - imperative, functional, logic, and object oriented (Some people consider this a growth from imperative languages and therefore does not have its own category)
  4. Language Design Trade-Offs - what is more important in the program between the criteria for a good language; EX: Write-ability may fall as the Reliability increases
  5. Implementation Methods - If one processor supports a command and another does not then code using that command will not run on both machines
  6. Compilation - creates object code that is relevant to the machine
    1. Process as follows | Source Code -> Lexical Analyzer -> Syntax Analyzer -> Semantic Analyzer -> Code Generator -> Object File (Program Executable)
      1. Source Code - Program in High Level Language
      2. Lexical Analyzer - Checks symbols being used in the source for correctness; EX: legal names, order not specific
      3. Syntax Analyzer - AKA parser | Checks the grammar rules of the language; EX: for loop setup correctly
      4. Semantic Analyzer - Checks the meaning of constructs; EX: Type mismatch error
      5. Code Generator - Translates code to related assembly / machine code
      6. Object File  - File that can be run on machine
    2. Advantage is speed during runtime
  7. Pure Interpretation - checks each line of code and runs it one simulation machine (Virtual Machine)
    1. Advantage is debugging during runtime
    2. Much slower than compiled code
© 2010 copyright www.notes4free.com  Programming Language Concepts | Introduction
Comments