300g of beef mince with a good fat content
Tomato sauce (not ketchup)
2 burger bun
In case you haven't worked out we're making a hamburger (well, 2 actually, a 300g patty would be a little excessive!) and here are my base ingredients. Now I have to construct my burger, go through the process of combining ingredients, cooking the patty, constructing the burger, making sure there is just the right amount of beetroot (we're making a proper Aussie burger after all) and eventually consuming it.
Now if I ever want to reproduce it I have to make sure that it's written down somewhere, a recipe or ‘documentation’ if you will. What if I want to share the load and have someone do some of the work with me? I better make sure that I have the process written down too. Say I walk away from the cooking part way through, I want to make sure someone can easily pick up from where I left off without having to scrap everything they've previously learnt or worse, throw out my attempt because it's too complex to follow.
Fast doesn't mean unhealthy
Let's take for example the
$http service in AngularJS. I've blogged before about the basics of AJAx and on the surface it's pretty simple, but it very quickly becomes complex. Take a look at what's needed to POST form data, you have to construct the
FormData object, set it's values, set the appropriate HTTP headers, etc. Then there's the response side, are you going to use promises or callbacks? How about content negotiation, parsing the response to the right type, etc.
Not so simple now is it?
I have all the raw ingredients
Over the last few years browsers have become more and more powerful with more and more features available natively, from
To go back to our hamburger analogy I could go out and get myself some chuck, grab my mincer (yes I do own a mincer) and create my own mince to start my patty. I have all the building blocks I need but really, am I going to mince my own meat ever time, probably not.
Now don't get me wrong, I'm a long-time advocate of Vanilla.js. I strongly believe that you should learn the fundamentals but that doesn't mean they are your only tool, the frameworks people build on top of these fundamentals are powerful and can save you a lot of development effort. jQuery is a great example of this, yes the DOM in today's browsers gives us the power to do everything you want from jQuery but there's things it does that simplify this for us. Take the even bubbling and filtering, jQuery makes it very easy to provide an event handler at a common root but filter on the source of said event. It's a thin wrapper over DOM events but it's highly convenient.
I'll make it my own way
To address the points in Chris's 2nd article, we should use micro frameworks where possible, single purpose libraries that do one thing and one thing well. I'll go out and grind my mince, add my spices and then it's the patty I'm after. I'll get my sauces and mix them up to the desired tomato-to-mustard ratio.
But now here's the problem, I have a one-of-a-kind burger that to know how it came together, how to recreate it, how to disassemble it, find what's missing and reassemble it, is making the enjoyment of my burger harder.
And this is where micro frameworks start to fall apart. You're building a SPA so you go and grab an AJAX library, a thin DOM library, some custom eventing (or pubsub) to make you application disconnected, add DI, templating, security, data state management, promises and so on. Congratulations you've created something that doesn't have a massive framework behind it, or does it? Have you traded AngularJS for your own equally as bloated combination of micro frameworks?
Then once you've completed your non framework application you have another problem, maintenance. This unique collection of micros only exists in its current configuration in a single application, yours. How do you find solutions to your problems? We no longer have the communities to contact, it's up to us to work out how to fix it ourselves (which isn't necessarily a bad thing, but knowledge sharing is powerful).
I like to cook (or at least I like the idea of cooking, the actuality might not really be what people want :P) but I also like my fried chicken.
Know how your food is made, what goes into your frameworks and how you can leverage years of chefs and cooks just like we leverage the development community.
An application built on a paleo diet is just as unhealthy as one built on fast food.
PS: Don't just eat fast food, that would be stupid.