Bad Developers Should NOT Use Frameworks

B

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).

Other useful articles

About the author

By Jamie

My Books