Thursday, October 14, 2010

About OOP...

· Programming paradigms:
1. Monolithic Programming – BASIC and Assembly. (single large block of code with global data )
2. Procedural Programming – FORTRAN and COBOL.(all procedures will access global data)
3. Structured Programming – C, Pascal… (Code controls the data.)
4. Object Oriented Programming – Smalltalk, Java, C++, C#... (Data controls the code.)
· Programming styles and their importance.
1. Procedure-oriented - Algorithms.
2. Object-oriented – Classes and Objects.
3. Logic-oriented – Goals, often expressed in predicate calculus.
4. Rule-oriented – if-then-else statements.
5. Constraint -oriented – Invariant Relationship.
· Orthogonality is an important element of a programming language which makes the language to have only a few basic features, each of which is separately understandable.
· Class is the logical tool for implementation of an ADT.
· In OOP an object can be viewed in multiple views.
· Inheritance and Composition are the 2 power full features of OOP.
· Inheritance does early delegation and composition does late delegation of operations.
· With respect to delegation Composition is better than Inheritance.
· We can mimic the Inheritance via Composition by writing the delegating methods for the respective super classes with in the container class.
· Composition is also called as Containership.
· So we can include the un-supported Inheritance feature of Object-based paradigm with Composition.
· Binding refers to the tie-up of a procedure call to the address code to be executed in response to the call.
· 3 types of binding – Early (Static) binding, Deferred binding, Late (Dynamic) binding.
· Static binding – Known at compile time. Default in C++.
· Dynamic binding – Known at Run time. Default in Java, Done using Virtual functions in C++.
· Deferred binding – Intermediate of above 2. (Supported in GWT tool of Google).
· Class is an empty (or template of an) application and Objects are filled applications.
· In OOPs every method call is something like a client-server message driven communication.
· The method name defines the message (i.e. action to be performed) and the parameter specifies the information for that message or command.
· In OOPs, the correct method to execute an operation based on the name of the operation and the class of the object being operated.
· Communication between the objects can take place as long as they’re alive.
· Pure Object oriented languages are Smalltalk 80, Simula, and Eiffel.
· In Pure object oriented programming everything is stored in heap
· Java is not a pure object oriented as int,float etc are treated as primitive types.
· Object based languages are ADA etc…(abstraction,encapsulation,composition)
· One great divide in programming exists between Exploratory programming languages that aim at dynamism and run time flexibility, and Software engineering languages which have static typing and features that aid verifiability and/or efficiency. Smalltalk is best representative for former group and C++ belongs to latter group.
· Java = C++--++.
· But JavaTM is Awesome.
· Java was initially designed to address the problems of building software for small distributed systems to embed in consumer devices. As such it is designed for heterogeneous networks, multiple-host architectures and secures delivery.
· For OOP we need an environment and library supporting reusability.
· Reusability improves the productivity of the software.
· Reuse involves 3 steps: Retrieve the needed components, understand them and Use them.
· Though Inheritance is a good tool of reusability, it will create coupling between classes more and makes the software to be more complex in structure.
· Booch recommends that inheritance hierarchies be built as balanced lattices and that the maximum number of levels and width be limited to 7 +/- 2 classes.
· Reuse means – Reuse in data, Reuse in Architecture and Reuse in Design.
· ….<> …

2 comments:

  1. what does it mean by 'Java = C++--++ ' ?

    ReplyDelete
    Replies
    1. Removing dangerous things from C++ and adding constructs and design objectives to make simple and safe language.

      Delete