Question:
Object-Oriented design?
cvd4311
2008-12-11 07:29:32 UTC
How does object oriented design allows changes to be made in a class definition without affecting other classes in the application?

I do not know exactly how to answer this question. Can anyone get me started?
Five answers:
Fudge
2008-12-11 07:48:44 UTC
Interesting , OOD( Object-Oriented design) archives that by techniques such as information hiding,encapsulation , inheritance , and polymorphism .The most relevant to ur Q is the first (information hiding), which is basically hiding the internal implementation of the class within itself , and this is achieved by dividing the class's into two sections : a public and a private one. The class data should be private , and methods are generally public ( but there r exceptions ) .

Hiding the data ( making it private ) enables BUT providing methods to safely access it enables changes in one class without affecting other classes in application.Example, imagine u wrote a DrawingBrush class which has methods such as paint(), clear() , getColor(), setTransparency(), then u gave this class to ur fellow to use for another project and they use it in that.

Now after some months , u came to get a better implementation for the methods' algorithms ( clear(), paint(),etc) , and u want to give the new version of the class to ur fellow to use, then as long as u change the signature of these methods , u din't change the names and signature for ur methods, ur fellow can happily use the new class ; just because (1) u din't give them the data at first (2) u didn't change the signature for the methods in second time

..hope this help!
Germann A
2008-12-11 07:51:14 UTC
OO design (of the application) means that you have a number of objects working together.

Each of these objects has only limited access to (knowledge of internal structure or anything else about) other objects, all they can access are other objects' public methods...

So, if you have object A which defines public method myMethod() that returns a string with some info from the object A any other object in your application can use method A.myMethod() to get the required info, if at later stage you decide that you need to change WHAT is actually returned by the method you can do so as long as method's return type does NOT change and the rest of the apllication will be unaffected...
Jedi Danny
2008-12-11 07:44:01 UTC
The clue is in the name, Object Orientated Programming.



Rather than making one huge piece of code that tries to do everything, OOP breaks the whole system down into small chunks, or objects, that store an internal representation of what it should do.



I'll leave it to you to think of an example.



Oh and well done for wanting a hint to your homework rather than the answer. Thats how you learn rather than repeat. :)



Good luck
ashmi r
2008-12-11 07:43:25 UTC
Firstly u use class in object oriented concepts....

Second...By creating Objects, u can replace certain modules or reuse them in other classes..

Thus u don't end up in confusion...

Eg: I have a tv ,Say some of the classes are color,menu etc...

now i can replace the old color(black and white tv) class with new color(256 color tv)class....

This is different from traditional programming where u used top-down approach of programming..

Here u program from object level and finally joining all classes through their interface and get finished product..

Hence defect with one particular class can be found easily and corrected.
FARAZ
2017-04-02 06:55:33 UTC
its main topic of software design. its related by oop (object oriented programming).


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...