Monday, 27 July 2015

Bootstrap: Container vs Container-Fluid



Container creates a fixed-width container in the browser window, while container-fluid creates a full-width fluid container. The latter is styled to appear at the center of the screen, omitting extra space on both sides. [1]


[1] - Jump Start Bootstrap by Syed Fazle Rahman

Thursday, 23 July 2015

Improving Code Reuse



Hey guys,
I am having a web service that returns an array object containing another three array objects let's say description, service, details. For the time being I only need the description. I am thinking of which way is more effective especially in terms of SOLID principles as well the self evident Do Not Repeat Yourself. My first scenario is having a method e.g. getDescription whereby I only return the description part. 
However I am also thinking about future modifications. In case I need service next time what should I do?

I need to go and create another getter e.g. getService. Normally I will be unit testing the method as a good coding principle. More time, therefore more effort. Either case I will be calling this method regardless on the side of the factory or controller.
From my perspective to make things simpler, I prefer returning the object fully including the three array objects where on the consumption side (controller), I can then specify which object I will need.
$webService->description;
Later on if I need the service part, I simply add the following:
$webService->service.