Javin Paul
Posts: 1090
Nickname: javinpaul
Registered: Jan, 2012
|
Javin Paul is Java Programmer working on Finance domain.
|
|
|
|
Decorator Design Pattern in Java - Real life Example
|
Posted: Jul 16, 2013 5:56 AM
|
|
|
This post originated from an RSS feed registered with Java Buzz
by Javin Paul.
|
Original Post: Decorator Design Pattern in Java - Real life Example
Feed Title: Java67
Feed URL: http://www.java67.com/feeds/posts/default?alt=rss
Feed Description: Java and technology tutorials, tips, questions for all programmers.
|
Latest Java Buzz Posts
Latest Java Buzz Posts by Javin Paul
Latest Posts From Java67
|
|
Decorator Pattern is one of the famous Gang of Four (GOF) structural
design pattern, which provides an alternative way of extending an object's functionality. It's
different than traditional way of adding new functionality into object using
Inheritance, since it's based on Composition
and provides additional functionality at runtime, as opposite to Inheritance, which
adds new functionalities at compile time. Decorator design pattern is
introduced by famous Gang of Four design pattern book, almost 2 decades ago. It's a time tested way of adding
new functionalities into object. In this Java design pattern tutorial, we will
learn Decorator design pattern by using it in a Java example. This is a best
way of learning design pattern, followed you try it yourself to apply in
similar scenarios. Decorator pattern is one of the popular design pattern along
with Factory method pattern and Singleton
Pattern, and you can see it's usage even in JDK itself. Couple of classes
from java.io package e.g. BufferedInputStream, LineNumberInputStream are good
example of Decorator design pattern in Java.
Read more »
Read: Decorator Design Pattern in Java - Real life Example
|
|