I have a very different perspective than the author.
I've considered Libraries to be the pieces of code that let us 'paper over browser inconsistencies' to be things like jQuery. Sure, they also gave us some useful tools and plugins to accomplish tasks, but on the core purpose was to be able to write simple javascript code for common functions and have parity across all the major browsers.
Frameworks, I view at as code organization and paradigm tools. They create a more consistent structure for a group of developers to work on a single project. It aids in creating an MV* or other similar paradigm that a team can work within. Even outside of a team environment, Frameworks give you a ... framework, of how your app should be built, rather than just creating your own structure as you go along.
This is the reason why there are so many frameworks vs. libraries. Once you've chosen a library to handle browser inconsistency, as the author mentioned, barely an issue anymore, there is an endless possibility as to how your app should be structured. Some people like two-way data binding, some don't. Some people need extreme DOM performance of leveraging the virtual DOM, others hate the idea of having their html closely bound to their javascript (and framework as often the case).
I think yours is the traditional take on frameworks vs. libraries, so you're not alone. We have a lot of frameworks in JavaScript because we're still expanding and exploring the space where they can work. Eventually I think we'll settle on a smaller number of frameworks, but even so I doubt we'll see the level of consolidation that happened with libraries and jQuery.
I concur. I remember the days when there was explosion of Java framework last time, though the Java community at the time doesn't seemed to mind (they seemed to like choices) :-). There are some voices that complains of too many choices, but I think people generally agree there can be no One True Stack (TM).
As for preferring library over frameworks, sure why not. There are tons of reason to be able to do things other than the way that is described by a framework, but when you start to have teams bigger than 20, of different time zones, with varying skill level (important point here), having a prescribed way to do things may not be such a bad thing. There will be time to break the rules of the framework, but hopefully your choice of framework is good enough that it should only be less than 10% of the case.
To this, I can say that despite the failing of AngularJS, some teams just cannot live without it. Its very prescriptive to the point that people who a very good at Javascript may find it repulsive. But those prescription are just too robust for some team to abandon it and go for a more performant framework.
And there is a lot of companies that can't hire Google level developers. These people may not know Javascript enough, but are okay as long as there are good prescriptive example of how to do things. They should still aspire to be good at Javascript (or any language at that...), but sometimes that seems to be too much to expect for the portion of them. Sure, this is not ideal, but you have to remember, there are a lot of places in the world that IT is a cost center.
I disagreed with the author as well when I read this - libraries are a hodge podge of piecing stuff together, and when developers are left to their own devices, they often create an unreusable monster. Onboarding new developers also becomes harder due to it taking longer to understand the fundamental structure - there is not too much prior experience that can be drawn on to understand lower level logic.
You have a point, from my perspective though the difference between a light-weight framework like Backbone and one like Ember is almost as big as the difference between say Backbone and jQuery.
Don't throw the baby out with the bathwater. Sure JS frameworks are often unnecessary, that doesn't mean they aren't solving real problems.
The scope of applications and interactivity found in today's browser-based apps today dwarfs what we were doing even 10 years ago. The amount of experience and expertise that is being codified in (for example) Ember.js is fantastic and will allow you write much richer web apps in far less code than trying to achieve the same functionality with it.
Saying just use JS directly is sort of like saying don't bother with Rails, CGI.pm has everything you could ever need.
> Saying just use JS directly is sort of like saying don't bother with Rails, CGI.pm has everything you could ever need.
That pretty much sums up the article's stance on frameworks. Even with reusable components, there will be a need for frameworks because just using JS/CSS/HTML directly, one would essentially be creating a framework with each application. There are standard things that a framework encapsulates in any language or target environment which will be unnecessarily repeated and sub-optimally created if one decided to start from scratch on every application. I think the author misses this part completely. While learning a framework enough to start making things in it may take a day or two, creating a new framework because one hate using frameworks will take days to weeks and still likely leave desiring functionality they had not thought of or had implemented badly.
This is also going to vary depending on the domain problem. If you're aiming to make something large and comprehensive, it helps to start "a bit too crude" so that every assumption you make at the start is grounded in the understanding of where you want to go later. But if you're pumping out microsites, a framework automates the process and makes it easier to maintain a large body of them.
> The scope of applications and interactivity found in today's browser-based apps today dwarfs what we were doing even 10 years ago.
I'd dispute that. 10 years ago we had pretty brilliant browser based apps. They just happened to be using flash or Java applets whereas now they're using javascript.
Actually, I wrote a pretty complex browser-based app in 2002. It ran on Microsoft Explorer as it was the only capable browser at the time, and it used Javascript, XML and XSLT to construct a Windows-like UI environment within the browser -- you may check the code at https://bitbucket.org/BerislavLopac/waexplorer
I used the web 10 years ago, along with a lot of those flash and java applets, and I use the web now, along with a lot of these richly interactive javascript applications, and comparing then with now strikes me as truly ridiculous. The web is hugely more usable now.
There were but probably in-house non public ones. I had a course where the teacher explained how its company was building portable asynchronous desktop-like applications in JS since early 2Ks. Maybe the exception though.
A few examples would come in handy. The only place I can remember using flash and enjoying it was youtube. (And then only because there wasn't a better/standard way of playing videos.)
There were some pretty good multi-user flash games around 1999/2000, when things were just getting going. I can't remember the names though at the moment.
It's only recently that graphics / audio / video / networking in javascript is almost as good as flash/java was 15 years ago!
Sometimes it's easy to think we're on the cutting edge. But we're really not.
I'm sorry but the UX on Flash and Java plugin-based apps was horseshit. They were sluggish and encapsulated clumsily within the plugin sandbox so the integration to the browser was terrible.
Yeah people did some amazing work on those proprietary platform when they were the only game in town, but it really doesn't hold a candle to what we have today in terms of a fully open and native web tech stack. If you want to be reductionist why not just say we haven't been on the bleeding edge since Lisp was invented and declare everything else derivative tripe.
They were faster than browsers were at the time, that's for sure. Especially Flash. At one point no serious design-focussed website worth its salt bothered with HTML because Flash was so much better and easier to author. Heck it's probably still easier to author.
The "open and native web tech stack" is something that evolved messily over a long period of time in a piecemeal fashion with little overall design vision. It's hardly something to be proud of.
And yet the sites that succeeded long-term (Google, Amazon, etc.) didn't use it, while all the sites that consisted of a zillion MB of Flash and Java all went by the wayside.
Maybe design snobbery isn't as important as designers think it is.
And yes, the web is definitely something to be proud of.
There has never been a cross-platform, cross-media, accessible platform like the web in the history of computing or humanity for that matter. It is very much indeed something to be proud of.
I've been seeing the term "web app" a lot lately. Not exactly sure why. Is a web app different from a website? I guess so probably maybe? I'm not really sure.
In my understanding, a webapp is essentially a "desktop-like" application for the browser, i.e. something like gmail or an online paint program, something that is interaction driven, will probably use websockets for giving a realtime feeling, etc. A website is the traditional static content, like a blog or a news site. Obviously, these are just relative and its a scale so there cross-over and sometimes its hard to define in exactly which category an app/site falls.
quite different--
Web app, think Google Docs/Sheets.
Web site, think blog, information landing page, or even web store product page(s).
Web app is highly interactive (may or may not be an SPA single page app), relying heavily on javascript for UI events, saving/fetching application state, remote datasets, and sometimes making use of modern HTML5 browser features.
Web site is displaying information and is just augmented with some javascript mostly for improving the UX or attaching analytics/social plugins etc.
Given that this distinction is entirely subjective (no-one will be able agree on what a test that pigeonholes pages as a 'site' or 'app'), how is it a useful distinction?
It may not be a useful distinction, but it's useful to have a sense for where on the continuum the thing you're building sits, in order to make technology and architecture decisions. If you're building something more "website-y", it should probably have an architecture that optimizes for search-ability and static caching, whereas if you're building something more "webapp-y", the architecture should probably optimize interactivity and dynamic updates. Most things end up somewhere in the middle, but leaning one way or the other.
I don't think anyone is trying to partition projects into disjunct sets. It's more of a continuum. I think the idea of "app-iness" just captures the interactivity and statefullness of an experience. Incidentally, that additional complexity is exactly what the Web technologies were initially ill-suited for and what frameworks were built to help manage.
Is a "simple website" and a "complex website" a better distinction in your opinion?
Thus I am a complex website engineer. It sounds ridiculous. The webapp developer is domain knowledge wise closer to traditional "application development" than to traditional "website development".
Are sites like vox or gawker considered websites or web apps? Their custom CMS is quite expansive. How bout NYTimes? Is YouTube a web app or a web site? I'd be curious to know some examples on either side. Preferably several closer to the line but on one side or the other rather than far away.
I totally agree web site and web app are used interchangeably sometimes -- I was just answering the op as to how I and many people I know classify them and their differences as they relate to the topic of the article, javascript.
For me a web app is an HTML5 web page, that has its interaction logic coded in JS and presentation is done by altering HTML5 DOM and where JS uses REST to send/receive data.
In other words as someone else noted, it is a sandboxed application with
sandbox execution environment == browser
IO == REST
UI = HTML5 DOM manipulation of the same page
A website (or server app) is a series of HTML5 web apps or HTML5 static pages (JS-less web apps) with navigation logic and inter-app state living in a server app.
"React isn't a framework, it's a library!" There I said it!
Jokes aside, React provides a Virtual DOM which isn't available natively. I'm sure sometime in the future browser's DOM tree estimation and computation would be so efficient that you wouldn't need a Virtual DOM anymore. Until then, React is the best way forward. There are plenty of thin VDOM libraries (some even more efficient than React) out there but the joy of working with code written as composable Components outweighs efficiency (I'm sure those libraries would fare far worse in benchmarks if composability is put into the equation). Couple this with a library like Om/Reagent and you get FP (code as data)+immutability handed to you on a silver platter.
Without the "right" libraries you introduce a lot of incidental complexity into your application development lifecycle.
> "React isn't a framework, it's a library!" There I said it!
React is a framework though, for the most part it calls you(r components), you don't call it outside of the original binding. It's not a huge one, but it's still one.
> I'm sure sometime in the future browser's DOM tree estimation and computation would be so efficient that you wouldn't need a Virtual DOM anymore.
Browsers already batch changes and defer recomputations as much as they can. They can't significantly improve the model because it requires a different abstraction which is not available under the existing DOM.
Also, you can use a VDOM without using React and its component, several VDOM-only pure=js libraries have sprouted up e.g. https://github.com/Matt-Esch/virtual-dom (the basis for elm-html, and the Mercury react-like framework)
Well, the virtual DOM is a great concept regardless - storing diff information on JavaScript is a great optimization, even if browsers eventually optimize browser rendering speeds, one will still be able to squeeze more with this & benefitting from that optimization.
I'm a huge fan of ReactJS, however it isn't a perfect or optimal implementation of it's concepts. Having a purely functional frontend, with immutability is key. ReactJS is leaky in it's mix of imperative and declarative code. FluxJS also suffers from this same issue.
ReactJS is the gateway drug to frontend nirvana. For more info:
I can't speak to the others, but Immutable is not in any way sufficient to replace native immutable data structures. The fact that you don't get native notation for initialization or destructuring is a huge deal in practice. Nobody wants to write 'foo.get("a").get("b").get("c")' where "foo.a.b.c" would do. (Likewise for assignment/creation.)
None of the upgrades in ES6/ES7 obviate the need for frameworks. Maybe some libraries are made redundant, but frameworks address more interesting abstractions that a general language probably shouldn't cover anyway. Frameworks seem to adopt more opinions about implementation, and help unite a team over a set of ideas, and enable them to move faster and reason about similar problems in similar ways. Hopefully that team has picked a framework that is also well-suited towards the problem they're solving.
As a user of Angular, Backbone, and React (not all at the same time!), I feel like their largest benefit to me is in providing application structure -- good because as it has been said, if you aren't using a framework, you are writing your own.
I don't really see how any of the 3 items under the article's "So what do we need now?" will provide that benefit.
Not just structure, they enforce application architecture, something that you often miss until it's too late if you just get busy gluing together lots of npm modules to build your application.
This sort of attitude worries me, you don't need to use a framework to get this, you just need developers who have some knowledge of design/architecture, or who are the sort of people who will do research to find out.
I honestly think the framework enforcing architecture idea is more of an anti-pattern, even if you do use a framework you need to keep in mind that it wasn't built directly to fit your needs and that you may want/need to move in 6 months or a year.
This is anti-intellectualism: "architecture is hard, so let the smart people at Google handle it."
If it's hard, you learn it so it isn't so scary. You build one to throw it away, as Brooks recommends in The Mythical Man Month.
I want nothing to do with an industry so obsessed with maintaining its own passivity and ignorance of practices. The truth is: a good architecture is highly liberating. It segregates responsibilities, enabling developers to spin up quickly. It makes it easy to spread work among devs of varying skill and experience. It makes maintenance a pleasure or a complete grind.
You have the ability to make working in your code base an enjoyable process of exploring a particular problem domain. But to get there, you need to think deeply about how data flows from inputs to outputs. It's fine to skip these steps via a framework, but you're also trading off how good future maintenance.
There is nothing special about the web that requires frameworks. They're a modern preoccupation, just like OOP was, or components were. In the end, good engineering is what's required, not blind faith in commoditized tooling.
> "architecture is hard, so let the smart people at Google handle it."
You are misunderstanding. I and others don't say its hard therefore we will get all our answers from one prophet.
We can look at lots of options (including rolling your own) then make a choice. Once I made a choice for a project its smart to comply with the architecture and principles provided by that choice.
I do the same thing on the web I do everywhere else. I dont write my own gui librarys or databases. I look at databases, evaluate them based on my needs and pick one or more. If I choice SQLDB I will not use it like a key value store, thus the database from now on forces me into a pattern, but that is alright because I have voluntarily made that choice.
If I have other needs I have to evaluate if I would rather bend SQLDB or add another database.
Knowing architecture is required for your choice but its a skill that you should not apply every day. Once you have to make your product happen in that architecture. It does no good to constantly rethink your hole stack.
> This is anti-intellectualism: "architecture is hard, so let the smart people at Google handle it."
No, it's not intellectualism, it's pragmatism.
It's important to recognize what you are good at and what others are better at than you are. Just because something is hard doesn't mean you should dedicate time to learn it or you'll be called an anti-intellectual.
I don't fix my car myself nor stitch my dog myself.
Same goes for computer science. It's a very, very wide field and you can't possibly expect everyone to know everything about it. I'm comfortable in my ability to write decent, well architected Javascript (and Haskell, and Scala and Java) but when it comes to creating a Javascript data binding framework that's efficient and follows good conventions, it's just not worth my time to learn how to do it properly versus using a framework written by experts who've spent years thinking about the topic.
The best developers I've ever worked with are the ones who know exactly when not to roll their own implementation.
It can also depend on how many developers will write with your framework, and how long your code is expected to live.
If the code is built on a custom in-house framework, you are putting the burden on everybody to learn it and understand it and hope they can see it the way that you can. No one will really be as invested as you in understanding the ins and outs of the framework, or the special features you added that they won't even think is available, and won't care to discover or ask about.
With a well known popular framework, not only is it likely to have more documentation available online, there will be more resources from other people blogging about solutions, workarounds, tips and tricks. There will be additional libraries built on top of the framework for common problems. There is the incentive that getting good with the framework can help them in their next project or their next job interview. Lastly, it also reduces the friction of adding new team members.
> This is anti-intellectualism: "architecture is hard, so let the smart people at Google handle it."
No, it's "I want to get my job done, get paid and go home".
Believe me, I am anything but anti-intellectual! I love thinking about software and how to make things better. I studied Computer Science and love applying theory to practice. But 90% of the time, the correct answer is "use third party libraries or frameworks", not "roll my own".
In the current project I'm working on, I made the decision to use ReactJS instead of building our own frontend library from scratch. The project is almost ready to ship and has been very successful. New people to the project are saying "React was the right choice."
If I had tried to build our own frontend architecture from scratch we'd never have hit our deadlines.
I think that depends on how good is the framework is architecturally sound in the beginning AND where you work.
I had a case where we had our own internal framework. Its okay. But the team turnover is quite bad to an already tight deadline that I had to re-explain everything every time a new dev comes in. That framework has no routing(its basically for multipage app) and guess what, if someone decide that they need routing, that guy is going to create his own, and there might be two of these guys, so then we have two ways of doing routing then.
And given the fact that this team has high turn over and tight deadline, I don't think you can say that it'd make a cohesive team, and the communication channel that everyone has is already overloaded (loads of meetings).
Sure, that may be a bad project to begin with, but that would be a different story.
In this case, at least for me, using a standard framework would be no brainer.
I think you've just done a really good job explaining the differences between good developers and great developers. Good developers display that anti-intellectualism, but great developers spend the time to learn what they don't know and design a system that fits their problem.
Where did I say in my comment that "rolling your own" is the only acceptable solution?
I said "great developers spend the time to learn what they don't know and design a system that fits their problem". That can very well include pre-existing systems or frameworks.
I agree with the other replies but when you talk about learning from Rails, I agree. I also don't think using Rails is a bad idea. However I find the idea that if you don't use a framework to literally force you down a path you're on your own, that chaos will be dogging the project, that you end up with massive re-invention, to be incorrect.
Rails is also a bit of a special case I think, it was a massive ecosystem that dominated the community it was in. That isn't true of any JS client-side framework right now so choosing one isn't necessarily a sensible investment when you look 3+ so years out.
I think it has to do with the way the developer approaches the problem, their background, and their preferences.
Personally I'm with you, I enjoy a small, isolated, component based approach where each component follows the unix philosophy. I think this lets you write the most performant and resuable code. Also, I think when following this style, it limits the scope of your dependences, which is another big plus. For instance, you might need a library for crypto, but you won't need one for doing your authentication system, and you won't have massive modules for handling auth that would come from a framework getting compiled into your production code.
But when you go this route you do have to make a lot of "right" decisions that are made for you when using a framework. Also, I think a lot has to do with deadlines and developer speed, it initially takes a little longer to write good standalone components that are reusable, and just grabbing some framework will help get shit done in the short term, but might have the same detriments as technical debt in the long run.
Yeah that's my attitude too, Ember scared me away because of the kitchen sink approach and the fact it introduced lots of new abstractions that I hadn't seen proven elsewhere, and that didn't really seem to me to be what I would be expecting from a Web framework.
Something like React bothers me far less as it smaller, less imposing, and solves real problems I've seen with other frameworks (for example by pushing clear/consistent/simple communication paths).
The only js framework I'm aware of that could accurately be described as trying to solve everything and the kitchen sink is ExtJs, which includes a wide widget library, and is very opinionated about how you interact with the DOM. Ember is is not a "kitchen sink" framework, and Backbone is certainly not.
I've found that even if you start with the "basics", like the author describes, that you'll end up finding that you repeat the same types of tasks repeated. So, you refactor and make functions that simplify common actions. After a while, I guarantee you that your code will look a lot like a framework.
Frameworks are created because they make solving certain types of problems easier and reduce code duplication, whether you use someone else's or your own.
A framework has control of the application by default and gives control to your code at designated points, to perform some computation and then return control to the framework.
A library takes control of the application when/where your code calls it, performs some computation and then returns control to your code.
A library is a way to reuse code; a framework is a way to reuse application structure/design and control flow.
The pain points of frameworks are well known at this point, I guess the question is given a really good set of high-level libraries, could you be as productive as you are using a framework? Maybe not at first, because you have more design choices to make. But later, you have less of other people's design choices restricting you.
> The problem is that now you have two systems to learn, HTML+CSS+JS, and the framework
Besides that there are 4 things listed there, not to mention how each interacts with the other, this is not a problem. If you shy at learning an additional thing, you should get out now.
That's not to say you shouldn't strive to reduce complexity and dependencies, that's a laudable and useful goal. But it's my personal opinion that every programmer out there should know at least a handful of languages, concepts, paradigms or frameworks that they don't like or have no use for--it's the same basis of learning more from failure than success.
That being said, I sincerely disagree with the assertion of the article, if on nothing more than the abstraction argument. The abstractions of jQuery have saved me so much time over the years with systems that work great in the latest and greatest browser, and work well enough, possibly with minor tweaks, in older browsers. Rewriting browser detection junk and making sure each control mostly works independent of browser and engine would be a much larger waste of my time than learning three or four js frameworks.
I see his argument about being primarily about the future, that as the standards fill in the gaps investing in libraries will become less of an attraction.
Don't forget he was part of the REST/ROA group who were belittled when they said that Web standards were an alternative to the ridiculous number of Web Service standards and he was quite right in that case.
I agree with you wholeheartedly. I just recently started blogging exclusively on how to build dynamic without javascript framework @ http://pothibo.com
Solutions exist outside the scope of JS framework. We only need to take a minute to analyze them. It's not a popular decision to avoid JS frameworks but I believe some criticism of the current solutions available is in order.
It's not only the frameworks. Working with JavaScript has become ridiculously complicated. I remember when I started developing JSF applications. You had to learn about application servers, servlets, Spring, MySql, Maven, Hibernate JSF, JSP and the various JSF extensions before you could even start working. JavaScript now has become almost the same with Bower, NPM, Angular MongoDB Grunt, Compass, Jade and whatnot. Nowadays, when I start a project I try to keep it as simple as possible because
a) Todays technology is deprecated tomorrow
b) When someone joins I'm the one who'll have to teach them
The number of tools has increased, but I think JS development has actually been simplified in some cases. This is largely due to the rise in popularity of rich clients talking to simple backend APIs. In older web projects JS always felt like an afterthought. Dependencies were managed totally by hand and your scripts were scattered throughout the backend templates. If you needed to do anything at all with your front-end code at build time, you had no choice but to glue some hacky solution onto the existing build process. Client and server were all mixed together, and it was painful.
Starting a project today, I can build a client in Javascript, hook it up to an API, and I'm done. NPM and Browserify make dependency management and builds a breeze. There's very little friction in the development workflow because the front-end build process it totally separate from the server. I make a change, save it, reload the page and I see my changes live without even running a server locally. Even PHP's deployment story isn't that simple.
It's true that the initial setup is more complicated than simply downloading jQuery and plopping it into an existing project, but if you have the option of separating your client and server code, it really simplifies things overall.
It's not just about a framework featureset, frameworks also provide convention and structure. Convention and structure are a problem whether or not you choose to use a framework.
Frameworks give us a language to speak to each other about the nuts and bolts of our application. This means new developers can get ramped up quickly (provided they understand the framework) and there is a common body of best practices that can be referenced when faced with difficult problems. There's a lot of value in that.
Theoretically you are right, but in practice you spent more time with the framework and how the "best practices" work, as with you application.
Most problems are simple, but to solve them in a framework, you have much todo.
And when you understand and use everything "the right way", the new Version of the Framework arrive -> see angualar v2.
A new Framework with a new underlying language (WTF?)
Best practices work without frameworks too, you have only to define them and communicate them with your co-coders.
Since requirejs with the modularity and different build tools, i feel no need for a huge framework.
I pick the libraries i need and build parts of the application into modules, since the communication run with events it is clean, structured and has a clear defined API.
I see that as a positive. The knowledge you gain working with the framework immediately transfers to the next project using the framework.
How hard a problem is to solve depends completely on the framework. Obviously, the better frameworks make that as easy as possible.
Best practices outside of frameworks absolutely exist of course, but in the context of an application it's left up to you to decide what those are. Rather than spending time deciding this myself, I'd rather lean on people who have spent far longer on that decision than I have time for so I can get back to addressing the actual business problems my application is aiming to solve.
"This means new developers can get ramped up quickly"
Agreed that is an advantage of frameworks, but is it not more of an argument for a mature framework like Rails, rather than the current JS frameworks which appear and become (essentially)obsolete/niche in a year or two?
People also said this when HTML5 was on the rise—pure JS, no runtime but the browser! Of course, it turns out engineering DOM-manipulating applications in a responsive way is really hard.
These are the core benefits of frameworks:
1. Standard code style.
2. There's only one way to do it (ideally).
3. Modularization.
4. Unit testing.
5. A realistic standard library for async/concurrent computation.
Angular, for instance, provides dependency injection and $scope/$digest. It would be pretty ridiculous to attempt to replicate those benefits until AT THE VERY LEAST Object.observe has solidified in terms of support. And even then, you're on your own in terms of mocking, in terms of communication between different modules, in terms of libraries you can drop in without dragging in a framework itself.
I'm appreciative of the attitude, but it's quite simply not a reality for people who don't want to invest in establishing their own patterns—in effect, writing a framework. With a framework, people can sit down and use the engineering techniques they've learned from other areas of CS and write an application without being bogged down in terms of figuring out how to write a high-performance single-threaded web app in a language without modules, integers, futures (or other similar async abstractions), calendar widgets.
Try going without JQuery for a day and see how much duplicate code you write.
Then, multiply yourself times a team of 10.... good luck.
You missed out on the biggest core benefit of frameworks: battle tested code for a very large chunk of your application without having to re-invent it all from scratch. Frameworks give you a stable foundation to build on.
No, with libraries you have to provide the whole structure and this is exactly where plenty of programmers go horribly wrong. Frameworks abstracting out the structure is actually one of their largest benefits.
Except I've never seen a framework help with this at all. I've lost count of the number of code bases I've had to pull a part that used express, symfony, rails, angular, or whatever. Controllers stuffed with business logic, views modifying models... You can't protect coders from themselves.
You can limit the scope of the damage though, and that is an understated benefit of a framework. Architecting solutions for a team is about risk management in many ways.
I'd say most frameworks don't do this very well. One of the reasons I think React is really promising is that it does it better than most, but ironically it isn't a framework.
Personally I think there's no substitute for peer review. Code reviews and pair programming are both far more powerful tools.
Get you, I think that relying on a framework to teach you that is a problem. Once you've used or researched one or more frameworks in an area you learn the successful patterns (right down to file/folder/test/method naming). At that point the whole enforced structure can be a disadvantage.
Dartlang isn't directly supported, and I'm not interested in digging through compiled javascript to debug. Yes, there are tools to ameliorate this, but it's not worth the technical debt of a new language with support from only a single vendor.
There is actually a tool[1] that will provide the right subset of polyfills to the specific browser. However, you do need to specify the list of polyfills you use in your code.
The default included polyfills tend to cover most things in my experience. I haven't had to worry about if a feature exists in IE8 or if we're polyfillng it for a while now, it's great.
I think one of the biggest problems with the morass of client side code in many large code bases is that it's written, by and large, by engineers who are trained and focused on the shared-nothing world of http server side development. The art of managing state, and the goal of a stateless application is lost on you if you've never had to mentally run a program that runs longer than a few seconds. Yes, there are many fad frameworks. But I totally disagree that the answer is "fewer frameworks, more raw js." I think the answer is building tools to help better manage state (eg React), and over time strengthening the skills of your average "full stack" web engineers from 75% server side 25% client side to a more 50/50 split.
This post is just pushing web components / polymer with a controversial title right? I don't think it's production ready yet though (slow polyfills), and there's some differing opinions on how web components should be built.
The author of this article completely ignored all of the features that actually make people use Ember.js. Router, naming conventions, project structure, container to manage objects. It's possible that in the future Ember.js will use plain HTML components and JS features like Object.observe, but it won't mean that suddenly its code will shrink to 1kB, because it's not all there is to the framework.
My summary of that text: "I don't know how frameworks work, so let's not use them".
I'm not saying that the author doesn't know what a framework is in general. What I'm saying is that this article can be boiled down to something like: "Javascript has support for feature X, Y and Z, therefore we don't need any frameworks". I should probably also not list Ember's features in my comment, because it's not only about any specific feature - it's also about conventions and app architecture.
I think that the underlying concern is valid, ie. we would all be better of if we all joined forces and push for web standards, which can be used in any framework. The problem is that the conclusion, ie. we shouldn't use any frameworks to achieve that, is wrong.
Framework authors care about standards and I personally think that each framework will try to adopt more and more native JS and HTML features, but it doesn't mean that we won't be needing frameworks anymore.
"The fundamental idea is that frameworks aren't needed, use the capabilities already built into HTML+CSS+JS to build your widgets. Break apart the monoliths into orthogonal components that can be mixed in any combination"
Also this is a man with a very rich history in terms of the Web and Web standards so writing him off without giving what he is saying any real attention seems silly.
In some ways, browsers are as fragmented as ever. Everyone loves to forget IE, but the last I checked IE8 was #3 in sales in our shop. Throw in a little jQuery and we never have to worry about a lot of things. Polyfills are nice, except that browsers are still experimenting, and plenty of people aren't mindful of that fact and it's not uncommon to visit sites that don't work properly on a browser other than Chrome. A sad state of affairs, but a reality nonetheless
And I have a counter datapoint where that's exactly what my girlfriend has to do sometimes, because IE11 isn't supported correctly by some modern sites. However, both of our anecdotes mean diddly-squat in terms of working out whether the parent is exaggerating.
I wouldn't phrase it as as "not supported correctly" but rather "Microsoft has had 20 years to fix their broken code, and it's still broken".
Seriously, dude. If you're not doing stuff on the extreme bleeding edge, the same code usually works fine on Chrome, Firefox, Safari, Opera... everywhere but IE. If there are any changes needed, they're trivial. Only IE requires extensive effort to "support correctly".
Microsoft is a $180 billion company with 100,000 employees. I'm just a guy. If they want their browser to be "supported correctly" they should make it work correctly.
No, I specifically meant "not supported correctly" -- as in, because of UA sniffing, you're given an old obsolete interface despite IE11 supporting the features that site needs.
> So why are we still writing JS frameworks? I think a large part of it is inertia, it's habit.
I'd say it's need.
> Q: You can’t do ____ in HTML5, for that you need a framework.
> A: First, that's not a question. Second, thanks for pointing that out. Now let's work together to add the capabilities to HTML 5 that allows ____ to be done w/o a framework.
Great idea, but what do we do in the meantime? It's not like features get added to HTML 5 overnight.
"Now let's work together to add the capabilities to HTML 5 that allows ____ to be done w/o a framework"
It takes a long time and iterations for standards to be finalized and adopted. It took more than a decade to for the release of HTML5. In addition, adding more and more features to the standard lead to bloats and even longer release cycles. I think this is the role of frameworks/modules to provide higher abstraction and convenience.
I also don't see how expanding the capabilities obviates the need for a framework. It might make certain libraries less useful, but I don't see the link between a framework and HTML 5..
Eventually Front end will get it thing together... the closest thing for bare stuff is like yeoman stack, bower, npm, grunt/glup, etc.. Require.JS doesn't play nicely either. I wish Javascript come out with built module system but it feels like you're just dressing up a pig now.
Maybe people do like coding in Javascript but so far the direction that Javascript is going feels like a mess and added complication. Javascript tries to do backend stuff now and deviate from it's original intended domain. Which is fine but it also make it a mess cause it doesn't have the construct and primitive in mind for backend.
What construct? Modules for one, is not built into javascript. It's ok we fixed it. Now we have several module system. How bout concurrency? What's wrong with passing call back and non block? It's ugly and because it's ugly we're going to patch it up with promise in the next language iteration. It goes on. What's wrong with fixing the language? Nothing, you're just fixing it on a shaky foundation while adding more complexity. You're just a debbie downer. Perhaps, or perhaps I'm spoiled by the elegant of other languages...
People are going to chug away and use it as a hammer imo. But seriously it's a very ugly language to write huge lines of code in for anything more than just small scripts.
Frameworks solve some problems but I'm wary of them now especially Angular and Ember. Smaller framework might be better but I'm sick of front end and the constant search for the thing that will save us from this nightmare of SPA. I'm leaving front end.
That's just, like, your opinion man. Clearly it's not the language for you, which is ok. I will agree that it's a mess on the front end right now, but you've got to admit that it's the only widespread frontend technology that does not require heavy tooling. I think as react and the like come of age, it will become much easier to use than bloated oop native dev, and people will have a very different opinion of it. As for the backend, it's probably better there than on the frontend. You've just got to buckle down and use callbacks.
I agree with some of the points the author makes. Libraries > Frameworks. Don’t create silos, etc.
The problem with this article is that most of the innovations that browsers are now bundling came from the community, in the form of libraries or frameworks. (document.querySelector, js templating, promises, observables, server push, etc)
Libraries & frameworks are the way new paradigms are explored and improved. They are not the future, but they contain the future.
I do think that frameworks come out too fast, and too often. But I disagree that we should move past them. They do make coding easier and faster. The real efficiency comes not from using a framework for one project, though. It comes from using one framework for many years, until you are coding features almost as fast as you can think of them.
My concern with frameworks is that they become a crutch. People no longer try to code up their features from scratch. I see this the most in jQuery-heavy developer, where people will go seek out a plugin when they could have coded up the same features themselves had they just stopped, took a step back, and thought about it for a while.
At the end of the day, I support picking a framework, sticking with it long-term, while also recognizing its weaknesses and knowing when to just write native JS.
My thoughts precisely! Down to web components and polymer!
Thank you, now I have to something to reference when talking to my colleagues.
Well I didn't consider HTML-imports, x-tag, Bosonic, but thank you for that information.
The author could also have mentioned the last round of crazy javascript framework flowering ... about 2005-2006 ... Prototype, YUI, Sarissa (the most basic one), Dojo, Mootools, Scriptalicious, jQuery... jQuery seemed to have won that round and for a few years most people seemed to be using jQuery. Until AngularJs, Backbone, React and Ember came along :)
I remember when people used to make these arguments with Java and PHP. "You don't need a framework, just write your JSP templates to have database calls with SQL and tons of Java code". BLEH! I'm glad Struts, then Spring, the Play, came out and made life more sane.
I wrote javascript before there were frameworks when it was just libraries like mootools and dojo and jQuery sitting on server-side templates. Today I write CORS apps with Backbone.js+Marionette.js+require.js+grunt+qunit and it solves all kinds of problems and I love it! I'd never go back to javascript without frameworks. As soon as this project is over I am gonna try AngularJS to see what the hype is about.
I think what the author is describing could be looked at as PHP+MySQL, versus something like Rails. The problem with being in one camp or the other, is that one size will not fit everyone.
Bot bare-metal js and frameworks are here to stay.
I strongly disagree. Innovation is good, form some opinions about which ideas are good, become good enough to quickly identify good ideas and quickly dismiss bad or obsolete ideas, and all the problems go away.
It is interesting to see so many different opinions on this topic. In my opinion it really depends on the kind of problem you want to solve. For very simple things it can feel stupid to load in a huge js framework. If one wanted to create something like a blog where a little ajax here and there is nice one might completely skip a framework. But does a developer really want to solve standard problems that have been solved countless times? Big web applications can profit from a framework that enforces some coding standards for common problems.
Unless you're coding a hello-world app, if you aren't using a framework, you are writing your own. If you're working on a 50k+ line frontend app, there's no way you're not gonna come up with a structure, standards, conventions which eventually is gonna become something like the frameworks we already have out there.
Frameworks are not built to deal with browser inconsistencies. At least that's not the main selling point, unless you're talking about the jQuery only. You mentioned Angular and Ember which provide a lot more.
Well,with the release of ES6,the author should expect an EXPLOSION of frameworks,especially class based,IoC driven ones. ES6 brings loads of features to the language,some features will lead to complex codebases (proxies,modules,loaders,realms,quasis...).
It wont be just about sticking a few js files together.Js dev will get more complicated as times goes.
AngularJs and co are just the beginning of a trend that will accelerate exponentially in the next 3 years. Be ready for endless variations of Angulars and Reacts.
Frameworks aren't specific to Javascript. Almost every mainstream language I know of has a framework of some sort - If you're using a language on its own then I guarantee you'll end up writing (and testing/maintaining) similar code to everyone else. After a few years, you'll have built up a "utilities library" that you copy from project to project. This will need maintaining, and new starters will also have to learn your library.
I'm not sure they are immediately comparable, the level of change in the JS side has been massive.
I'm also not sure the utilities libraries will be copied from project to project, for example if you developed a utility library and were using Ember its quite likely the Ember abstractions would have impacted the library design. If you then move to say React..
JavaScript, among all the languages out there, is the most ripe for "abuse". It can be used in so many ways, I don't know how you don't use a framework.
I certainly sympathize, but I'm not going to use Angular or some similar pile of goop because people don't want to think about JS frameworks anymore.
Something I've noticed: my coworkers who bitch and rant about this the most love Django. So I don't think the problem is the notion of framework as such. It may just be that things are changing really fast and people get stressed out trying to stay on top of it all.
I'm glad that I've blatantly ignored all the frameworks that have come and gone over the years. I still know what these frameworks are and their capabilities.
Frameworks like polymer are nice because they will eventually will fade out. I think that was the idea with TypeScript as well, but I think MS deviated.
What we should encourage are unopinionated but comprehensive libraries that simplify tasks just as the author mentioned.
I think the speed of development gained now by leveraging all the good stuff that frameworks offer in the 10% tip of the iceberg is hugely beneficial in the short term. In the long term, thanks to initial productivity, teams will get more resources to invest into rewriting code for new frameworks or even rolling their own JS "paradigm" (be it a framework, lib, or nothing)
I feel the author does not have enough development experience, or maturity to make such an statement. The reason for such frameworks is to clean up the mess and the void left with years of neglect on the web as a platform. To possibly blossom ideas, on how to improve the web, clearly not many people can agree on standards
Honestly everytime I see a job posting saying it needs angular or some other similar framework they lose me. I've built some fairly complex applications using nothing more than jquery and handlebars. This level of abstraction leaves room and flexibility to build pretty much anything.
Research, development, ... evolution is an iterative (if not recursive) process. We need to experiment with Backbone to create Angular to create the next framework. Angular 2 is already prognosticated as NOT backward compatible aye?
Current frameworks are made more and more useless with the evolution of standard, browsers and stuff, however what would most likely happen is new frameworks will emerge and the circle will continue.
Within a team, a JS framework is critical to making sure people are writing (and even thinking) in a cohesive way that is maintainable 2 years from now.
I don't build software for 2 year increments. It took us a year to get our last release out. Telling management their shiny new 2 million dollar investment has to be reworked to Angular 2.0 immediately could be career ending.
The implication in this post is that frameworks are standing still. That browsers have evolved and frameworks are built based on some past version of browsers that no longer exists.
In reality frameworks, browsers, and web standards are coupled together in an important triangle that creates the progress Joe calls out.
Frameworks iterate at an incredible pace compared to standards and browsers. The multitude of frameworks and libraries implementing the component pattern directly influence the spec. Members of W3C TAG and TC39 take the lessons learned from JavaScript development and fold it back into specs.
A great example is promises. This is a standard JS pattern, and now native feature, that began life as a library, became several libraries, then an independent spec, then finally a formal ES6 spec (domenic can correct me if I have the history wrong). When we talk about Move the Web Forward this is what we mean: http://movethewebforward.org/. Frameworks represent the shared and negotiated best practices of a development community- from this we can formalize solutions into specs.
To make a second point: Developing for the web means developing for a spectrum of platforms. A framework like Ember (which I work on) provides you known support for a variety of platforms. I don't need to consider if 5 different libraries all have fixed the ARM optimizations errors on iOS8. I can know all the features in Ember have it fixed. In fact I don't even need to think about the error, most likely.
A third and final point: Of course frameworks don't just influence browser features. The conversation is two-way. Unlike a simple scratch-an-itch library, framework authors are constantly looking foward and thinking about how they can better align with upcoming features. Ember has iterated on its Set, Map, and promise APIs to make them match the specs. Sometimes as we align with a feature we discover unexpected architecture problems with the spec (Object.observe, web components) and push the feedback upstream. Sometimes a spec helps us solidify an un-spec'd solution, and we need to expend effort trying to move apps to that new pattern (ES6 classes).
Most developers who buy into SPA architecture and build complex JavaScript applications understand the value of a framework. They are not panaceas (and setting them up as one is making them a straw man), but they absolutely play a very important part in the JavaScript and web ecosystem.
Which is more than I can say about this post's FUD ("Remember all those MochiKit widgets you wrote? Yeah, how much good are they doing you now that you've migrated to Ember, or Angular?" they work just fine thanks) and call to limit your ambitions for a great client-side app.
It is kind of a hacky language. Weakly typed, inconsistent runtimes and all that. Server side code in strongly typed languages is generally more predictable.
JavaScript is only unpredictable if written by a poor developer. It's just a language, and it is as powerful as you are. Weakly typed languages are not hacky - merely different.
Unless you really mean weakly typed (e.g. "1" + 2 = "12" vs "1" + 2 raises TypeError). In which case I'd say that that's one of JavaScript's (pardon the pun) weaker points.
Disclosure: I like JS. Its weak typing can still be annoying (although you can avoid a lot of it by using strict comparisons).
Weak typing is fine, and even beneficial for small scripts - what javascript was originally meant for. It does not scale though. It leads to large projects becoming unpredictable, unwieldy and mired in technical debt.
A poor programming language does not entirely preclude the possibility of a successful app, it just makes it a lot more difficult to release a stable one.
For companies that can throw huge resources at their apps (e.g. google) the language deficiencies do not matter as much because they can be dealt with with extra work and testing.
FWIW, promises can easily be polyfilled. The rest, not so much.
If you replace Polymer with React, you can actually live in a world that's not so dissimilar from what the author is advocating. Of course then you're still using libraries, but arguing against libraries (as opposed to frameworks) is insane.
This is completely wrong. The reason frameworks are still popular is Modules. Modules are not solved in the browser and until they are there will continue to be frameworks to ease that problem.
Absolutely. Even if I wasn't using node I'd be using browserify for its modules, its one of the best features of Node and it makes building non-framework apps about as easy. Piecemeal isn't a bad thing if each element is easily replaceable - I tend to prefer specialist libraries which get the feature correct for the project rather than having to do everything the "react/angular/%framework%" way. One size fits all is great when you need to quickly on-board lots of people, but it does reduce your flexibility, and ties you directly to that stack. Things are moving very fast in Web Dev land, and I prefer to not be locked in.
That's not an answer if you are a library author. You can't ship only for browserify users. Which leads to frameworks because to reach everyone (including people who don't use a modular loader at all) you have to have 0 dependencies.
The combination of technologies the author suggests we settle on is absurd. Look at the Elm language or On in Clojurescript for JS frameworks with solid computer science behind them.
The only JS frameworks that shouldn't exist are ones cooked up by folks that have little or no theoretical backing in firm comp science. And yeah, AngularJS, I'm talking about you.
I've considered Libraries to be the pieces of code that let us 'paper over browser inconsistencies' to be things like jQuery. Sure, they also gave us some useful tools and plugins to accomplish tasks, but on the core purpose was to be able to write simple javascript code for common functions and have parity across all the major browsers.
Frameworks, I view at as code organization and paradigm tools. They create a more consistent structure for a group of developers to work on a single project. It aids in creating an MV* or other similar paradigm that a team can work within. Even outside of a team environment, Frameworks give you a ... framework, of how your app should be built, rather than just creating your own structure as you go along.
This is the reason why there are so many frameworks vs. libraries. Once you've chosen a library to handle browser inconsistency, as the author mentioned, barely an issue anymore, there is an endless possibility as to how your app should be structured. Some people like two-way data binding, some don't. Some people need extreme DOM performance of leveraging the virtual DOM, others hate the idea of having their html closely bound to their javascript (and framework as often the case).