Node has changed the way we write applications at &yet. Not just sort of changed, in fact, if it didn’t sound so cliché I would use “revolutionized” to describe it.
How so? Well, if I were forced to pare it down to a single word it’d be “modularity.”
Annoyingly, the word “modular” doesn't really mean much. Of course every developer strives to write modular code, so let’s disambiguate it a bit.
Modularity across applications
Within an application, splitting things into separate files with singular concerns is a great start. But as a Node consulting company we write lots of different applications many of which share similar functionality. The logical next level of code reuse and modularity is being able to easily reuse code across applications as well.
This isn’t a new idea, of course. In the case of Node, this is where npm comes into play. It does a great job of limiting “dependency hell” that comes from different packages requiring different versions of the same dependencies, as made possible by adhering to semantic versioning. Max Ogden wrote a nice, quick explainer of nested dependencies à la npm.
This means even really simple and small modules can be reused across applications and less unique code has to be generated for a given project.
The net result is faster development cycles, happier developers, and lower total costs for our clients. Modularity lets us put the bulk of our effort into the real problems the software we’re building aims to solve, instead of solving the same problems over and over.
Development becomes more like building with Lego™ where you snap small pieces of functionality together to create something interesting. You’ve got pieces of various shapes, sizes and functionality that, when placed into the hands of talented developers, can be assembled into incredibly diverse and amazing things.
By contrast, larger toolsets feel more like Duplo™ blocks. They might get you there even quicker, but ultimately what’s created tends to feel clunky and less flexible. Great for prototyping, perhaps, but you simply lack the level of resolution required for creating a beautiful finished product that can very simply evolve over time.
Node-flavored frontend systems
So what about browser code?
Too often the wild west that is the frontend makes backend developers squirm. The seemingly infinite options of frameworks, module systems, package managers, and philosophies are often nothing short of discouraging.
Historically, the frontend was fairly simple. You’d drop in
<script src="jquery.js"></script>, do a few simple rollover effects, init some jQuery plugins and be happy. These days users expect a lot more. We’re treating the frontend as a runtime and we’re using it to build richly interactive Native Web Apps.
Painting with broad strokes, we see that folks with a Rails background are drawn to Ember, folks from .NET, PHP, and Flex may feel more at home in Angular, and hardcore FRP-types are drawn to things like Om.
What do Node People™ do on the frontend?
Node devs tend to be minimalists, DIY'ers, Lego™ artists, if you will. We want a nice set of tools and pieces at our disposal that we can compose into whatever creation we imagine.
If you’ve bought into Node’s small module paradigm, stuff like Ember, Angular, and even jQuery can feel a bit like excessively large Duplo™ blocks.
To be clear, this doesn’t make them bad. I’m glad they exist. Clearly, they empower scores of developers to create some great things on the frontend.
Browserify certainly comes to mind. It lets you write code in the same CommonJS module format you’re used to from Node, run them through Browserify and have them mostly Just Work™. Fellow Yeti Philip Roberts wrote a great intro to npm, Browserify, and modules in the Ampersand.js user guides.
If you’ve been around clientside development for a while you’ve certainly heard of Backbone.js. It shares a strong conceptual bond with Node, as seen in the following excerpt from Backbone’s docs:
We see the same themes of freedom, flexibility, and do-it-yourself-ness common in the Node community. The only trouble is, from a structure perspective some of the bundling and coupling of Backbone diverges a bit from a totally npm-ified approach. We built on Backbone for a long time at &yet. Eventually as I’ve previously discussed these differences led us to extract/dissect/improve various components in Backbone and publish them all as individual modules on npm. For the sake of having unified name and documentation we called it Ampersand.js.
We’ve been thrilled to see so many of these modules used on their own and paired with all sort of other things. This is precisely the sort of thing we were hoping for. We don’t want to build and maintain some giant monolithic framework and sell everyone on using it.
For us, as long-term Node developers, seeing people mix and match our modules into their systems is a huge validation of our work of bringing the same modularized approaches we’ve fallen in love with on the backend to the frontend.
So what’s the Node frontend framework of choice? None.
Of course we think Ampersand modules are a great match for building frontends for our Node applications. But for Ampersand we use the term "framework" very loosely. As demonstrated by how people are using it, it's really is just a loosely coupled set of tools.
In the end, the only constant in our field is change. We simply cannot, in good conscience, assert that any single toolset (even our own) is the only valid approach. It’s just not how we think development should work.
For a more detailed breakdown of several popular frameworks, read my Opinionated Rundown of JS Frameworks post.
What else has our attention?
Like you, we’re always intrigued by our ever-evolving craft, but we have a unique burden to carry. As a consulting company, we don’t just ship one product, we’re responsibile for shipping a lot of apps for a lot of different use cases and companies. As a result, we’re forced to keep our feet on the ground. We’re drawn to things that help us ship great stuff faster as a team.
On the short-list of things that have our intense interest is React. While we have a nice Backbone-esque view-layer in ampersand-view there are aspects of React that are extremely appealing in a view-layer and we’re increasingly building things that pair Ampersand with React and like what we see so far.
Another is WebPack. WebPack is an alternative to Browserify that also does a whole lot more. It can do most of what you might do with Browserify while also adding features from tools like moonboots, Grunt, Gulp, etc. Essentially, it’s a very complete frontend build system in a nice, coherent, extensible package. It seems extremely stable and well supported. Of special interest is the WebPack Dev Server and the React Component Hot Loader.
What does the future hold for the frontend?
Who knows?! But that doesn’t leave us powerless. Instead of trying to predict it, we try to build modular systems that are optimized for change.
Remember the part earlier on about how we’re also a Node consulting company? It’s true &yet has been helping Node developers from smaller teams to enterprise clients find custom solutions for their Node apps for the past five years.
Seaworthy puts you right in front of &yet’s veteran team of end-to-end Node experts, offering support through Navigator Office Hours and Lighthouse Architecture Audits.
You might also enjoy reading:
- Opinionated rundown of JS frameworks
- Optimize for change. It’s the only constant.
- Backbone.js and Capsule and Thoonk, oh my! A scalable realtime architecture
- Re-using Backbone.js Models on the server with Node.js and Socket.io to build real-time apps
- Efficient, consistent client-side apps with optimistic concurrency & JSON patch: part II