59 comments

[ 1.4 ms ] story [ 93.3 ms ] thread
> jQuery/Dojo/YUI are not a frameworks.

Oh.

They are libraries, but they are used so fundamentally, that replacing them in a existing app is a pain, so most of them impose the problems of frameworks too :\",
The pain of removing jquery is indeed a problem. So I can see the point from that angle. But the bigger point, about how much less assuming they are just by virtue of being included... that's the distinction I cared most about.
I too am confused by the claim that Dojo and YUI are not frameworks, but Backbone is.
Yeah, all three have Collections and Views.
The fact that Dojo and YUI can be used like a framework (so can jQuery, with jQuery UI, etc) is not the point. The point is that, at the point-of-inclusion, those 3 tools/libraries are far less intrusive to the architecture of your site than including Backbone/Angular/Ember.
Without Module Definition "re-use" in JavaScript is just hand-waving. It amounts to re-use of HTML, and nothing more.
I use a CSS framework for http://www.LiberWriter.com

My customers do not care about it at all, except for the fact that the site looks better than if I had done it from scratch. My users probably do not even have any idea what a CSS framework is.

...which "underscore"s the fact that you can make a great site prototype with frameworks (JS, CSS, etc). My claim was not that they have no use. But that you start with them, get a great site, then pull out the re-usable framework stuff and leave the customized stuff that makes your site/app so great.
Why would you want to remove the framework? This would just be a huge waste of effort for no gain, as the grandparent shared. A decent un-bloated framework would account most of the time to a half-assed image. Not worth the trouble.
It's not a prototype. It's a business that makes money.

Yeah, if it makes more money, some day, I might consider dedicating some of it to replacing the CSS framework. But it's really, really far down on my list of things to do. There are lots of improvements I could make to the UI without ditching the framework, for instance, that would add real value to my customers, and/or increase conversions.

You plug your code into a framework. You plug a library into your code.

I think this definition is a good starting point for thinking about the difference between a framework and a library.

No definition is perfect. I admit that. But I do think, as you say, it's a decent starting point, to reason about how intrusive/assuming (or not) a piece of code is when we build on it.
Because abstractions are slow. Abstractions are harder for new people to learn from scratch. Abstractions hide necessary details when bug-triaging. Abstractions hand-cuff you into a certain way of thinking about things, a certain way of doing things.

Agreed. For example, you should never use anything above assembly, and especially not high-level languages like C++, Haskell or JavaScript, which are filled with abstractions. Those are fine for prototyping, but for production you should switch to good ol' NASM, only making calls to libraries when appropriate.

Assembly!? Kids these days! I start with a fresh copy of the universe everyday for all my coding needs.
No, you're missing the point. Frameworks are abstractions the author doesn't like. Languages are abstractions the author is fine with so they aren't frameworks.
There's a really great metaphor for how to manage complexity in abstraction.

We're all familiar with spaghetti code--you know, functional flow that winds its way through the source files and ends up in a big tangle.

"Aha!" we say, "This is awful, let's fix it."

So, we build all these layers of abstraction, with the hope that we can swap out any layer at random and things will be fine. This is lasagna code, and ends up being a gooey mess whenever you try to change a layer--you can always add layers, mind you, but actually removing one in the middle can prove to be quite messy.

The fix is ravioli code: Little self-contained bits of code with small, well-defined boundaries and implementations well-isolated from the outside world only communicating through messages.

~

The author does make a valid point, though: debugging through lots of abstractions is kind of a pain in the neck, and depending on the app a bunch of custom concrete code can be a lot simpler to maintain.

That's the siren song, though...that code is much easier to deal with until it isn't and then you're screwed.

By the author's logic, once you're done with building your website, you should remove the browser from below your website.
What on earth are you talking about? That comparison is from the looney bin.
There is huge value in shared common knowledge, and the efficiency gains you get from using a well-tested, documented and production-hardened framework that has been improved by a hundred other people.

You are reinventing the wheel, slowing yourself down and making maintenance more difficult by creating everything from scratch everytime. I think that's common sense among developers.

I am not reinventing "from scratch" every time. I rewrite a bit of light glue code to weave together various bits I copy-n-paste in from previous successful projects. That's hardly "reinventing the wheel".
So the code you are copying-and-pasting from previous projects is your own framework or collection of components, you're just keeping it private.

That's exactly how everyone else develops (but using open-source libraries): use a module system and glue together things from previous successful projects (made by other people). Why your own private framework is better than what is out there is a whole different matter.

Did you read the post? I said basically that. The difference is, I don't hold my "framework" out as THE general reusable pattern that everyone else should use. It's also extremely disconnected (without the glue code) and really makes no hard assumptions or influences over how you use it.

And, btw, it's not private. Most of my code is on github. I just don't try to force it down others' throats.

(comment deleted)
Frameworks are different from a set of tools that allow you to accomplish a task.

Picking up bits and pieces from old code isn't a framework. Its a specific tool. Think of Backbone or Ember or Angular as a mechanic shop. Things work a very certain way. The copy and paste code from other sites is a hammer, or wrench. You don't have to use them a certain way, but when you have them, you can use how they are intended.

(comment deleted)
I use plenty of tools/libraries, some I've written (and OSS'd on github), some totally popular and widely used/tested.

What I don't use, nor do I try to force on others, is the best ways to glue these pieces together. I have my ideas of "best practices", but those ideas are highly adjustable per site/app, and also just my own opinions. No piece I bring into a project makes an intrusive assumption about how the rest of my code will work.

I love the assumptions that because I write any amount of glue code, the code I write must certainly be less tested and therefore less quality than that which shows up in a popular framework.

I'm sorry, I accidentally deleted instead of editing, reposted above.

That is a very reasonable assumption: code that is used by a dozen projects, with a few variations for each of them, is certainly less tested than code shared by a thousand different projects and developers using a standard API. It's not inherently flawed or bad, but a matter of numbers.

Also have in mind that frameworks vary wildy. Angular and Ember might be absurdly prescriptive, you have to do things a certain way, while Backbone and others are extremely flexible, merely a collection of useful patterns and tools.

---

Why do frameworks exist? They allow you to speed-up development, offer battle-hardened code, a consistent API, good documentation and proven design patterns, plus developers can make use of their previous experience with it. It's a matter of choice, and of course there are trade-offs, namely flexibility.

It's not about being "the standard", just providing useful tools. I bet you end up using a lot of the same components over and over, right? Package them up and call it the 'Getify Framework' and you're in the same spot.

I don't get why you feel that someone is 'forcing' you to do anything? You say that you write your own code because

    I already understood that (architecture) domain pretty well.
    I’ve done similar “single-page apps” dozens of times. I’m
    getting a little better each time I do it. I learn new lessons 
    about easier ways to mix the pieces together with each project.
Well, guess what? That's how Backbone, Angular, and all other frameworks came to be. From other developers that decided to share their solutions, and people adopted them because they liked it and it solved some of their problems, not because they were forced to (?).
I think the definition of Framework needs to be defined.

Everyone seems to think that packaging up a bunch of tools is a framework. I would contest that that is wrong.

A framework has certain policies and flows that must be followed to allow the program to work. If you bundle up a set of tools, then you have a toolbox.

A framework might have a set of tools, but it also has a methodology behind it. If you don't subscribe to that methodology, then that framework isn't for you.

I am saying this, coming from the background of not using frameworks because of the bloat and because most of my applications weren't that large. I have used backbone and several other backend frameworks (python and PHP type) and found that they are restricting.

For me, programming, coding, hacking, whatever you want to call it is about the freedom to be able to do whatever you want, how ever you want. Yes, I know there are best practices, and there are certain things you aren't supposed to do, but a framework forces you think in a certain pattern, to follow certain rules. Yes, you may be able to develop faster (if your application fits in the scope of the framework) but you have lost much of the freedom that code gives you.

I understand people using frameworks. I sit right next to someone who enjoys them very much. But for others (including myself), they are not the next greatest thing to sliced bread because maybe I don't want my bread sliced, but instead, I want it some other way.

The bits and pieces you take also work in a very certain way, Backbone is also just a small collection of them. You can in fact easily piece together a backbone-like framework from small components available on components.io or bower.

Unless it solves a specific problem you have, not using any framework will almost always mean more bugs, brittle code, a less consistent API, lots of documentation effort (or lack of) and a much larger learning curve for people other than yourself.

While using a framework limits you to that framework. I know this isn't a huge setback, but there are times when it is intolerable, ie. framework forces design patterns that you are not using. But that also works both ways. Sometimes you want to enforce design patterns, and then the framework helps you... Although I would sum that up to a lazy programmer IMO
I've heard of this before as "Not invented here" syndrome. Frameworks are powerful as they give all developers a common language and methodology for doing repeatable tasks, meaning that when I need to fix a bug in your code, I know how it is architected and where the code should be because you have used a framework I understand.

Not to mention that these frameworks undergo alot more extensive testing than an average developers code will ever go through. By using a framework you benefit from not having to go through the pain of dealing with all the different browser models and quirks that every version introduces or takes away.

For really advanced or incredibly high performance tasks you might be correct but to me that is the 1% of tasks, for everything else a framework should give you all the scaffolding you need allowing you to instead focus on tasks that add real value into the product/service you are working on.

If I really had NIH syndrome, I wouldn't use any tools/libraries. On the contrary, I use them quite frequently. And I build lots of my own tools/libraries on github.

What I don't do is make intrusive assumptions about the entirety of your application's architecture simply because you include my one little focused tool.

>Not to mention that these frameworks undergo alot more extensive testing than an average developers code will ever go through. By using a framework you benefit from not having to go through the pain of dealing with all the different browser models and quirks that every version introduces or takes away.

This is particularly what I value in open source frameworks - the hundreds, thousands, tens of thousands, maybe even million of man-hours that have gone into debugging edge cases, cross-browserifying, and finding security holes, stuff I would never be able to replicate on my own in any reasonable time frame. Especially the latter, given the security situation on the internet these days.

My SOP is, stand on the shoulders of giants, unless there's a particular requirement that precludes doing so. Such requirements are rare, most client work actively benefits from use of a framework.

This is often illegal because the code you write at most companies is their property, not yours. And if they sued you you'd be in a lot of trouble :/
If your goal is to learn and become a better developer, I agree, forget about frameworks, learn how things are done from scratch, it's fun!

If your goal is to move forward on a complex project adding features instead of re-inventing the wheel for n-th time, use a framework.

...again, the FUD that if you go framework-less, you're automatically re-inventing the wheel. Total B.S.
You're not reinventing the wheel but you are essential inventing your own framework.

So there are only 3 possible choices:

1. reinvent the wheel 2. use a framework 3. write your own framework.

This 'light glue code to bind together my libraries' thing someone mentioned. That. That IS a frikkin' framework! And it sounds clunky as hell.

First off, you can't just take the label "framework" and slap it on any arbitrary piece of code which works together for one or more tasks. By that logic, every site and app ever written is its own framework.

But...

> You know what I did? I wrote a framework for that site, and I called it “the site”.

The key differences between my "framework" and these popular frameworks:

1. I'm not holding out my "framework" for that specific site as some general reusable "best practice" for every other site on the planet.

2. It's highly customized, and customizable, to the specific site. When I don't like how events interact with views, I don't need to worry about forking some general framework project (and creating upstream update nightmares) and hacking into the guts of it to change the assumptions it makes. My "framework" is much thinner of abstraction, and far less convoluted.

Not because my "framework" is better. Just because my "framework" is specific to the task.

Guess this blog is a prototype too, takes very long too load...
One way to look at this is that frameworks are like a mechanics shop, or a carpentry shop. They have their own work flow, their own set of tools, etc etc... jQuery and small code snippets are the tools. The hammer, the wrench. When building a site, you don't need the whole mechanic shop (most times) but you need just the hammer. Along with that, a mechanic shop isn't going to work for every case. What happens if you have a mechanic shop and now you are just doing tires. Its not a hard change, but what if instead, you are a mechanic shop, but now you have start building cabinets instead. That mechanic shop isn't going to work. You can't change the lifts to start putting cabinets together.

I think the best way to look at it, is use what you need. You don't need a 140 piece tool set to hammer a nail.

I've been meaning to rip out the terrible "wordpress framework" from underneath my blog so that it doesn't suck when 20 people try to read it at once.
You've been meaning to: but you have other things to do.

It's all about the economics and tradeoffs of different choices, in the end. Sometimes a framework is a good tradeoff, sometimes it isn't, and it depends entirely on the particular set of details involved in any given situation.

The fact that I have not taken out the wordpress framework yet (because I've been busy with other "more important" things to do) doesn't mean that NOT doing so is somehow justifiable.
I like the article, some nice points.

I think mostly, you want to always know what the limitations of your framework are, and never be afraid to dive into the source of the framework to see why certain things are slow/buggy, etc. If you can do this, you will be in much better shape than 75% of the users using that framework.

+1. totally agree with that sentiment.
This article is horrible in so many ways, I don't think Im going to be able to cover the full spread, but here goes:

1) the overall structure of these arguments is "I've found the one true way to work, anyone who works differently is wrong, but I'm just sharing my opinion so you can't critisize me back" aka "I'm right, you're wrong, IMO, neiner neiner neiner"

2) the author claims that for a major site he wrote his own " URL history management, navigation, Ajax’ing of links, templates, events, etc.". And that this is a good thing. He, like framework authors before him, made inevitable design decisions, created conventions and generally created a way of working inside the app. Now people who aren't him are going to have to maintain this work. Instead of giving his client a standard framework that new hires might have experience in, he gave them MyFramework(tm). He has worked against long term maintainability and then congratulated himself for it.

2b) as they learned more, he re wrote based on specific knowledge of his own system. With an established framework, others could have opined, with his self-rolled framework he was a key-man.

3) In his discussion of backbone he throws up an incomplete straw man of "only 2 of 10 know it" then concludes "therefore learning my framework is just as reasonable.". False. First, backbone is extensively documented and almost guaranteed to be easier to learn than a custom rolled framework. Second, time invested by the other 8 in learning backbone is a re-usable skill they can carry with them to their next job, as opposed to time learning your framework that will not transfer. Third, backbone experts are available on call and on demand, if they need to grow the team or you get hit by a bus your client can replace you more easily if the app is written in backbone.

4) Maintenance. Here he claims that his framework is at least as well documented as other frameworks, and implies that it is better documented. He then says it is hard to write good code and good documentation without a framework, so don't be lazy and do it. "it seems many people have trouble building maintainable code without [frameworks]. Don’t be one of those lazy people." His example here goes completely against his larger point in any reasonable interpretation. If many people have trouble writing maintainable code without a framework, all else equal, that's a very strong argument for using a framework.

5) pain now vs later. He assumes here that all frameworks are optimized to get going quickly to the detriment of long term maintainability. This is patently false. Django and Ember come immediately to mind as frameworks that explicitly make you do things a slightly harder way because future self will thank you. Some frameworks (Wordpress comes to mind) optimize for getting started quickly, but at best this article is an attack on those.

6) extreme narcissism. "Your boss and your client don’t understand our industry, they don’t understand how the web platform works. And they will rarely care about such details. They’ll never care if you never help teach them by pushing back.".

6 cont) he happily puts his interests as paramount, then disregards the perspectives of others. Managers care about the long term viability of the project and hiring and budget, not just one person's happiness on the project. Instead of saying "they don't care about our industry" perhaps the author should spend more time positing that they are reasonable people whose requests come from reasonable places. They have information and concerns that you don't, stop waiving your hands and calling their perspective invalid.

This article is myopic. Self centered. Selfish. Unnecessarily inflammatory. And, almost entirely wrong from start to end.

At least you read the whole article. More than I can say for a lot of responses so far.

You said "almost entirely wrong". What did I get right?

I think you got at least the following things right:

* when a project has extremely high performance requiremets, rolling your own often makes sense.

* some frameworks do make really bad long term tradeoffs in the name of getting started quickly. (ironically though, I don't think any of the frameworks you listed fall into this category)

* if you have something that you're guaranteed is only going to be maintained by yourself (ie your own blog) then a lot of what you've said becomes "not wrong"

There are probably other things, but those are the two that come immediately to mind.

I thought the article would be a conversation about the value of frameworks versus libraries, opinionated versus generalized. Which is an interesting conversation and worth having. I was very disappointed.

Instead I saw someone proudly bragging about reinventing the wheel and NIH syndrome. Which is mind-boggling.

See other comments here about NIH. To attribute my post to NIH mindset is laughable. You obviously didn't read it fully.

I use all kinds of public OSS'd libraries and tools. I just don't use frameworks that prescribe an exact way those should be glued together, nor do I stick my own opinions about how the glue should work out "there" to try and convince others they should do it exactly like I do.

Frameworks and libraries are tools of our trade. The reason to use them or not to use them depends on the context. While it is foolish to become a 'Backbone specialist' and look at every project with those eyes; it is equally foolish to dismiss frameworks as prototyping tools.

Lots of frameworks interoperate well and are amenable to customisations. The good ones are more than sufficient for most client needs, even for prolonged production usage.

Most open source frameworks are results of thousands of man-hours of effort by specialists from different backgrounds. Many aspects like security, modularity and functionality are examined by hundreds of eyes. It is perhaps naive to assume that one's knowledge of the domain is so good that they can roll out their own framework much better than what anyone else has produced.

In fact, if that person is so capable, they should be encouraged to post their code for a public review and help others (or possibly be severely critiqued for their questionable design choices).

I post all my tools/libraries publicly on github. I would never have so much hubris as to post some "framework" I created for some site as "The Getify Framework" that everyone else should use. That's completely contrary to the message I'm trying to get out.

Ironically, the site I vaguely referred to in the post WAS actually fully open-sourced. But NOT so that people could look at that code and say "Ah, he's saying that I should always do that same thing with every site I build".

I get the impression that you perceive building a "framework" as a self-aggrandising exercise created for the sole purpose of standardising software development into creating run-of-the-mill products. Such view would be too hard on the not-so-trivial amount of effort that goes into creating a framework that can be applied to a broad range of use-cases, far beyond what it was originally conceived for.

In fact, the truth is that it is too easy in programming to skip the painstaking effort of reading and adapting to someone else's codebase. It is simply convenient to throw everything away and start from scratch embracing the (in)famous "Not Invented Here" syndrome.