You probably don't need that hip web framework
char.gd
char.gd
It's not "you ain't gonna need it," it's "you are gonna need it, users will judge you by your fluidity, sure it's overkill right now, but the overhead may be less than the pain of a frontend rewrite since you may need it soon."
I've often thought that if there was a way to gradually codegen a fluent React codebase from Django/Rails/Laravel server-focused frameworks, and move template-by-template into a rich frontend + API, a lot more people would start with those server-focused frameworks, because there wouldn't be a need for a full rewrite. It would be a holy grail for our industry and let us develop business apps way faster. Not an easy problem to solve. Email me if anyone reading this wants to chat though!
For the 10-20% of apps that get built in React/Vue that actually "need it", I believe that 90% of them would be better served by Rails + Turbolinks 5 + Stimulus.
Most of the people who rally behind the SPAs for everything mindset came up at the peak hype moment for React and friends. There's an unfortunate tendency to believe that the thing you're thinking about right now is more important than it actually is.
If you're not working at a large company, you most likely do not need these tools. Nobody is going to come in the night and take them from you, but boy, everyone would iterate a lot faster if they didn't spend so much time bikeshedding and obsessing about state mutation.
Overly complex interfaces are part of the problem.
Too many new projects, libraries, frameworks, etc come around and broadcast "we're Unopinionated!" like that's some great thing.
You cannot, without exception, develop complex software without asserting and extrapolating opinions about design patterns, tools, frameworks, layout, etc somewhere in the stack. Its impossible. You'll end up with an unmaintainable mess.
Medium and Large companies will naturally develop a bunch of internal opinions about things. Internal tooling. CI. Development and Deployment environments. Those are all opinions that get built up over time, based on the experiences of the people who build them. This is fantastic; its how companies like Google and Amazon have reached such massive scale, but how many other companies start failing when they try the same.
Small companies and Startups do not have these opinions. They have to outsource their opinions, at least at the start. A large company might say "yeah we have our own blackboxed JS serverside framework, just use that it'll do logging, tracing, error reporting, its great." Small companies won't have that. So, use Rails, or Phoenix, or something that is highly opinionated. Learn what works. Learn what doesn't.
This is Javascript's fatal flaw. And it is massive. And it still has not been improved years later. There is an extreme lack of opinionated tooling. NextJS has been doing some very interesting work introducing a more productive and opinionated frontend development experience. The backend really has nothing similar; the closest we got was Meteor, and it has/had too many weird technical issues and poor design choices to be considered a good choice. The team behind it then mostly moved to Apollo, which reverted back to championing how unopinionated it is.
Apollo Server would be a great component in a broader, opinionated server-side web framework.
I’ve built a relatively large app this way and found it to be quite nice. Vue works very nicely inside the container elements in the page where I need it, and it’s pretty easy to bootstrap the initial state into the page using the same serializers I do for JSON endpoints, so once it’s rendered users can spent a lot of time on a particular screen without any further page loads.
The last bit that’s nice is bundle size. It’s not too hard to split bundles based on unique entry pages, so you can end up with something like 30kb of “global” JS and then a second bundle for the big meaty pages that may range from 20 - 200kb. With caching that means 90% of screens have a very small payload and load really fast, and the rest have a slightly slower first load and then the same perf profile.
This has been a highly productive way to work, I’m surprised that it’s not written about more often.
Quite often there isn't a reason to have SPA routing. But that doesn't mean you can't enjoy lots of benefits of the fronted framework without the unneeded complexity solving something you don't really need in the first place.
``` Singe file component 1: <template for component 1> <script for component 1>
Single file component 2: <template for component 2> <script for component 2> ```
``` {% include singlefilecomponent1 %} {% include singlefilecomponent2 %} ```
If you need server side rendering that could be a sign that what you have is a lot of public indexable information and that most often describes a traditional web site instead. In that case your "old school" rails or laravel solutions are almost definitely a better choice.
/rant.
I'm all for simplicity... but if you are developing a large web application, you probably would benefit from "heavy" web frameworks (they're not really that bad though.) What "large" is can be debated, but I'd argue most pages we use today are "large" enough. HN is a good exception. GitHub, large publications, webmail, online shops, anything dealing with realtime data... It's probably worth it.
Clearly it wasn't bad enough to drive everyone off the platform, but there's no way you'll convince me that that was a better system that a well-written SPA built with modern tools.
When was this, in the 80's? Web productivity is just catching up to RAD platforms like Visual Basic in the 90's and still a lot more complicated than a good UI framework like Gtk/Qt.
To listen to him blindly is ignorant but to ignore him is just as perilous.
Then you're in the 1% of people that use these tools and actually need them. The point of articles like this isn't that they never make sense and nobody needs them, it's that they're way over used where they aren't needed.
Bingo! Engineers love to change things like Scotty said, but they also blather on about if it aint broke, dont fix it?
I wish I could rebuild the home page in server-rendered HTML, a minimal hand-written set of JS and CSS for top-of page plus a fairly lean set for everything else, cut down to two fonts (headings and body text), preload the blocking assets, defer non-blocking assets, put pages and everything into object storage + CDN, and just... I dunno... serve our users. Any build tools or automation or content editor tools should lie on top of any of the above (Most of the "immersion" or whatever should remain intact, aside from what I see as bonuses: minor improvements to consistency in type and presentation).
You questioned why we keep seeing these arguments. Perhaps it’s because nobody on the other side cares to listen?
The “most appropriate tool for the job” is exactly what the article is arguing for.
There is a tendency for mgmt to sign up engineers to a vision quest with pre-established non-negotiable requirements whereby the customer expects what would be tantamount to solving all the world's problems in one easy to use, intuitive SPA that 'just works, always'. This is a big factor in the endless new framework releases, mutually-exclusive complexities and vulnerabilities.
But, I also don’t write mobile apps. I’m dealing with desktop and the rules are different there.
For instance, I really don’t want to take the time to learn Laravel. I get my fastest work done with React and a turnkey serverless solution.
Here's some heuristics I like:
If nearly all of your application's data presentation/processing needs map cleanly to HTTP/REST semantics for the various entities in the system... you probably don't.
If your UX involves representing/manipulating the same data in several different ways on the page and this data is going to change, especially in ways that don't map cleanly to HTTP semantics, you should consider that you do need the hip framework. Probability rises depending on how frequently user interactions produce different views of the data.
If your data is a headache to represent in HTML, you probably do (also, if you don't have an adequate general automated way to represent your data in HTML from some model description, you will likely either gravitate to solving this problem one way or another, or gravitate to a hip front-end framework).
If you ask yourself what problem you're solving with your front-end framework, and the answer either includes the word "modern" or another adjective describing a merit you aren't exactly sure relates to a specific problem to be solved, then you probably can't yet make an informed decision about whether you need that hip web framework. But, OTOH, making uninformed decisions is one way of getting the experience necessary to make informed ones, so...
The idea is that you only have to worry about one environment (the browser - yeah, I get the irony) and one deployment instead of multiple (the former plus backend deployment, monitoring, etc.).
The second you start worrying about SSR (server side rendering) you’re suddenly taking on the complexity of writing a backend again.
I've been looking for quite some time for "front-end tooling for back-end devs" without success - there are some great frameworks like Postgrest or Hasura which take you from Database through to API interface, but then you're faced with raw Javascript and all that pain synchronising browser state with the API via a web-worker. My attempts to use Vue & React have just resulted in the exchange of one kind of complexity (raw Javascript state change) with another (learning the framework).
I'm all ears, if anyone has used anything (framework, IDE, WYSIWYG editor, some SAAS app, anything) that simplifies the journey from OpenAPI spec to a webpage with a UI that changes as the API returns things.
No, but I bet your last version will have. Right before it fades into obsolescence, never to be seen again.
The fact these recurring shitposts always began their rants with how freaking fast things are moving (in the speed they perceived) and that they couldn't keep it up strongly suggested that they're outta the loop for a long time or they aren't good frontends in the first place. It's also really harmful to the industry; I've seen a few frontend wannabes backing out because of all these uncalled for FUDs creating mental barriers for newcomers while I've repetitively tried to assure them it's really not that unstable in recent years.