OO Programming  «Prev 

Difference between Procedural and Object Oriented Notations

Method notation for Procedural Programs

Procedural design approach:
The traditional design approach is in use in many software development projects at the present time. This traditional design technique is based on the data flow-oriented design approach. It consists of two important activities;
  1. first structured analysis of the requirements specification is carried out where the detailed structure of the problem is examined.
  2. This is followed by a structured design step where the results of structured analysis are transformed into the software design.

Naming Conventions for Procedural Methods

First, you must understand what a function is, and then you can proceed to find out how it can be most effectively used in the development of programs. Go back to the very first program that you wrote , which displayed the phrase "Programming in C". at the terminal:

First version using builtin prinf

#include <stdio.h>
int main (void)
{
 printf ("Programming in C.\n");
 return 0;
}

Second version with user-defined printMessage

Here is a function called printMessage that does the same thing:
void printMessage (void)
{
 printf ("Programming in C.\n");
}

The differences between printMessage and the function main from the first version is in the first and last line. The first line of a function definition tells the compiler (in order from left to right) four things about the function:
  1. Who can call it
  2. The type of value it returns
  3. Its name
  4. The arguments it takes

Naming conventions for object oriented methods

In this course, function and method names that are inline with the text are identified by putting empty parentheses after them.

			
getData()

Internal capitals used for methods

This course adopts the common convention of using internal capitals, such as
							 
convertImage()

, in method and variable names. This convention is not written in stone, but it does make code easier to read and identifiers in the text more obvious.
Object-Oriented Analysis

Advantages of Object-Oriented Programming

  1. Improved software-development productivity: Object-oriented programming is modular, as it provides separation of duties in object-based program development. It is also extensible, as objects can be extended to include new attributes and behaviors. Objects can also be reused within an across applications. Because of these three factors 1)modularity, 2) extensibility, and 3) reusability object-oriented programming provides improved software-development productivity over traditional procedure-based programming techniques.
  2. Improved software maintainability: For the reasons mentioned above, objectoriented software is also easier to maintain. Since the design is modular, part of the system can be updated in case of issues without a need to make large-scale changes.
  3. Faster development: Reuse enables faster development. Object-oriented programming languages come with rich libraries of objects, and code developed during projects is also reusable in future projects.
  4. Lower cost of development: The reuse of software also lowers the cost of development. Typically, more effort is put into the object-oriented analysis and design, which lowers the overall cost of development.
  5. Higher-quality software: Faster development of software and lower cost of development allows more time and resources to be used in the verification of the software. Although quality is dependent upon the experience of the teams, objectoriented programming tends to result in higher-quality software.

Disadvantages of object-oriented Programming:

  1. Steep learning curve: The thought process involved in object-oriented programming may not be natural for some people, and it can take time to get used to it. It is complex to create programs based on interaction of objects. Some of the key programming techniques, such as inheritance and polymorphism, can be challenging to comprehend initially.
  2. Larger program size: Object-oriented programs typically involve more lines of code than procedural programs.
  3. Slower programs: Object-oriented programs are typically slower than procedurebased programs, as they typically require more instructions to be executed.
  4. Not suitable for all types of problems: There are problems that lend themselves well to functional-programming style, logic-programming style, or procedure-based programming style, and applying object-oriented programming in those situations will not result in efficient programs