Software Crisis:

Developments in software technology continue to be dynamic. New tools and techniques are announced in quick succession. This has forced the software industry and software engineers to continuously look for new approaches to software design and development, which is becoming more and more critical in view of the increasing complexity of software systems as well as the highly competitive nature of the industry. The following issues needed to be resolved to overcome this crisis:

  • How to represent real-life entities of problems in system-design?
  • How to design systems with open interfaces?
  • How to ensure reusability and extensibility of modules?
  • How to develop modules that are tolerant to any change in future?
  • How to improve software productivity and decrease software cost?
  • How to manage time schedules?
  • How to improve the quality of software?
  • How to industrialize the software development process?

  • Problems occur when software products are either not finished, not used or are delivered with errors. Changes in user requirements have always been a major problem. The reports on software implementation suggest that software products should be evaluated carefully for their quality before they are delivered and implemented. Some of the quality issues that must be considered for critical evaluation are:

  • Correctness
  • Maintainability
  • Reusability
  • Openness and interpretability
  • Portability
  • Security
  • Integrity
  • User friendliness
  • Software Evolution

    Ernest Tello, a well-known writer in the field of artificial intelligence, compares the evolution of software technology to the growth of a tree. Like a tree, the software evolution has had distinct phases or “layers” of growth. These layers were built up by one over the last four decades as shown in figure 1, with each layer representing an improvement over the previous one. However, the analogy fails if we consider life of these layers. In software systems, each of the layers continues to be functional, whereas in the case of trees, only the uppermost layer is functional.

    Objected-oriented programming (OOP) in a new way of approaching the job of programming. Approaching to programming have changed dramatically since the invention of the computer, primarily to accommodate the increasing complexity of program. Assembly language was invented so that a program could deal with longer, increasingly complex programs using symbolic representations of the machine instructions. As programs continued to grow high level language were introduced that gave the programmer more tools with which to handle complexity. The first widespread language was FORTRAN. Although FORTRAN was a very impressive first step, it is hardly a language that encourages clear, easy-to–understandable program.

    The 1960 gave birth to structured programming. This in the method encouraged by languages such as C and Pascal. The are of structured languages made it possible to write moderately complex programs fairly easily. However, even using structured programming methods a project becomes uncontrollable once it reaches a certain size i.e. once its complexity excess that which a program can mange.

    At each milestone in the development of programming methods were created to allow the programmer to deal with greater complexity. Each step of the way, the new approach tools the best elements of the previous method and moved forward. Today, many projects are near at longer works. To solve this problem, object oriented programming was invented.

    Before going into details about object oriented programming have a look at procedure oriented programming. In the procedure-oriented approach, the problem is viewed as a sequence of things to be done, such as reading, calculating and printing. A number of functions are written to accomplish these tasks. The primary focus is on functions. A typical program structure for procedural programming is shown in Fig 2. The technique of hierarchical decomposition has been used to specify the tasks to be completed in order to solve a problem.

    Procedure-oriented programming basically consists of writing a list of instructions for the computer to follow, and organizing these instructions into groups known as functions. We normally use a flowchart to organize these actions and represent the flow of control from one action to another.

    While we concentrate on the development of functions, very little attention is given to the data that are being used be various functions. What happens to data? How they are affected by the functions that work on them?

    In multi-function program, many important data items are places as global so that they may be accessed by all the functions. Each function may have its own local data. Fig 3 shows the relationship of data and functions in a procedure

    Object-oriented programming paradigm

    The major motivating factor in the invention of object-oriented approach is to salvage 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 accidental modification from outside functions. OOP allows us to decompose a problem into a number of entities called objects and then builds data and functions around these entities. The organization of data and functions in object-oriented programs is shown here.

    The data of an object can access the functions of other objects.

    However, functions of one object can access the functions of other objects.

  • Some of the striking features of object-oriented programming 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.
  • Functions 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 functions.
  • New data and functions can be easily added whenever necessary.
  • Follows bottom-up approach in program design.

  • Object-oriented programming is the most recent concept among programming paradigms is means different things to different people. It is therefore important to have a working definite object-oriented programming before we proceed further. Our definition of object-oriented programming is as follows “Object-oriented programming is an approach that provides a way of molding 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.”

    That is, an object is considered to be a partitioned area of computer memory that stores data and set of operations that can access that data. Since the memory partitions are independent, the objects are used in a variety of different programs without modifications.

    What is object oriented programming?

    Object oriented programming (OOP) have taken the best ideas of structured programming and combined them with several powerful new concept that encourage you the approach the task of programming in a new way. In general when programming in an object oriented fashion you break down a problem into subgroup of related parts that take into account both code and data related to each group. Also, you organize this subgroup into a hierarchical for all intents and purpose, an object in a variable of area-defined type. It may seem strong at first to think of an object, which lines both code and data on variable. However, in object oriented programming, this is precisely the case. When you define an object, you are implicitly creating a new data type.

    Basic concepts of object-oriented programming

    ‘Object-Oriented’ remains a term, which is interpreted differently by different people. It is therefore necessary to understand some of the concepts used extensively in object-oriented programming. We shall discuss in this section the following general concepts:

      1. Objects
      2. Classes
      3. Data abstraction
      4. Inheritance
      5. Dynamic binding
      6. Data encapsulation
      7. Polymorphism
      8. Message passing

    1.Objects

    Objects are the basic run-time entities in an object-oriented system. They may represent a person, i. e. a bank account, a table of data or any item that the program must handle. They may also resent user-defined data such as vectors, time and lists. Programming problem is analyzed in terms of objects and the nature of communication between them. Program objects should be chosen such that they match closely with the real-world objects. As pointed out earlier, objects take up space in the memory and have an associated address like a record in Pascal, or a structure in C.

    When a program is executed, the objects interact by sending messages to one another. For example if “customer” and “account.” are two objects in a program, then the customer object may send a message to the account object requesting for the bank balance. Each object contains data and code to manipulate the data. Objects can interact without having to know details of each other’s data or code. It is sufficient to know the type of message accepted and the type of response returned by the objects. Although different authors represent them differently,

    2.Classes

    We just mentioned that objects contain data and code to manipulate that data. The entire set of data and code of an object can be made a user-defined data type with the help of a class. In fact, objects are variables of type class. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they created. A class is thus a collection of objects of similar type. For example, mango, apple and orange are members of the class fruit. Classes are user-defined data types and behave like the built-in types of a programming language. For example, the syntax used to create an object is no different than the syntax used to create an integer object in C. If fruit has been defined as a class, then the statement fruit mango; will create an object mango belonging to the class fruit.

    3.Data abstraction

    The wrapping up of data and functions 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 functions which are wrapped in the class can access it. These functions 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‘.

    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 functions to operate on these attributes. They encapsulate al1 the essential properties of the objects that are to be created. Since the classes use the concept of data abstraction, they are known as Abstract Data Types (ADT).

    6.Encapsulation

    Encapsulation in the mechanism that binds together code and data and that leaps both safe from outside interference or misure. It also allows the creation of an object. More simply, an object in a logical entity that encapsulate both data and the code that manipulators that data.

    Within an object, some of the code and/ or data may be private to the objected and in accessible to anything outside the object. In this way and object provides a significant level of protection against some other unrelated part of the program accidentally modifying or incorrectly using the private parts of the object.

    4.Inheritance

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

    In OOP, 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. 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 introduce any undesirable side effects into the rest of the classes.

    Note that each sub-class defines only those features that are unique to it. Without the use of classification, each class would have to explicitly include all of its features.

    7.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.

    The picture below illustrates at 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 operations may be accessed in the same manner even through specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance.

    Object oriented programming languages support polymorphism, which in characterized by the phase “on interface multiple method”. In simple terms, polymorphism in an attribute that allows one interface to be used with a general class of actions. Polymorphism helps in reducing complexity by allowing the same interface to specify a general class of action. It is compiler’s job to select the “specify action” on it applies to each situation. The programmers don’t need to make this selection manually operator, overloading, function, overloading and overlooking example of polymorphism structure. Finally you translate these subgroups self-contained units called object.

    In a multi-function program, many important data items are placed as global so that they may be accessed by all the functions. Each function-may have its own local data. Global data are more vulnerable to an inadvertent change by a function. In a large program it is very difficult to identify what data is used by which function. In case we need to revise an external data structure, we should also revise all functions that access the data. This provides an opportunity for bugs to creep in.

    Another serious drawback with the procedural approach is that it does not model real world problems very well. This is because functions are action-oriented and do not really correspond to the elements of the problem.

    Some characteristics exhibited by procedure-oriented programming are:

  • Emphasis is on doing things (algorithms).
  • Large programs are divided into smaller programs known as functions.
  • Most of the functions share global data.
  • Data move openly around the system from function to function. Functions transforms data from one form to another

  • Employs top-down approach in program design.

    5.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 known until the time of the call at run-time. It is associated with polymorphism and inheritance. A function call associated with a polymorphic reference depends on the dynamic type of that reference.

    Consider the procedure “draw” in Fig. 6. 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 be called.

    8.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 behavior.
      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. 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 function (procedure) in the receiving object that generates the desired result. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.

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

    Benefits of OOP

    OOP offers several benefits to both the program designer and the user. Object-orientation contribution 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:

      1. Through inheritance, we can eliminate redundant code and extend the use of existing classes.
      2. 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.
      3. The principle of data hiding helps the programmer to build secure programs that cannot be invaded by code in other parts of the program.
      4. It is possible to have multiple instances of an object to co-exist without any interference.
      5. It is possible to map objects in the problem domain to those objects in the program.
      6. It is easy to partition the work in a project based on objects.
      7. The data-centered design approach enables us to capture more details of a model in implementable form.
      8. Object-oriented systems can be easily upgraded from small to large systems.
      9. Message passing techniques for communication between objects makes the interface descriptions with external systems much simpler.
      10. Software complexity can be easily managed.

    While it is possible to incorporate all these features in an object-oriented system, their importance 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 get some of the benefits stated above. For instance, object 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.

    Developing software that is easy to use makes it hard to build. It is hoped that the object-oriented programming tools would help manage this problem.

    Object-oriented languages

    Object-oriented programming is not the right of any particular language. Like structured programming, OOP concepts can be implemented using languages such as C and Pascal. However, programming becomes clumsy and may generate confusion when the programs grow large. A language that is specially designed to support the OOP concepts makes it easier to implement them.

    The languages should support several of the OOP concepts to claim that they are object-oriented. Depending upon the features they support, they can be classified into the following two categories:

      1. Object-based programming languages
      2. Object-oriented programming languages

    Object-based programming is the style of programming that primarily supports encapsulation and object identity.

    Major features that are required for object-based programming are:

  • Data encapsulation
  • Data hiding and access mechanisms
  • Automatic initialization and clear-up of objects
  • Operator overloading

  • Languages that support programming with objects are said to be object-based programming languages. They do not support inheritance and dynamic binding.

    Ada is a typical object-based programming language.

    Object-oriented programming incorporates all of object-based programming features along with two additional features, namely, inheritance and dynamic binding.

    Application of OOP

    The Promising areas for application of oops include:

      1. Real-time systems
      2. Simulation and modeling
      3. Object-oriented databases
      4. Hypertext, hypermedia and expertext
      5. AI and expert systems
      6. Neural networks and parallel programming
      7. Decision support and office automation systems
      8. CIM/CAM/CAD systems

    Tags: , , , ,

    2 Responses to “Object-Oriented Programming”

    1. Great article. Illustrated explanation really helps to understand the concept well.

      Thank you,

    2. Thanks for good stuff

    Leave a Reply

    You must be logged in to post a comment.