Java Reference
In-Depth Information
Dependency Injection (CDI) introduced a new container with great l exible features. With the help
of CDI, you can implement many patterns, such as observer and decorator, with little hassle.
When I was given the responsibility to work on the Eclipse Libra project, I had
limited knowledge of Eclipse plug‐ins. After reading the only available topic, Eclipse:
Building Commercial‐Quality Plug‐Ins , by Dan Rubel and Eric Clayberg (Addison-
Wesley, 2008), I decided to jump into the existing codebase in the Eclipse repository.
Very soon, I was amazed with the overall architecture of Eclipse and how the
plug‐ins were built. Design patterns such as adapter, decorator, strategy, memento,
and many others were everywhere, used in the right context, and they provided an
efi cient and clear implementation.
Eclipse code repository is one of the best live sources for good implementation of
design patterns in a real‐world project that millions of developers use.
The i rst training I received on design patterns simply blew my mind. The following month I spent
all my time reading Head First Design Patterns 7 and next, of course, the GoF book. I was armed
with the knowledge of patterns and was ready to use them. As time passed by, I realized I didn't
even need to use inheritance and could build all models and object hierarchies with decorators.
I even created a set of utility classes consisting of several singletons, some message busses for
observers, and some generic decorator and observers that I always included when I created a new
I was always proud to show my code and let others see how great and sophisticated a programmer
I was. It did not take long to realize my way of using design patterns was just over‐complicating my
code and adding too many layers during run time. Even simplifying the existing code resulted in
better performance. Complex and sophisticated code does not make you a better programmer, and
it doesn't make the code optimized and maintainable. Engineering is the art of using the right tool at
the right place and building a system efi ciently.
I was once asked to implement a data structure to handle transactional database
operations for a job I was applying for. I was to complete the code at home and
send it back to the company for review via e-mail. The system would be able to add
new values and perform a save operation once a commit was done. Also, the system
would be able to go back to a previous state when a rollback was executed. Little
Search WWH ::

Custom Search