February 7, 2017

[HDGEM] A better approach to avoid using a switch or multi-conditional if-else-if is to use the Strategy pattern.

Converting switch or multi-conditional statements to Strategy pattern

Strategy pattern allows us to have a separate class for each case. We can then add new case more easily.

In addition, having smaller classes means that my unit testing becomes more focused on testing one particular situation.

Posted By Blogger to HDGEM at 2/07/2017 07:05:00 AM
Post a Comment

Featured Post

Updated Coupons / promo codes for Google Apps for Work / Business

To redeem: 1. Sign up for Google Apps   2. Go to your billing settings  3. Choose your payment plan  4. Enter your promo code ...