Sunday, December 27, 2009

What are the benefits of OO Programming?

Cant find this anywhere in my notesWhat are the benefits of OO Programming?
Prime benefits I've seen during my career are 1) better hiding of designs/implementation, 2)better overall structure and leveraging from existing code and 3) easier to understand a design (assuming it is done well).





1) It allows development of code/application segments where the underlying implementation is hidden and thus the rest of the code is protected from internal design changes. Makes the code overall more stable and more maintainable.





2) With a properly constructed hierarchy it becomes much easier to design classes that leverage from existing code speeding up the design process. From the code that uses the objects, it can much easier, often w/o any change, take advantage of new derived classes.





3) It saves me from having to know the details of how an object is implemented. Back in the ';old'; c days you had to know how a lot was developed to properly take advantage of them an use them in the correct %26amp; most efficient manner. With a good OO design, like C#, I know longer worry about that and just the interfaces the objects expose.





Hope that helps.What are the benefits of OO Programming?
Reusable code blocks.





Encapsulation, which reduces complexity...





class Clock {


int seconds;


int minutes;


int hours;


...


}


the encapsulation allows me to reuse the variables: seconds, minutes, hours over and over again instead of naming 1,000 unique variables.

No comments:

Post a Comment