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;
- first structured analysis of the requirements specification is carried out where the detailed structure of the problem is examined.
- 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
int main (void)
printf ("Programming in C.\n");
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:
- Who can call it
- The type of value it returns
- Its name
- 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.
Internal capitals used for methods
This course adopts the common convention of using internal capitals
, such as
, 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.
Advantages of Object-Oriented Programming
- 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.
- 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.
- 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.
- 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.
- 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:
- 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.
- Larger program size: Object-oriented programs typically involve more lines of code than procedural programs.
- Slower programs: Object-oriented programs are typically slower than procedurebased programs, as they typically require more instructions to be executed.
- 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