Monday, July 29, 2013

NEPHP 2013: Don't Be STUPID, Grasp SOLID

This may be getting boring, but too bad... there are so many talks to see at Northeast PHP this year!

Anthony Ferrara is giving a talk this year titled 'Don't be STUPID, Grasp SOLID' (see http://northeastphp.org/talks/view/33/Don-t-Be-STUPID-Grasp-SOLID and https://joind.in/talk/view/8907).

This is another one of those talks that I think I need to concretely square away some issues I've been having with my code lately. When I first started writing code, I always had small, compact functions. However, somewhere between here and there I lost my way.

I started cramming random meaning into particular function parameters, for example. Depending on the combination of 46 different parameters, the function would do one of 2,500 things... just because it seemed right to use the same function name. This may be because of PHP's lack of function overloading, or it may not. Either way, I realise now how stupid it all was.

Elsewhere, my code started pulling in random static classes, using singletons from static function calls and the like... this is all bad news when you start realising the benefits of unit testing, for example, but in reality, and in my older age, I've realised it's just bad news no matter what.

So like I say: I've started to come back around to smaller functions and classes and already it's made a huge impact on the way I work. I can honestly say that changing that particular approach to my coding has probably saved me more time and given me more safety than any other 'tweak' I've done to my 'style' in the last 5 years. And now that I have a taste for it, I'm looking for more!

Other than the actual topic, I've heard some awesome things about Anthony himself, so it'll be great just to see him talk anyway.

Hopefully you will too!

No comments:

Post a Comment