Wednesday, 6 December 2017

React makes OCP so easy it's a joke

Composing components in React means that following the Open Closed Principle (the O in SOLID) is so easy that it's laughable.

By composing, or decomposing, React components together new functionality can be added and functionality can be removed without making any changes to the underlying components. Want to make sure that you dont show a profile page unless someone has been logged in? Wrap your profile page in a
component, that checks for the user and redirects to login if they have not yet logged in.

As a bonus when you split and compose your functionality like this you end up with smaller components, that do less. So by following the Open Closed Principle in this way you get the Single Responsibility Principle for free.

Clean Code keeps on delivering.

Monday, 4 December 2017

Why are you estimating?

In a previous job I had a quote stuck up behind my desk that I would point to when a manager asked me for an estimate.  I cant remember the exact wording but the gist of it was something like:
Before asking for an estimate first ask your self what decisions the estimate will be informing. 
I loved this quote because it points at one of the biggest problems that I think the software development industry has with estimates, and one of the reasons that they are, so often, so wrong.

Too often we estimate work in a vacuum without adequate knowledge as to why the estimate is being asked for, or how it's going to be used. 

There are many different, and valid reasons to estimate work, and different situations call for different techniques. For some of these cases the trivariate estimate method that I suggested in a previous blog is a great answer that will provide low level detail about the estimate and allow good decisions to be made, for other cases it is a massive waste of time. Similar ideas can be drawn for the story points, t-shirt sizes or the no estimates movement.

Each type of estimate is suited to a situation, and you can never know what is needed unless you can understand why you're being asked for the estimate and what decisions that estimate is informing.