245 points · by nikolalsvk · 6y ago · 272 comments
React emerged in 2013, by 2014 the hype was at full swing, and by 2015 React "won" the framework battle.
It's been 5+ years since then, and React JavaScript world was remarkably stable. Fashion changes were largely superficial: React.createClass vs ES classes, Heavy use of Decorators vs not using them, and now Hooks. These were mostly cosmetic choices, and if your team picked the wrong side they could migrate over relatively painlessly or straight up ignore the issues for years.
On the other side of spectrum we have Ember that maintained backward compatibility and ease of upgrades since ~2013, Angular 2+ is doing the same for many years, too.
The whole "JavaScript fatigue" meme has to go.
> by 2015 React "won" the framework battle.
Things have calmed down now. Its better, and has been for a couple years (not 5+ years). But, this isn't a battle. Its not a war. Just because things are calm now, doesn't mean they won't go crazy again.
The core of the issue has nothing to do with technology, or the frameworks, or programming languages. It has everything to do with how you, I, and Dave, who's reading this right now, respond when these new technologies come out. Just. Say. No. Play with them. Build toy projects. Give feedback. But for the love of God, at the end of the day, you Say No. No, we will not be integrating this. Looks cool though, we'll circle back in a year and see what progress you've made.
> Let us quickly travel back in time to 2016 ... If you are using a JavaScript framework or want to use a framework, Angular.js is probably something you would choose
Angula.JS was in the "failed experiment" category by 2016. The announcement that Angular2 was a rewrite (in 2014) was proof of that.
So in 2016 Angular was still really new and React had eaten AngularJS's market share.
In 2016, the vast majority of recruitment offers I received were Angular, or jQuery/javascript. And while HN (thankfully) was all about React and whatnot, this situation continued for a good few years. Angular was the safe choice which I guess the PM's wouldn't get fired for. I remember many, many conversations with various recruiters where I told them I refused to do Angular projects, but I'd love to work on a React or even 'vanilla' JS project.
I'd say that after React became 'standard' on HN (around the time Vue popped up I suppose?), it took at least 2 years before I started getting emails and calls from people looking for React work.
Currently hoping this will happen with Elixir but not getting my hopes up :). Still, not having this sword of damocles hanging over my head that 'maybe I should learn Angular' is real nice.
Maybe you werent paying attention then.
[0]http://2016.stateofjs.com/2016/frontend/. From that link:
> What's more, there's just so many options: Do you use React or Angular 2? Do you really need Webpack? And what's this month's recommended way of dealing with CSS?
> Like you, I spent far too many hours reading about all this, and at the end I still wasn't sure. So I decided to create a survey to see what everybody else thought. It seems like I must've hit a nerve, because I got over 9000 answers in just over two weeks!
Well, JavaScript was really horrible when it came out. It was just about the worst major programming language ever made. It sort of reminds me of an interpreter I threw together for a programming language I invented when I was in high school, when I really didn't get any aspect of programming language design, and I based it on a misunderstanding of Lisp.
Given its central role, lots of people used JavaScript, and lots of smart people tried to fix it. Every few years, it'd get a lot better. It actually made sense to rewrite everything -- you got that multi-fold improvement in productivity going 1995 JS to 2000 JS, 2005 JS to 2010 JS, and so on. I mean, with each iteration, it was still obnoxiously bad, but it was that much less bad.
It looked like an exponential growth curve for a while, but you always knew it was an S-curve -- you hit an inflection point when you reach the level of competently-designed programming languages.
At some point in the past five years, JavaScript stopped being really bad. I mean, it's no Python, but it's at least within spitting range. Heck, it's better than Java. I won't even lose 2x productivity writing in JavaScript over best-of-breed languages, at least core language (ecosystem aside -- there is no numpy/scipy/pylab -- but that will come too).
With that, rewrites every five years no longer make sense. Unless there's some fundamental progress in computing, I expect JavaScript code I write today may still be used in 20 years. That's not something I would have said in 2010 or 2000.
I'm using it now at my work and I'm surprised how much info I'm getting compared to whatever JS is throwing at me.
There were many such systems in the past. CoffeeScript was a big improvement over 2010 JavaScript. Before that was GWT, which was sooo much nicer than 2006-era JavaScript. I could list a bunch of others. If you used any of them, you're now stuck with a legacy system(+), and you'll find fewer and fewer people able to read/write your code, and otherwise.
I'm also not a big fan of static typing. And if you do static typing, you should at least do it properly, which is not what TypeScript does.
Types should be things like "This is an integer between 0 and 100," "Meters/second," or similar. We've known this for a long time. Ada is now 40 years old and was mandated for military work since if you added feet and inches without a conversion, that was a problem, and that resulted in more robust systems (TypeScript would make them both of type "number" and never catch the error). If you tried to have 120% of your fuel tank full, you'd violate an assertion as well. Those were turned on in dev and in your test suite (but generally turned off in your deployment system, which was running on a 33MHz CPU if you were lucky).
C++ templates let you define things like "This is a list of lengths, in meters." Duck types languages like Python won't do this statically, but it's easy enough to do dynamically; while you won't catch errors at compile-time, at run-time, you'll get a clear exception.
(+) Standard disclaimers apply.
Use as many hooks and context as possible and keep your redux store as simple as you possibly can because if you end up with a deprecated state management library (redux-thunk, sagas, easy-peasy) replacing that is like pulling gum out of hair.
If you add up the time spent working around typescript errors when dealing with state, it's possible for it to be more time than you need to rewrite the entire app.
For backend work then yes, I'd say doing a singleton or an abstract class in typescript makes more sense in hardening your API code and even making it more readable too.
The additional compilation complexity is not worth the small benefits of TypeScript, in my opinion. An even better language, though? I'm in.
I still prefer using other languages when I can (back-end), but hypothetically, if I had to choose between Ruby and Typescript I'd actually go for the latter. And I like Ruby!
* Python has async/await. It's not as pleasant as goroutines, but it exists and is presumably about as pleasant as async/await in TS, at least assuming you're using or not using the type system in both cases.
* Python has tuple/list/iterable destructuring. What is the specific limitation here? Maybe key/value destructuring?
* What's python's lambda weirdness? The single expression limitation? I agree that's tedious, albeit you can do a lot with a single expression (but not handling exceptions).
* JSON support. What's wrong with Python's JSON support? I mean, the type system can't model recursive types yet and that's super annoying, but the JSON stdlib seems fine. JSON maps pretty neatly onto Python dict/list/str/int/float/None/etc types.
* What are proxies and why are they desirable? Genuinely curious.
Ultimately no one likes rewriting code and is typically under-estimated since developers mentally trivialize previous work rather than a greenfield affair.
But there simply hasn't been a paradigm shift in UI after that (and I doubt there will anytime soon, it's not often a whole new UI paradigm that changes stuff the way MVC and FRP have done is popularised).
Stuff like Vue and Svelte are simply attempts at optimising or improving the reactive approach, but is basically still fundamentally the same idea. Someone versed in React would easily move over.
React had the right idea, just make view management simple, don't force some bullshit IoC container on Javascript and that's it. If you want IoC that's your problem.
Ultimately the problem is that nothing replaces React natively in web API. A tool such as React shouldn't be useful anymore and Web Components isn't as ubiquitous as it was envisioned to be. In fact, I've never worked in any business that used Web Components.
But the biggest issues are on the node.js side and all the complex pipelines put in place in order to fix front-end development. In fine, the tools that will be successful are the ones that will still be actively maintained 5 years from now, and most of the libs/projects will not.
The reason React has done so well, is that core team members had deeper CS experience, understood other paradigms for UI development and understood that the best state of the art for UI right now, is a render loop. If you converted it to C, squinted at it long enough you would see the very old, very tried and very true Windows render loop in it. They took a proven pattern, bolted it to the virtual DOM and brought it to the web. They did not perform miracles, they stuck to what has been proven to work. Well the virtual DOM was a pretty clever hack, but the rest is UI dev 101. The problem was most the JS developers at the time, never had that back experience of desktop UI development and a good deal of them had come to development by way of learning HTML, CSS and then bits and pieces of JS as they needed to.
The javascript framework fatigue meme was born during the early days of ember, backbone, angular 1, knockoutjs and meteor. Sometime between 2016 and 2017 was when it should have been put to rest.
"You don't know JS": https://github.com/getify/You-Dont-Know-JS
"How browsers work": https://www.html5rocks.com/en/tutorials/internals/howbrowser...
"High performance browser networking": https://hpbn.co/
I also want to give mention to JavaScript: The Good Parts by Douglas Crockford[1], and his new book, How JavaScript Workers[2]
[0]: https://eloquentjavascript.net/
I've been wondering lately, as I'm moving (back) into a JavaScript-heavy stack (it's been... 4-5 years for me), is this book still relevant in the face of 12 years of JavaScript language development?
But it doesn't really give a strong foundation on understanding the language. It's more like "I know mainstream C-inspired languages, and JS often burns me with its weird quirks like how the this keyword works, I just want to avoid getting burned". But it doesn't really embrace JS itself, just sort of acknowledges that you will be forced to use it in the web so you may as well at least learn the "good" parts.
It's still decent at that purpose, but for really strong competency in JS I can also vouch for the Eloquent JS book and the You Don't Know JS series (I've only read the first edition, a new edition is partially complete and available online).
ES6 and ES7 are widely supported now and are much better languages IMO.
Knowing the dead ends and the history behind them is nice, but I spent a lot of brain power on the dead ends that Eloquent put towards better use.
We're also talking a small book vs a tome of knowledge, but the philosophy is different regardless of size.
Today this book makes a good companion but not a great single source reference.
Sometimes I jokingly call htmx "web 1.1 tech", but increasingly I wonder if I'm really joking.
Fast forward, I understand nothing of the website being developed in React for my startup. The othe technical cofounder does grok it, but I could not lend a hand and can barely even supervise the outside help we brought. I like to think of myself as well-versed in a generalist manner. I can hack a custom sparse matrix (with a very particular structure I was able to prove an iteration for) inversion algorithm, but I understand nothing about painting the background the correct shade of blue!
Now...I'm lost. Every time I poke at the frontend, I get lost again. >10 years as a backend developer of various stripes, three of those in Node even...still lost.
Anyone who really grokked REST would never say it's nonsense to use with a JSON API.
Let me show you my reasoning:
JSON is not a hypertext, even if you include URLs in it. [0]
HATEOAS requires a hypertext (see the first word of the acronym)
HATEOAS is "an essential part of the of the 'uniform interface' feature of REST" [1]
Therefore a JSON API, even with some embedded URLs, using multiple HTTP Methods and following a traditional hierarchical path scheme, is not REST-ful.
[0] - A sufficiently advanced client could interpret a JSON-encoded hypertext in a general, uniform manner. However, in practice, this is almost never the case.
On top of that, JSON-LD is still mainly focused on networked object graph serialization. Unfortunately it manages to be a complex specification without providing the functionality that HTML came with out of the gates as a hypertext in an obvious manner.
HTML is a good-enough-to-great hypertext, we should probably stick with it.
I'm sorry, I couldn't resist the pun.
Copying anything by hand while he explains it. With minimal package count.
And always use a code generator later like when you start a Typescript/JS project, because you can do so many little things wrong on your own while you don't know enough.
There are reasons to use fetch and hooks, and the article seems to relegate them to being unnecessary 'trends' without doing what it suggests, actually evaluating what value they might have...
In React you can use hooks with a class heavy application and still be just fine / get the benefits of hooks in a given component(s).
If you want to use fetch, that also is hardly an ordeal to do / should not be a big cognitive load for anyone.
I get it, resume driven development bad, we get it, we hear it in opinion pieces all the time. Also you should think about it before rewriting an entire application. Yup, that makes sense.
But here we have examples of small changes that are pretty light weight... and no effort is made to do exactly what it suggests, evaluate those choices.
So let me say something which is true, but totally against the spirit of this article: there should be 10x as many (!) tutorials about how to implement everything in React using hooks.
My reasoning is pretty simple. For a new learner, unless you have a compelling counter example needing classes, you should use hooks. That’s what you should start off learning and that should be your go-to.
But if you click away from this comment, right now, go to Google, and search for tutorials, despite this “best practice” advice, you’ll see an unholy mess of tutorials citing classes, with a few using hooks as though it’s some kind of new fangled, “out there” tech. I’m talking in the top 10 search results on Google’s front page. In 2020, long after the React team has introduced and explained them.
Look, it’s simple. Aside from their other advantages, hooks make it easier to learn React, with less boilerplate. As a result, it would be better if beginner tutorials were updated to use them. Most have not been.
But I see this complaint regularly, where hooks are trotted out as some kind of example of silly React maximalism. If you learned React then hooks are only going to take up like 2% of the total time budget you’ve already dedicated to learning the framework. It’s not hard, and it’s nothing like learning, say, Haskell. Using hooks to make cheap shots against overcomplicated JS frameworks is unfair, when they’re not overcomplicated and have a perfectly valid reason to exist.
I've got class heavy applications that will stay class heavy, but almost all new components are hooks and they're quick to write, evaluate what is going on, and work with.
I strongly dislike the create-react-app project because it abstracts everything away.
https://reactjs.org/docs/hooks-intro.html
For react hooks typescript: sorry, I can't. This is a pretty good example of the problem, because I just searched Google's first page of results for react hooks typescript tutuorial, and they were all bad.
3 of very top results seemed to be a derivative of each other, where they presented a list of concepts, which is not really relevant in teaching you to use them.
Some of the other ones were a very slight improvement, but still not good enough that I'd feel very comfortable recommending them.
On the 1st 2 pages of results, this was the best result I found for react and typescript (not hooks), which at least addresses the topic directly with relevant code.
https://www.educative.io/blog/react-and-typescript
Also I want to call out this example for being especially ridiculous, because it titles itself as "Using React Hooks with Typescript" and then doesn't actually use any Typescript!
https://blog.usejournal.com/using-react-hooks-with-typescrip...
Anyway, this nicely illustrates the problem. I may try to write a tutorial on this myself, after seeing how bad these are. But for now, this is what's out there.
That's the point of it, really. CRA sets up your build (webpack) and test runner (jest). Has nothing to do with hooks. I'd strongly suggest using it, unless you're interested in learning how all that stuff works.
The entire article could be summed up with: > Is it solving your problem, and what is the cost?
And it cuts both ways. Change for the sake of change is bad. But so is stagnation for the sake of stagnation.
Picking the best tool for the job and continuous improvement are the closest thing to universal advise in front-end land.
The "everything new is bad" rhetoric is getting exhausting.
Fetch is a very poor standard if you compare it to high-level HTTP clients that have been around since 2010-ish. However it's author states that it wasn't intended as a general purpose HTTP library but rather a low level tool that-level tools can make use of.
So yes: you probably don't want to use fetch directly, making Headers objects using obscure methods, manually encoding query strings, and telling your HTTP client that you'd like to treat application/json as JSON and decode it. Use a library.
If a new framework/library/paradigm comes in looking really hyped up and cool, my automatic question is "well what's the catch?" There always is a real caveat in there somewhere. Usually the new shiny thing solves one class of problems at the cost of making a different class of problems harder to solve. The important question isn't what the shiny thing makes easier, because everybody and their grandmother is telling you what that is. The important question is what that shiny thing makes harder.
React, for example, is awkward for continuous, time-stepped state (games) because what you see is an interpolation of many objects transitioning between many states. It's not that the abstraction can't work, it's that it's a clumsy one to apply. Thankfully the vast majority of web apps don't have this issue, so it's usually fine, until you try to make something real-time.
Same story with NoSQL databases. The canonical issue there is that joins are much more expensive. So how much do you need those joins? Turns out some non-trivial number of scenarios are fine without joins, but for CRUD apps, turns out a substantial number of things are easier with joins.
The article though takes two pretty low cost / easy to use bits of tech (fetch, hooks) ... and relegates them to being "trends" without really evaluating them.
I don’t think we get it.
[Edit: Also, anecdote: before JS, I was mostly a C# developer, and the churn there was at least as bad, maybe worse in my personal experience. Over 15 years of my career, I had to learn ASP, then ASP.NET, and in the Windows app world, we went from WinForms to XAML, then .NET Core came out, and things shifted again... See Rails' history for more examples of churn. It's not like every other platform is a paragon of stability. Clojure is a bulwark of stability compared to just about anything else, but it's hardly fair to hold the front-end community up against that gold standard...]
I wouldn't re-write an existing app to use fetch or hooks, but now that I've taken the time to learn, I'm happy I did. The vast majority of the mental work was done by other people, and I get to reap the benefits. The alternative to this is stagnation, and relegation to legacy systems... I guess the author wishes they could work in COBOL?
Yeah it’s prevalent, and if we resemble other shitty ecosystems then we need to introspect.
The whole Apple client-dev ecosystem is still in the process of changing to Swift, and Apple is trying to develop SwiftUI into a compelling layer alongside/atop {App,UI}Kit. It's not just a web/JS challenge.
Client dev is always changing.
Frontend is knee deep in the process of creating cargo cult devs en masse, and I’m depressed by all of this.
https://github.com/reduxjs/redux/pull/3708
Unfortunately, the community overruled me and the docs no longer show how to test Redux apps with enzyme. It only shows Kent’s “react testing library”. The library authors are complicit in this. Rather than showing the pros and cons of both, the trends are being pushed, leading people to falsely believe they must rewrite their whole code base in my experience.
The troubling part for me is often those creating these trends may be working on a very different type of app. When you’re writing something complicated, and the ecosystem is dominated by patterns (also preached by Kent) that work best in simpler apps like “only write integration tests” it can be frustrating.
If Kent thought enzyme promoted anti patterns he could have technically made a docs PR or just written a thin layer on top of enzyme. Now we have yet another divisive issue. Getting him early access to new react apis and officially recommending RTL in the react docs (while he sells his training videos) make it sit worse with me. It doesn’t feel like the trends are always based on the merits, it feels more like “not invented here” and “nepotism” driving some of these trends for sure.
Right now, we have an entire docs page on how to use Immutable.js with Redux [0]. That page was submitted by a user who cared about Immutable.js. They took the time and effort to write it, and the information is useful.
However, at this point we now actively recommend _against_ using Immutable.js [1], and _do_ recommend using Immer [2]. So, that docs page will be removed in the near future, because it now goes against our recommendations.
As I said in that thread, I personally would not recommend Enzyme at this point. Doesn't mean it's useless, or that people shouldn't use it at all, but it's not something I would use or tell people to use. Given the focus of that specific Redux testing docs page, I also don't see a _need_ to show both methods at once.
I agree that the ecosystem shouldn't just chase new shiny, but there's also a lot to be said for actually keeping docs and recommendations up to date. I understand your concern in this particular case, but it also feels like you're extrapolating rather broadly from one specific issue.
It's also the case that sometimes creating _new_ tools is the right answer. Yarn's release forced NPM to wake up from stagnation. There were dozens of Flux libraries when Redux came out. In the case of RTL, Kent created something because he saw a need, the community has seen that it's useful, and he's well within his rights to promote the tool that he created.
[0] https://redux.js.org/recipes/using-immutablejs-with-redux
[1] https://redux.js.org/style-guide/style-guide#use-plain-javas...
[2] https://redux.js.org/style-guide/style-guide#use-immer-for-w...
I’m not arguing that you’re violating anyone’s “rights” here, I’m arguing some of these trends feel like nepotism. The fact Redux and React are seemingly abandoning official support of Enzyme, after years of recommending it, after some of its users have written 100s of thousands of tests, is my issue, and I feel like is directly related the article about "trends" OP posted about.
In that time, have you stopped to consider that perhaps the incredibly narrow "legacy maintenance" use case you've been bandying about (which isn't enough to justify dedicated documentation space in a project that isn't enzyme) and your overly insulting insinuations about the authors of popular libraries are not a winning combination?
I don't know if it's "not invented here" syndrome so much as people use tools based on people, not always just merit.
Kent and Adam had similar self-promotion engines running with long-form free video tutorials and strong social media presence, blog posts online, etc. Perhaps this style of promotion more of a tool more than anything is effective at changing the status-quo tools?
(Not saying they're necessarily better or worse, just my observation of why they may have become popular)
I can not stop the cycle. You can not stop the cycle. All we can do is notice it and let it pass and hope some SNT will eventually be useful instead of pure hype. Oh, and also, avoid joining any cults: https://www.infoworld.com/article/3440104/10-software-develo....
Thanks!
BTW: I did write a bit about this phenomenon, here: https://medium.com/chrismarshallny/concrete-galoshes-a5798a5... (Scroll down to "It's Not An Either/Or Choice")
I wonder how much of that "innovation" really makes a difference to users. As a programmer, I get a bit cynical about having 50 ways to do the exact same thing. What is possible today that was very hard to do 10 years ago in web dev land?
If we think about users first, maybe we can feel a bit less guilty of not having deployed React Hooks to prod yet?
CSS Grid / Flexbox - Flexbox was defined in 2009, and was added to browsers about 10 years ago and iterated since. It was literally in the first public version of Chrome. This is not some new tech that's blindsided everyone. Grid is a couple of years old.
React - First released 7 years ago and iterated since. Reasonably mainstream for 5 years. That's not a very dramatic change.
WASM - Around for a few years now in browsers but tooling for different languages is still patchy. Entirely unnecessary for 99.9% of web development. Most people are still in the "use it because it's cool" phase rather than "use it because it's actually useful".
extensions to the web API - Various, obviously. Can't really argue this point.
lots of new JS features - Various, but not actually very fast moving with new features. Most things are made available earlier through transpilers, so you can use a feature without it being in mainstream JS engines if you want to. Can't really blame the web if you make that choice though.
countless frameworks - You don't need to learn them all. Pick any number to use between zero and all of them depending on how much time you want to spend learning frameworks. Again, this is a choice, and if you're finding it overwhelming it's because you picked the wrong number of frameworks to learn.
plugins and build tools - Same answer again. Pick something and learn it. Update your skills every few years if you think your tooling is holding you back.
more homogeneity between browsers - This reduces complexity. To complain about that in a list of things to taking up your time is weird.
The web isn't that fast moving. I completely agree with your point about focusing on things that benefit the user though. I would argue that frameworks and build tools that enable me to iterate features faster do that though.
Declaratively writing components and reusing behavior (e.g., hooks) across components/applications was basically impossible with the tools of 10 years ago. The benefit to the user is more stable interfaces and a faster release rate.
Reusable components were already there using jquery plugins. Everyone used them and they were easy to use and easy to install. They were deployed as a single file, with optional CSS.
Try writing a reusable component now. You have to target all major frameworks and tooling.
I write reusable components all the time inside my codebases. I never have to target anything except the stack I'm using for my project.
Doubt. Websites are constantly redesigning their interfaces so that they can use the latest trendy technology.
Hooks are a tough one (they're very specific to reactive frameworks), but we did have other kinds of abstractions that provided similar benefits.
It makes a huge difference in terms of usability. Some sites are just plain awful to experience now. Not to mention battery hogs on mobile.
I legitimately don't care about React hooks though one way or another and it's a bizarre thing to draw a line at.
Is that for the user, I don't think they care, but they do get changes faster / more features because I'm not pulling my hair out over tables....
Really? I would argue it’s building software.
> This craft is in its infancy
We’ve been building software since ... dunno ... 1950s? 1960s?
> our profession borders on complete incompetence when it comes to predictably building usable tools at a reasonable budget
This is probably true, but I suspect chasing new tools isn’t the solution. I’ve seen a lot of very much with it development teams fail at building stuff because they couldn’t get their shiny new stuff to work predictably.
> If someone is "tired" of this process it might be time to consider another profession.
On the front end, yes, it’s probably par for the course. I suspect it’s because front end development is even more removed from rigorous engineering practice than back end development.
On the back end, however, lots of stuff is still built in Java and C(++) and it all works reasonably well.
It’s just not very exciting.
It's a meta analysis on the new tech that can be done in less than a day, rather than spending weeks mastering it just to determine if it fits in your tech stack.
Focus is everything. The universe is too infinite to learn everything.
Of course, one has to be mindful about the transition. You cannot stop business, but you can take a little extra time whenever there's need to modify a section to improve quality (both code and ui). Actually that's why we chose vue, it allowed to a progressive migration out of angular.
BTW, someone had the "great" idea of not using a framework for an internal admin portal. It turned immediately into a huge ball of mud.
It's never the case that you "don't use a framework" for something like that. You'll use a framework, alright. The choice is between using something well-built based on best practises as we know them, or... building it yourself. Other than in very rare circumstances, I fail to see the point of reinventing that wheel. UI frameworks (web front-end or not) are a quagmire of edge cases and other infinite time sinks.
I really like react, and I'm glad to see other environments adopting a React-like approach to UI development (Apple's SwiftUI and Android's Jetpack Compose, to name two)
First, it is naive to think the new framework does not have any problems. Marketing would like you to think everything is perfect but if that ever happened, why do we have new frameworks all the time?
Second, you will pay with decreased productivity while you are learning the new framework and you are not guaranteed to be more productive than with the old framework.
Third, due to decreased initial productivity, even if you potentially get more productive with new framework, it is going to take time to realize any benefits. If you are switching the framework too frequently you are cutting yourself off from the benefits.
Just don't decide to build your new production application with a framework that you don't know or did little more than hello world.
Since its introduction in late 2016 Angular 2+ has had no major changes on the scale of hooks and is unlikely to introduce them, because its target audience - large companies making large-scale applications is fairly conservative.
Vue I think had one measurably large syntax shift around v2.5(or 2.6) and will have another one with 3.0, but that's about it.
Meanwhile in React every year there's this new convention that isn't explicitly mandatory, but for some reason "cooler" than the previous one.
All this won't matter once the next gen compiler-frameworks reach maturity. My take is that hooks are React's swan song.
As someone who has used Angular 2 since beta, I can tell you, it's been a bumpy ride nonetheless.
> its target audience - large companies making large-scale applications - is fairly conservative
React was built for Facebook, which is a large company building a large-scale application.
> All this won't matter once the next gen compiler-frameworks reach maturity.
And here I am using HTML and CSS with tiny sprinkles of JS for most websites, and it's working just fine, and has been for many years.
Personally, I hope that server-side rendering will be the new ~old~ trend.
Oh yeah. I remember the "let's just apply the good parts of AngularJS here and there" in v4-6.
"React was built for Facebook, which is a large company building a large-scale application."
One large scale application, which is not enough to create stable conventions that are badly needed in a framework that's supposed to be used in multiple such projects done by very different organisations.
Personally, I hope that server-side rendering will be the new ~old~ trend.
Users don't tolerate the inherent delays caused by this approach anymore.
All those hoops current frameworks are jumping through so that we can eat the cake and have it too are there because of this.
Well, I'm from Germany, but have a 6-y/o Android phone and live in a rural area with poor EDGE connectivity (~50kb/s). Most "modern" websites don't load/work for me.
From my personal experience, there's quite a few people now saying that their computing devices are getting faster and faster every year whereas the majority of websites, uh, webapps are seemingly getting slower each year...
This is also not just a problem with mobile and poor connectivity. Here's an example from my high-powered desktop work-station with a 100 mbits: When I open https://github.com/, my repositories (on the left) are server-rendered and shown instantly as the site is loaded, which usually happens in under 1s. The activity feed in the middle is rendered asynchronously on the client. It usually takes around 3-6s to finish rendering on my machine (while there is space for 5-8 activity feed items on my screen).
Optimizing SPAs is notoriously hard. You don't really have to optimize HTML.
Well, I certainly also do not tolerate the delays in contemporary React sites either. Take Reddit for example, which used to be lightning fast when it was mostly serverside, which now is painfully slow, especially on mobile.
I can second this - I've been working on a variety of Angular apps in an enterprise environment. It's worked fine and the "batteries included" has worked for my org, but it has definitely been a bumpy ride to get from beta to 9 with plenty of changes along the way.
> And here I am using HTML and CSS with tiny sprinkles of JS for most websites, and it's working just fine, and has been for many years.
This has been my favorite setup at work - pick "boring" tech like Django/Flask or Spring Boot and then sprinkle in some Javascript for highly interactive forms/pieces (React or Vue if needed).
It's neither an overarching architecture that makes normal web technology obsolete but runs on it, like Windows 95, nor a website generator like Wordpress. Web tech confuses me thoroughly, and I read HN all day.
Of today's frameworks, all but Svelte use a virtual DOM.
VDOM diffing is pretty slow, memory intensive, and unnecessary. It's very good it's not the only game in town.
litElement (used by Polymer) uses tagged template literals and no vdom.
If you don't need a virtual DOM, nobody will judge you for not having one. But once you really feel 'behind the wheel' of a framework like react or vue, it's hard to go back. Not only is it easier to hack out something quick over a weekend, it's also more suitable for collaborating large, complex applications.
We can have problems when folks start suddenly painting "The New Thing™" over classic designs and architectures.
In my experience, that's even worse than rewriting everything.
Also, it can become a requirement for hiring, because some manager, or their "top tech," have suddenly latched onto a technique/technology they encountered at a conference.
I remember applying at a company, and they gave me a "take-home" test.
Fair 'nuff. I like these better than the silly "draw spunky" tests that are so en vogue, these days.
They said I needed to use a certain third-party library, and use MVVM, or PM. That made no sense to me. It would result in the dependency being "married" to the application.
In my response, I used dependency injection to add the third-party library they wanted me to use. I wrote the app in about three hours, and incorporated the library (which is a great library, but one I had never used before). I delivered an app that met their specs -very quickly-, and of remarkably high quality. It also featured the ability to easily "swap out" the dependency (which is a huge reason for using dependency injection).
Dependency Injection is not a new thing. I think the name may be a bit new, but it's a fairly classic pattern that is a great way to encapsulate dependencies (which is something I always do).
It Freaked. Them. Out. I have no idea why. They literally shredded my résumé, at that point.
I have my suspicions why. I think they found out something else about me during the process (my age), and that may have been a contributing factor.
Wish I could share your confidence, but I have run face-first into this phenomenon.
[...removed some stuff that I don't feel like backing up...]
We are an unpopular bunch. It used to get me quite upset, but I’ve learned to make it quite clear that I am no youngster; right up front. Avoids stuff like what I mentioned.
PM?
Sorry. That was the term I learned, many moons ago. I learned it as a Microsoft pattern, and I used it to create Web-focused SDKs.
The more familiar one is MVP.
Really, if you are talking about creating a UIKit or AppKit app, you should use good old MVC, even though it’s “square.”
That’s because it is the pattern the toolkit was specifically designed to implement, and other models actually introduce dangerous departures from the norm.
SwiftUI and React are much better for MVVM or MVP.
Even if you are happy, your users may not. Axios (btw still on version 0.x despite being one of the older javascript packages, means it can introduce breaking changes without any warning, think about that) adds 4.4kB (minified+gzipped) to your bundle. Do that a few times and you have hundreds of kB of additional code your users don't need to download (and execute!). If all you need to GET or POST, without any special needs, the w3c fetch function is definitely better for your users.
A few times? You're suggesting doing that 50 or 100 times.
Adding 4.4kb an actual few times is meaningless for the end user.
Don't get me wrong, there are valid reasons to use axios, and I don't have a problem if you communicate those clearly. But I believe few developers make a conscious decision about the tradeoffs, most developers simply dgaf.
Axios after fetch being standard everywhere starts to feel like jQuery after document.querySelectorAll being available everywhere.
If so, do you use any of the Lodash features not described here?[0]
If you use more than described, or if a specific Lodash feature is more performant, you can selectively import[1].
[0] https://github.com/you-dont-need/You-Dont-Need-Lodash-Unders...
[1] https://www.npmjs.com/search?q=keywords:lodash-modularized
You don't have to keep up with which feature ships in which browser; that's what browserslist is for. https://github.com/facebook/create-react-app/blob/master/pac...
Sure, unless your users are desktop IE11 users. They won't care about 4.4kb but they'll definitely care about a broken page :)
Maybe I'm out of touch? It doesn't seem like the churn is as much of an issue.
People get so religiously tied to their technology sometimes that they cannot change without changing themselves.
It's the same case with the fractured ecosystem of Linux distros, there's tonnes of them! From the outside it looks overwhelming as all these projects are concurrently developing similar things. But the benefits are a rich and diverse ecosystem meeting a range of needs.
Imagine if everyone used one language like Java and never created new packages... and simply maintained existing libraries... that's not a world I'd like developing in...
Further if you're looking at getting your next job, you'll make your next project using the latest doodad, because thats who's hiring when you finish this project (as long as your project doesn't take to long and you miss the boat - you can probably quit midway, I suppose)
Interestingly, it appears to be somewhat correlated with market manias and peaks near the tops of markets.
Generally, following industry trends appears to be good for individual careers but bad for code bases (on average, but with occasional big payoffs.)
Do I regret investing time in learning any of those frameworks or technologies?
Not at all. It was fun and interesting at the time I learned something different from each of them. Perhaps the most valuable thing I learned was that it is worthwhile to evaluate new technologies and to continue learning new things.
Does it devalue me as an Engineer to learn many things as opposed to becoming an expert in a single tech stack?
Much the opposite. A lot of the underlying principles and architecture remain the same and yet, I find each framework offers something new. Whether it's questioning some convention, or approaching a problem with a different paradigm, or just being heavily opinionated, I feel like I gained some value from each of these and had fun while doing so.
Learning for the sake of learning is an infinite endeavour.
I try to practice strategic learning - learning skills/frameworks/topics that will have a high likelihood of being used in the course of my current project.
There's just so so much out there... focus is everything.
I usually spend that time studying something that I think may be useful or related to my job but I have been encouraged to explore. My employer is a big believer that innovation comes from exploration.
As you pointed out, it is an infinite endeavor. I'm okay with that. If I just stuck with the current technologies that were used when I first came in, we'd probably still be using jQuery and .ERB templates. Instead I personally pushed for using new technologies and my team is personally responsible for introducing Vue, Typescript, and GraphQL to our stack among other technologies.
Realistically though a lot of new tech will get into the hype stage and then everyone will realise that is in fact no good or just disappear for some other reason.
People see that diagram and think it doesn't matter if you jump in at the hype stage because eventually this tech will become mainstream, when a lot of the time that graph just drops to zero after the hype stage.
We start a project, pick our stack, pick framework versions and features to use. And then we code for a year using those decisions. We do watch to see what new things come up over the course of a year. We also learn lessons from our choices. When our year is over, we talk about new things, evaluate them, decide what we want to adopt, and move the line in the sand to include the changes that make sense. Then... for another year, stay where we are.
One npm audit shows a lot of vulnerabilities for the long trail of dependencies in my Angular 4 app. My web app uses Hapi 17 and many plugins have changed APIs in the more recent version.
This fact alone leads to many heavy refactorings and even rewrites.
As a solo dev, I can only try to reduce dependencies (taking a massive hit on productivity) or keep up with the newest way to write stuff in my former self’s framework of choice.
I found myself slipping in the architect role on a few recent projects with various employers and being forced to make the call on which front end framework to use. The problem is that there are so many to choose from and it very hard to predict what you will need in terms of features from your chosen framework six months or longer after making your decision.
Plus, your fellow devs will probably be arguing with you over which one is better based on their experience. All the emails and messages pointing me to various websites claiming React/Vue/Angular etc is best with stats and graphs I really don't have to the time to get my head around.
It's that fear of making the wrong choice that bothers me. The idea a year down the line the front end seems a bit sluggish and someone then points out that {other_framework} would be flying with the same workload.
Don't get me wrong choice is good, but with so much going on in the world of front-end right now coupled with all the hype and shouts about which is best it is hard to just pick one and run with it. Especially in the metric driven world we live in where a manager who doesn't get tech will berate you for choosing the wrong framework or wonder why you aren't buying in the latest hyped up framework.
That being said my preference is to use a framework to prototype and then convert to plain old JS where possible.
From where I stand, it seems vue or react aren't going away anytime soon. But the same could be said of angular, ember, and probably many others. What would you chose and why ?
I was able to work alongside a very saavy consultant for a year when I started out who I feel pointed me in the right direction wrt coding 'from the problem itself', if you will, but they'd have me do interviews and I'd be astounded at what applicants didn't know or grasp who'd been doin this front-end thing much longer than I.
If there were better solution design pedagogy instead of React's original marketing of "We know better about efficient DOM updates than you" I think you'd see substantially less reliance on these types of things, and probably a lot less unmaintainable code disguised as maintainable because it uses "a framework".
There are just too many ways to do things to teach a beginner in one semester and they just should be able to create basic prototypes anyway.
We did design projects for companies and showed them our ideas as mock images and they didn't like them.
We then implemented the exact same designs as prototypical apps, they clicked around in it and loved it.
In the middle, is developing with a framework. The problem is you have to know the language + the peculiarities of the framework. New frameworks and "features" happen on too short a timeframe. And, frankly, it costs too little to just invent a new framework. So, 10000 frameworks.
There is a mental cost that increases exponentially with every layer of abstraction. When people have to post questions about why they can't understand such "features" of panacea x , that's the problem.
But when I spent a year doing Javascript I found that in JQuery there were a lot of shortcuts I was writing my self to lower the RSI from typing long Javascript statements.
Beyond that there is nothing useful in JS frame works. They make simple things easy and the complicated stuff (which is design and logic) stays hard.
It took a lot of time and effort and being a stick in the mud, but the trick was ultimately an algorithm/abstraction I call source derivation (SDx).
Here's a simple example of the algorithm: https://codepen.io/SephReed/pen/gOaeQLv
---
I recently switched my JS + PureComponent mobile app to TypeScript and FC Hooks. I felt motivated to do so because:
- You cannot use hooks in PureComponent render(). The two modalities do not play nice together.
- Many of the libraries I use like react-spring and react-navigation have fully embraced hooks, sometimes without an HOC equivalent. So I felt forced to also embrace hooks or write complicated wrappers to facilitate them, for example new component lifecycle methods (e.g. componentDidFocus).
Some things I noticed...
1. TypeScript is amazing. Combined with Intellisense it has given me coding superpowers. I can write code faster and with dramatically more confidence.
2. You can incrementally shift your JS app to use TypeScript. You can even write type declarations for your JS code without rewriting it in TS. Most of your favorite libraries already have such type definitions (see DefinitelyTyped).
3. Hooks require a significantly different mental model than PureComponent. It feels horribly wasteful at first but apparently relies heavily on JS interpreter optimizations and memoization to achieve superior FMP performance[1]. My app feels noticeably snappier now, but it took a good bit of tuning to correct issues introduced during the port.
4. It IS indeed possible to write a functional wrapper that provides otherwise unavailable hook support for your Component or PureComponent. The tricky part is that you need to use a ref to invoke lifecycle methods on your wrapped component[2].
In retrospect I think I would recommend against porting an existing React project to hooks. However I would absolutely recommend porting to TypeScript, even if you do so slowly and incrementally.
1. https://medium.com/@dan_abramov/this-benchmark-is-indeed-fla...
2. https://medium.com/reactnative/custom-lifecycle-methods-in-r...
I literally spent like an hour reading up on it and learning it, and I realized I never want to go back to a plain old JS. TS feels way closer to Java than to JavaScript, with its own quirks and way of functioning of course. The barrier of entry seems perceived, but not really that big of a deal.
I wonder what are the cons of TS.
You and I clearly have different understandings of Java, JS, and/or TS. Typescript's structural typing feels like the opposite end of the spectrum from Java's nominal types.
Be that as it may, I said nothing about type systems. I said that TS feels closer to Java than it does to JS. Seeing as JS has no type system, I fail to see your argument.
I would like to know too. Sounds too good to be true....
You know what I hate more than "JS fatigue" - it's ppl complaining about "JS fatigue". Software evolves, and I'm always looking to bring a better experience for my users - and then means replacing components sometimes when there are clearly better alternatives, whether that is for developer experience, smaller bundle sizes, etc.
If you do not care about the future (which os OK in some contexts) then you are correct
I don't want a GraphQL database for my static site. I just want something to template out my site's boilerplate, and I don't want to deal with Webpack speed, or lack thereof. One file, ~200 loc, and I understand all of it.
The tentatively named Zhi works fast enough for full rebuilds triggered by fswatch. It does one thing and does it well:
fswatch -0 -e .venv -e out . | xargs -0 zhi build
If there's interest in a simple, understandable Jinja-based static site generator, I can clean it up and release it: https://github.com/0az/zhi (empty repo).