I went looking everywhere for a section of code that would do the following:
Number to Mexican Pesos (Spanish)
The most important aspect of OOP is …
Recently in school we were asked a simple question. Of all the aspects of object oriented development what to you is the most important. The following is my reply to that.
I would say the single largest advantage that object oriented development brings to the table is abstraction. We've alluded to abstraction here and there in the class but I don't think we've come out and thrown down the gauntlet and said "yes here it is." Abstraction to me in terms of an object oriented model is the ability to define a theoretical system without writing actual code. We have abstract base classes and interfaces which provide this crucial functionality and the abstraction principle is at work all over Java especially in the frameworks like Swing [or Hibernate].
Why would I think this is important over any other aspect of object oriented programming? Because I think its used more than any other aspect and in reality incorporates it. Abstraction for example could not exist without interfaces, inheritance, and polymorphism. The idea that I can just define an ILogger interface that logging components of my application implement is largely beneficial especially when trying to write a loosely coupled highly extensible application. What if for example I wanted my application to support 3 types of loggers such as a ConsoleLogger, DatabaseLogger, and an XmlLogger all which implement ILogger. I could theoretically build an object factory that given some input or system heuristic return one of these aforementioned loggers and my system can work without change in any code other than the code that serves up the object that implements ILogger.
To me this is crucial for building large enterprise applications of which object oriented development is a key player. The more we learn and implement levels of abstraction in our objects the better. Of course there is always "too much abstraction" and its something like inheritance is learned with time but in all I believe it is a major aspect of OOP that every developer should learn and embrace.
I was wondering if I was going to be nailed in some way because I used something not even discussed in the class, however this was my professor’s reply
Excellent! This post needs to be saved. Realizing what abstraction is and the strength of it is the equivalent of finding the holy grail. If you see this, working with interfaces and providing concrete classes that implement these interfaces in a plug and play manner becomes automatic. One example, the VERY popular Java framework called Spring is built on this principle.
Its nice to know that I’m not the only one that feels abstraction is the end all be all of object oriented development in either Java, C#, or any other Object Oriented Language. I seriously feel we push things in OOP development that need not be learned initially and don’t take a more direct approach on proper software design. To me abstraction should be taught and we use polymorphism and inheritance/interfaces to accomplish the task.