Programming Language Language Evaluation Criteria


Factors Influencing the Language Design (Reference only)



Download 181.29 Kb.
Page2/5
Date28.01.2017
Size181.29 Kb.
#10755
1   2   3   4   5

Factors Influencing the Language Design (Reference only)

Computer Architecture


  1. The most popular languages have all been designed around the prevalent architecture, called the von Neumann architecture.

von Neumann architecture

  1. Both data and program are stored in the same memory.

  2. The processor is a unit separate from the memory.

    1. Instructions and data must be piped, or transmitted, from memory to the processor.

    2. Results of operations in the processor must be moved back to memory.

  3. The von Neumann architecture causes the actual features of the imperative languages to be

    1. variables , which model the memory cells.

    2. assignment statements , which are based on the piping operation; store and load.

    3. the iterative form of repetition , (the instructions in a von Neumann computer are stored in adjacent cells of memory.)

Programming Methodologies


  1. Software engineering:

    1. the analysis of both the programming process and programming language design.

    2. under intense study since 1970s.

  2. An important reason for the research in software engineering was the shift in the major cost of computing from hardware to software.

(From 80% hardware, 20% software; To 20 % hardware, 80 % hardware)

  1. The primary programming language deficiencies that were discovered in the 1970s were incompleteness of type checking, inadequacy of control statements, and lack of facilities for exception handling.

  2. E.g. Process-oriented design and the extensive efforts in the area of concurrency that are taking place in the 1980s are bringing with them the need for complete language facilities for creating and controlling concurrent program units.

  3. Another example is the Object-oriented design (OOD) .

Object-oriented (OO) approach


  1. It emphasizes data design, concentrating on the use of logical, or abstract, data types to solve problems.

  2. For data abstraction to be used effectively in software system design, it should be supported by the languages used to write the system.

A Data base Application Example:



Button Dialog Box Scrollbar



User Interface Objects

ListBox Form Printer




Employee People Product



Application Objects

Directors Liabilities




Databases Tables



Database Objects

Fields Records



OO Terminology


  1. Class (noun)

    1. A Class is a Type of entities which have common attributes and behaviour.

    2. Examples: Employee, Printer, etc.

  2. Object or Instance (noun)

    1. An object is a particular entity which has attributes and behaviours as defined by a Class.

    2. Examples: John, Peter, Printer-1, Printer-2, etc.

  3. Attribute (noun or adj.)

    1. An attribute is a property of an object or class.

    2. Example: Employee::Name, Employee::HKID, Printer::ModelNumber, Printer::Weight, etc.

    3. An attribute can itself be an object or class.

    4. Examples: Employee::Product, etc.

  4. Message, Event

    1. Objects communicate with each other through message or event passing.

    2. Examples: Print, Save, Load, etc.

  5. Method

    1. Methods are the functions defined by the class or object.

    2. Some methods are used to handle events.

    3. Examples: Print, Save, Load, etc.

    4. Some methods are used to process information.

    5. Examples: CalculateAsset, FormatPage, etc.

Employee FormatPage Form PrintPage Printer

  1. Constructor VS Destructor

    1. Constructor is a special method of a class which is executed once when the object is first instantiated (created). A good place to put initialisation and setup code for the object.

    2. Destructor is a special method of a class which is executed once when the object is destroyed. A good place to release resources holding by the object.

OO methods


  1. The THREE OO programming methods: Inheritance, Encapsulation and Polymorphism.

Encapsulation

  1. What?

    1. It separate the interface from the implementation.

    2. It provide a well-define public interface to the user while hiding all internal complexities from them.

  2. Why? A well-designed interface can save the user from having to know the complexities of the implementation in order to use your class/object.

  3. How? In OO terms, an interface composes of methods and attributes visible to the user of your class.

  4. An Employee class:

    1. Identity the methods of an Employee from the context of the user, e.g. SignIn, SingOut, etc.

    2. Identity the attributes of an Employee from the context of the user, e.g. StaffID, Position, Department, Salary, etc.


Base Class

People (for class Employee)






is-a-kind-of Derive Class

(from class People)

Employee



is-a-kind-of is-a-kind-of




FullTime PartTime



Employee Employee
Inheritance

  1. What?

Inheritance specifies the relations between classes having similar properties.

  1. Why?

    1. It improves software reuse, eases software maintenance and eases software integration.

    2. OOD provides two class types, i.e. Base Class (Super-class) and Derive Class (Sub-class)

  2. Class Inheritance.

    1. A derive class inherits all methods and attributes of the base class.

    2. A derive class conceptually forms an “is-a-kind-of ” relationship with the base class.

Polymorphism


  1. What?

A particular function (e.g. Area()) behaves differently according to the class that the object belongs to. This is true even the object is accessed indirectly through a reference of a base class type.

  1. Why?

    1. It simplifies programming by treating derive classes as base classes. (E.g. for pass-by-reference parameter passing in function calls.)

    2. It simplifies maintenance by not having to know the exact identity of the objects, making the code more general and extensible when new derive classes are created.

Abstraction. Allows a designer to ignore details and remain focused on the big picture. Start with a general system outline and progressively add more detail. (top-down approach)

Object Relationships


  1. Is-a-kind-of relationship.

    1. Represented in OOD as inheritance, a derive class is-a-kind-of base class.

    2. E.g. Employee is-a-kind-of People, having all the methods and attributes of People.

  2. Consists-of Relationship.

    1. Occurs when an object is composed of other objects.

    2. Represented in OOD as attributes of a class.

    3. E.g. People consists-of a Name.

  3. Uses Relationship.

    1. An object (client) uses another object (server) to accomplish some task.

    2. An object can be both a client and a server.

    3. E.g. A Form object uses a Printer object to print the form.

  4. Contains Relationship

    1. Occurs when an object acts as containers for other objects.

    2. The containment is dynamic and usually transient, objects can be added to or removed from the container object.

    3. Represented in OOD as a container class.

    4. E.g. Lists, Queues, Forms, etc.


Download 181.29 Kb.

Share with your friends:
1   2   3   4   5




The database is protected by copyright ©ininet.org 2024
send message

    Main page