Thursday, June 18, 2015

Wrap approaches when you are adding new features/ modifing the existing features in a legacy application

Wrap method:

Suppose we have Employee class which does pay the salary to employee  as below.
And all of sudden there is a change requirement to log employee information into the database/file
The same thing can be achieved in a bit different way without changing the pay method and
 introducing the new method as below

Wrap Class :  is nothing but decorator patterns.In this case, the same new requirement can be implemented as below.

1 comment: