Page 79 - DLIS108_INFORMATION_AND_COMMUNICATION_TECHNOLOGY_APPLICATIONS
P. 79

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


            Information and Communication Technology Applications




                                    •  Reference semantics = the object is represented by a pointer. When the user thinks he she
                   Notes              passed an object, the pointer is passed.
                                    •  Overloading: A pointer to a base type object may also point to a derived type object, since the
                                      later has (at least) all the fields of the former. So all actions on the base type can also be
                                      performed on all derived types.
                                    •  Dynamic binding: When an action is applied to what seems a base type, the system remem-
                                      bers that it was actually a derived type (run-time info) and applies the action as redefined for
                                      the derived type.
                                    •  Use inheritance for “is a special kind of” relation. Use inclusion for the “has a” relation.
                                    •  Multiple inheritances mean that something is both a special kind of A and a special kind of B.
                                      This is rare. Much of the need for multiple inheritances can be satisfied by generics.


                                 8.6.3 Functional Languages
                                    •  The program is a function from the input to the output.
                                    •  The same applies to all functions in the program → no side effects → the same input yields
                                      the’same output → it does not matter when exactly you calculate the results, as long as you
                                      have the input.
                                    •  Traditionally the special data structures for functional programming are lists; this makes poly-
                                      morphism easier.
                                    •  The other main data type is of course functions, which means that functions are first class
                                      data types. Functions can have functions as parameters and yield them as results; lists can
                                      contain functions.
                                    •  Polymorphism: types need not be fully determined but can have Prolog-like type variables in
                                      them.
                                    •  Currying: all functions are considered to have only one parameter and to yield a function
                                      with one parameter less. → Constants are functions with zero parameters. This allows partial
                                      parameterization and simplifies the formalism.
                                    •  Lazy evaluation: An argument is not evaluated until its value is needed. This avoids super-
                                      fluous work, prevents potential errors and is equivalent to top-down evaluation (substitute
                                      the function first, rather than substituting the arguments first.)
                                    •  Infinite lists: evaluate only as much as needed; this is made possible by lazy evaluation.
                                    •  I/O: consider them as infinite lists and evaluate/produce only the relevant part. This allows
                                      “I/O in languages without side effects”.
                                    •  This model is supported by languages such as.




                                             Haskell, Erlang. Ocaml. Scheme, LISP, ML which are used in industry and
                                             commercial applications and some domain specific functional programming
                                             languages include mathematical (symbolic math). R(statistics), J and K (Financial
                                             analysis). Spreadsheet : can also be viewed as functional programming languages.


                                 8.6.4 Logic Languages

                                    •  The domain is described as a set of condition, conclusion rules and a set of facts. The rules
                                      (and facts) may have logical variables in them. The actual “program” is a query asking for





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