Here are the cryptic definitions and what they mean in your code?
Abstraction
A concept or idea not associated with any specific instance. It is an emphasis on the idea, qualities and properties rather than the particulars (a suppression of detail), It is simplifying complex reality by modeling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem.
Abstraction can be implemented via Abstract Class/Interface. In both cases, abstract behavior needs to be implemented by the extending/implementing classes. However the catch is we shouldn’t use the implementing class name anywhere in the code except in creation. If the extending/implementing class used as parameter to methods, variable in other classes then note that you are not abstracting it. I will be posting various examples in later, please pay attention to this.
Abstract class x
{
method();
}
Interface x
{
method();
}
Class Y: (extends/implements) x
{
Method()
{
Do something;
}
}
Do not refer Y anywhere in the code except while creation.
Always
X x = new Y();
x.method();
If there is code like below then Y is not abstracted.
Class Z
{
Y y;
Or
OtherMethod(Y y)
Or
Y OtherMethod()
}
Let us continue ...
Showing posts with label Encapsulation. Show all posts
Showing posts with label Encapsulation. Show all posts
Tuesday, 11 January 2011
Understanding software design Vs. Designing software applications
The design principles are least applied by most of the software professionals. The series of post on software design basics are targeted towards bridging the gap between understanding software design and designing software applications. It covers the following aspects
• Basics terminology of software design
• Basics of software design
• Design patterns
• Sample applications using these patterns
• Basics terminology of software design
• Basics of software design
• Design patterns
• Sample applications using these patterns
Subscribe to:
Posts (Atom)