Page 78 - DLIS108_INFORMATION_AND_COMMUNICATION_TECHNOLOGY_APPLICATIONS
P. 78

VED1
            e\L-lovely-eng\comm8-1.pmd  IInd 16-9-11  IIIrd  22-12-11 IVth 4-1-12


                                                                     Unit 8: Programming Language: Types and Functions




              •  Depending on the language, signals normally cause a user-provided routine to be called,
                 smack in the middle of everything. Exceptions can be reduced to signals, but this is inelegant.  Notes
              •  An exception handler is attached to some unit, and is executed instead of the remainder of the
                 unit when an exception occurs.
              •  Program holds module which contain routines which consist of blocks.
              •  Distinguish blocks, scopes and visibility ranges.
              •  There is no fundamental difference between functions and operators: operators are a special
                 case of functions and functions are a special case of operators.
              •  Just as we have anonymous integer values or anonymous array values, we can have anony-
                 mous routine values.
              •  A module is like a record in that it provides a syntactic scope the names in which can be
                 known outside that scope.
              •  Specification modules: Contain the information needed by user and compiler to use the items
                 declared in the module. Implementation modules: contain the rest which compiled once and
                 stored in a library.
              •  A module contains a data type with its routines. An abstract data type is a data type and
                 contains its routines as some of its fields.
              •  A generic item is a template from which one or more items can be created at compile time
                 through instantiation. This template has parameters, typed with a generic type. A generic
                 type is not restricted to data types and can include such things as data type names, macro
                 names, etc.
              •  In Icon, an expression yields a result and a suspended expression; the latter is invisible to the
                 user, but is used by the system to obtain further results if the present result causes failure of
                 some sort.
              •  Icon is very suitable for search and combinatorial problems.
              •  Prolog uses a stack rather than local and formal variables to store and pass data.




                    Imperative languages are procedural, command-driven or statement oriented
                    languages. e.g., C, C++, FORTRAN, ALGOL, Ada, Pascal, Smalltalk. Support this model.

            8.6.2 Object-Oriented Languages

              •  Object-orientation = abstract data type + inheritance + dynamic binding.
              •  Abstract data type = all info on the data is included in the type: constants, variables, access
                 methods (procedures and functions). The variables are usually hidden form the user; access
                 to them is through the access methods only.
              •  Inheritance = type extension.
              •  The idea behind object-Oriented Programming, (OOP) is that a computer program may be
                 seen as comprising a collection of individual units or objects that act on each other.
              •  Each object is capable of receiving messages, processing data and sending messages to other
                 objects.
              •  OOP is claimed to promote greater flexibility and maintainability in programming.
              •  Some languages like C++, Java, smalltalk etc support this model.




                                             LOVELY PROFESSIONAL UNIVERSITY                                    73
   73   74   75   76   77   78   79   80   81   82   83