View profile

Framework-Free JavaScript: Why It Matters

Frameworks like Vue and Express help you ship code faster and avoid architectural design mistakes. Bu
Framework-Free JavaScript: Why It Matters
Frameworks like Vue and Express help you ship code faster and avoid architectural design mistakes. But there’s a tradeoff in most frameworks that isn’t discussed very often: portability.

Zach Leatherman
📢📢 Framework independent design systems 📢📢

Ruthless reduction of dependencies in your design system will increase your code’s portability and longevity, y’all. https://t.co/Nnyk1ItumK
12:17 PM - 10 Jul 2019
Let’s make this example more concrete. At my day job, most clients talk to our backend services via HTTP, so our backend services are all written in Express. But we recently wanted to allow accessing a backend function via websocket, so we could add a progress bar. Time for a massive refactor?
Actually, no. I needed to wire up a websocket API, but we didn’t need to change the business logic at all. That’s because all our business logic is in functions that share the same function signature, and that signature doesn’t depend on any framework.

What all our business logic looks like. Drops in to any framework with minimal fuss
What all our business logic looks like. Drops in to any framework with minimal fuss
When your business logic becomes dependent on Express or SocketIO or Vue, you lose portability. You can’t plug in a function that depends on Express req into a Websocket API or into AWS Lambda without rewriting. But if your function takes a general glob of parameters, you can drop your function into any framework with a thin transformation layer.
Going framework-free has some serious advantages when it comes to code portability. Giving your business logic a clean framework-free API means you will worry a lot less about Vue vs React, HTTP vs Websocket, or JSON vs XML vs protobuf.
This Week's Tutorials
Did you enjoy this issue?
Mastering JavaScript Tutorials

Mastering JavaScript Tutorials

If you don't want these updates anymore, please unsubscribe here
If you were forwarded this newsletter and you like it, you can subscribe here
Powered by Revue