Showing posts with label Fundamentals of Object- Oriented Programming. Show all posts
Showing posts with label Fundamentals of Object- Oriented Programming. Show all posts

Saturday, 21 April 2012

OOP Application

OOP :

OOP is one of the programming buzzwords today. There appears to be a great deal of excitement and interest among software engineers in using 00P. Applications of 00P are beginning to gain importance in many areas. The most popular application of object-oriented programming, up to now, has been in the area of user interface design such as windows. There are hundreds of windowing systems developed using 00P techniques.
Real-business systems are often much more complex and ,ontain many more objects with complicated attributes and methods. 00P is useful in this type of applications because it can simplify a complex problem. The promising areas for application of 00P includes:
·      Real-time systems
·      Simulation and modelling
·      Object-oriented databases
·      Hypertext, hypermedia and expertext
·      Al and expert systems
·      Neural networks and parallel programming
·      Decision support and office automation systems
·      CIM/CAD/CAD system
It is believed that the richness of OOP environment will enable the software industry to Improve not only the quality of software systems but also its productivity. Object-oriented
Technology is certainly going to change the way software engineers will think, analyze design and implement system in the future .

Sunday, 15 April 2012

Benefits Of OOP

OOP :

OOP offers several benefits to both the program designer and the user. Object-orientation contributes to the solution of many problems associated with the development and quality of software products. The new technology promises greater programmer productivity, better quality of software and lesser maintenance cost. The principal advantages are:
Through inheritance, we can eliminate redundant code and extend the use of existing classes.
We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. This leads to saving of development time and higher productivity.
The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
It is possible to have multiple objects to coexist without any interference.
It is possible to map objects in the problem domain to those objects in the program.
It is easy to partition the work in a project based on objects.
The data-centered design approach enables us to capture more details of a model in an implementable form.
Object-oriented systems can be easily upgraded from small to large systems.
Message passing techniques for communication between objects make the interface descriptions with external systems much simpler.
Software complexity can be easily managed.
While it is possible to incorporate all these features in an object-oriented system, their importance depends on the type of the project and the preference of the programmer. There are a number of issues that need to be tackled to reap some of the benefits stated above. For instance, class libraries must be available for reuse. The technology is still developing and current products may be superseded quickly. Strict controls and protocols need to be developed if reuse is not to be compromised.
A software that is easy to use is hard to build. It is hoped that the object-oriented programming languages like C+ + and Java would help manage this problem.



Wednesday, 11 April 2012

Message Communication

Java - Message Communication :

An object-oriented program consists of a set of objects that communicate with each other. The process of programming in an object-oriented language, therefore, involves the following basic steps:
1. Creating classes that define objects and their behaviour.
2. Creating objects from class definitions.
3. Establishing communication among objects.
Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another as shown in Fig. . The concept of message passing makes it easier to talk about building systems that directly model or simulate their real-world counterparts.



A message for an object is a request for execution of a procedure. and therefore will invoke a method (procedure) in the receiving object that generates the desired result, as shown in Fig.



Message passing involves specifying the name of the object. the name of the method (message) and the information to be sent. For example. consider the statement
Employee.salary(name);


Here. Employee is the object. salary is the message and name is the parameter that contains information.




Objects have a life cycle. They can be created and destroyed. Communication with an object is feasible as long as it is alive. 



Friday, 6 April 2012

Dynamic Binding

Java - Dynamic Binding :

Binding refers to the linking of a procedure call to the code to be executed in response to the
call. Dynamic binding means that the code associated with a given procedure call is not Know until the time of the call at runtime. It is associated with polymorphism and inheritance. A procedure call associated with a polymorphic reference depends on the dynamic type of the reference.


Consider the procedure "draw" in Fig. By inheritance, every Object will have this procedure. Its algorithm is, however, unique to each object and so the draw procedure will be redefined in each class that defines the object. At run-time, the code matching the object under current reference will he called.


Thursday, 29 March 2012

Polymorphism

Polymorphism :

Polymorphism is another important OOP concept. Polymorphism means the ability to take more than one form. For example, an operation may exhibit different behavior in different instances. The behavior depends upon the types of data used in the operation. For example consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings, then the operation would produce a third string by Concatenation. Figure illustrates that a single function name can be used to handle different number and different types of arguments. This is something similar to a particular word having several different meanings depending on the context.


Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. This means that a general class of operation may be accessed in the same manner even though specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance.

Thursday, 22 March 2012

Inheritance

Inheritance:

Inheritance is the process by which objects of one class acquire the properties of objects of another class. Inheritance supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird, which is again a part of the class bird. As illustrated in Fig. 1.4, the principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived.


Property Inheritance 

 In 00P, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes. Thus the real appeal and power of the inheritance mechanism is that it allows the Programmer to reuse a class that is almost, but not exactly, what he wants, and to tailor the class in such a way that it does not in introduce any undesirable side effects into the rest of the classes.In Java, the derived class is known as 'subclass'. Note that each subclass defines only those features that are unique to it. without the use of inheritance. each class Would have to explicitly include all of its features.

Thursday, 15 March 2012

Data Abstraction and Encapsulation

Data Abstraction:

The wrapping up of data and methods into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to_the outside world and only those methods, which are wrapped in the class, can access it. These methods provide the interface between the object's data and the program. This insulation of the data from direct access by the program is called data hiding. Encapsulation makes it possible tor objects to be treated like 'black boxes', each performing a specific task without any concern for internal implementation

 



Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and methods that operate on these attributes. They encapsulate all the essential properties of the objects that are to be created.

Sunday, 11 March 2012

OBJECT ORIENTED PARADIGM

Object Oriented:

The major objective of object-oriented approach is to eliminate some of the flaws encountered in the procedural approach. OOP treats data as a critical element in the program development and does not allow it to flow freely around the system. It ties data more closely to the functions that operate on it and protects it from unintentional modification by other functions. 00P allows us to decompose a problem into a number of entities called Objects and then build data and functions (known as methods in Java) around these entities. The combination of data and methods make up an object 



The data of an object can be accessed only by the methods associated with that object,
However, methods of one object can access the methods of other objects. Some of the features of object-oriented paradigm are:

• Emphasis is on data rather than procedure.
• Programs are divided into what are known as Objects.
• Data structures are designed such that they characterize the objects.
• Methods that operate on the data of an object are tied together in the data structure.
• Data is hidden and cannot be accessed by external functions.
• Objects may communicate with each other through methods.
• New data and methods can be easily added whenever necessary.

• Follows botrom-up approach in Program design.

Object-Oriented paradigm is the most recent concept among programming paradigms and
still it means differnt things to diffrent people. It's thefore important to have
a working definition of Object-Oriented programming before we proceed further.

Our definition of Object-Oriented paradigm is:
Object-oriented programming is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as templates for creating copies of such modules on demand. This means that an object is considered to be a partitioned area of computer memory that store data and set of operations that can access that data. Since the memory partition are Independent, the object can be used in a variety of  different programs without modifications.

Saturday, 10 March 2012

Fundamentals of Object- Oriented Programming

INTRODUCTION

One characteristic that is constant in the software industry today is the "change". Change is one of the most critical aspects of software development and management. New tools and new approaches are announced almost every day. The impact of these developments is often very extensive and raises a number of issues that must be addressed by the software engineers. Most important among them are maintainability, reusability, portability, security, integrity, and user friendliness of software products.

To build today's complex software it is just not enough to put together a sequence of programming statements and sets of procedures and modules. We need to use sound construction techniques and program structures that are easy to comprehend, implement and modify in a wide variety of situations.

Since the invention of the computer, many programming approaches have been tried. These include techniques such as modular programming, top-down programming, bottom-up programming and structured programming. The primary motivation in each case has been the concern to handle the increasing complexity of programs that are reliable and maintainable. These techniques became popular among programmers over the last two decades.

With the advent of languages such as C, structured programming became very popular and was the paradigm of the 1980s. Structured programming proved to be a powerful tool that enabled programmers to write moderately complex programs fairly easily. However, as the programs grew larger, even the structured approach failed to show the desired results in terms of bug-free, easy-to-maintain, and reusable programs.

Object-Oriented Programming (OOP) is an approach to program organization and development, which attempts to eliminate some of the pitfalls of conventional programming methods by incorporating the best of structured programming features with several new concepts. It is a new way of organizing and developing programs and has nothing to do with any particular language. However, not all languages are suitable to implement the OOP concepts easily. Languages that support OOP features include Smalltalk, Objective C, C + + , Ada and Object Pascal. C+ +, an extension of C language, is the most popular 00P language today C++ is basically a procedural language with object-oriented extension. The latest one added to this list is Java, a pure object-oriented language.