Tuesday, December 8, 2015

Re-looking at Design Patterns

     A design pattern identifies a common software development problem and provides a strategy
for dealing with it. It is just like a cooking recipe, Following a cooking recipe thoroughly does not serve food , you have to decide on quantities, number of people to serve and many other factors. Similarly, a design pattern does not provide ready made solution, you need to customize according to your own project specific requirements
     Design patterns are insurance policies for software development. Insurance policies work by trading a little cost now to avoid the possibility of a lot of cost later. The premium you pay to insure a car against theft, for example, costs a few percent of the value of the car, but when the car is stolen,  your overall costs are minimized. You still have to go through the inconvenience of having your car stolen, but at least you don’t have to bear the financial loss as well.
      In software development, design patterns are insurance against the time taken to solve problems. The premium is the time it takes to add extra flexibility to your code now, and the payout is avoiding a painful and protracted rewrite to change the way the application works later. Like real insurance policies, you may not benefit from paying the premium because the problem you anticipate might never happen, but software development rarely goes smoothly and problems often arise, so that additional flexibility is usually a good investment.

Courtesy :Adam Freeman (Pro Design Patterns in Swift)