Bad Developers Should NOT Use Frameworks

Published on Jun 5, 2013 by Jamie Munro

The sad part about this article is that the people that actually need to read this wonít.† Why; because they simply donít care about what they do.† It really is the honest truth.† Nonetheless, I will courageously continue writing in hopes that the good developers will magically convey this message to the people who need to learn it!

When you consciously pick a framework, youíve made a decision, a decision that this existing code (black box as some call it) will help me accomplish what Iím trying to do better and faster than without it.

However, there is a catch!† As you learn from a young age, nothing is free and this includes using a framework.† It takes work and effort to learn how to use the framework.† Itís not some magic tool that you wave your wand at and magically the work is done.† It can be!† Believe me it certainly can be, but only after youíve spent the necessary time to understand and use the framework!




Since I started this blog back in 2009, Iíve written countless articles about great things that many frameworks can do for you.† Iíve also written a few about what happens when you donít use the things frameworks can do for you.† Those articles are typically derived directly from working with a bad developer!

Letís take a basic example Ė form validation.† Itís something everyone probably has done 1000s of times.† If I donít have a framework to do my validation, I expect to see a ton of if statements performing checks on each and every one of my form fields.† Inside that if statement, there is most likely some code that will specify the error message for display later.† I would also expect some simple logic now inside of my form to output an error message if one exists Ė ideally right above, below, or beside the field in question.

Letís now assume that we have 5 fields that require error checking.† From the if statements to check the fields, this is minimum 3 lines of code (with my { braces on new lines for readability) multiplied by 5 which equals 15 lines.† Then letís assume another 2-3 lines of code for displaying the error message (maybe moreÖ).† Immediately this is 30+ lines of code for error checking alone.† And of course this is most likely pure copy/pasta with variable changes Ė leaving lots of room for error!

Whereas; if I were using a framework, my error handling is typically done at the model level.† I would mark exactly which fields require validation.† In this scenario, itís on average 1 line of code per field Iím validating.† To ensure this validation works properly, rather than building a regular form with HTML, I would use the provided Helpers by the framework.† This means that it should be 5 lines of code compared to 30.

The sad part is, this is where bad developers start to make my head want to blow steam out of my ears like in cartoons.† For some reason it seems too daunting to use a form or HTML helper to construct a form because theyíve never done it before!† Lousy excuse for writing 2-3 times the code and more importantly have a mistake in it because itís not nearly as well tested as the framework.

And finally, here is the most important factor of why I think bad developers should not use frameworksÖ

 

If I am working on code that is ďusingĒ a framework, I will go nuts in wanting to fix every single spot that is not using it correctly knowing how much time and confidence this will give me in the future.

Whereas, and here comes the punch line, if I look at an ASP.NET project using Web Forms or a vanilla PHP project, I will immediately just assume the code is bad!

This of course is not meant to be read that good code cannot be written in this fashion!

Instead my immediate assumption that it is bad because good developers are probably going to leverage a framework to save them the monotonous time required to not use a framework Ė unless of course you are trying to pinch every ounce of performance out of the code!

</rant>

P.S. The ironic part to this post is I just realized I wrote a very similar, but slightly different post in 2009 - in fact it was my 7th ever post on the blog called Why Frameworks Are Better. †Since this time, I've learned a lot of new things, but I don't think my opinion changes that frameworks are still better (when used properly).

Tags: frameworks | Rants | rants

Related Posts

blog comments powered by Disqus