Front-end is harder than back-end
Or convince me otherwise. I thought this would lead to an interesting discussion. I'm a back-end developer, currently constructing a front-end app in ReactJS. Ok, I must say I'm a newbie when it comes down to ReactJS. But as an example, it took me 20 minutes to realize that a table with 1000 elements, each having edit buttons, led to the slow response of displaying a modal. Now, I'm tasked with finding an effective solution to address this issue—whether it's through pagination, using react-window, or exploring other alternatives. And I haven't even found the cause whether it's the amount of event handlers, the size of the virtual DOM or something else. Back-end feels so much straightforward.
63 comments
[ 3.4 ms ] story [ 136 ms ] threadBackend is a python Falcon REST API and there too we resisted internally calls for moving to newer async frameworks, port some parts to Go, etc.
Either way, for everything the following is valid:
"You're more comfortable with what you're used too" :)
Tables for layout isn’t just an example of a dated web site, it is also an accessibility nightmare which no professional web developer would allow to leave their localhost.
People underestimate either side. You can get very very deep in both of them, it's no longer just about putting HTML elements on the page, or sending back a response. They've both become oceans, from exploring 3D content to computing on the edge to an entire orchestration of tools to manage as little downtime as possible.
So far what I've been seeing is whole teams that "don't believe in full-stack developers" so they box and typecast people who try to do both.
You gotta send the right message from the top to change this. I've had some FE developers that picked up BE and are doing great at it.
Would you expect these new backend folks to be able to, take, say, a clean linux install and build a relatively full stack on top of that - Apache config, firewall, that sort of thing?
I remember this changing around 2015 or so, when I started getting the first batch of devs that only knew how to deploy using the one single way they learned, and never updated that. I specifically remember one dev that was coding for 3, 4 years saying his dream was to make and deploy his own website. He never had a personal project.
Which is perfectly fine, don't get me wrong. The part I'm not a fan of is the culture against people who can do multiple things well. Which, funny enough, I am required to do in my job (I have to do most DevOps, plus mentor frontend and backend devs).
React in general is a bit of a pain, you may need to use `useMemo` etc. You probably want to find out what the bottleneck is, first. Computations? DOM elements? Re-rendering excessively?
It's certainly no harder than BE - it's likely just a lack of familiarity.
[0] https://developer.chrome.com/en/docs/lighthouse/performance/...
More moving part is the right way to say it I guess. And perhaps: you have a user which interacts with it, so there is a lot to keep in mind regarding that as well: show loaders, what happens with y if they hit x and z, etc.
Also "Front End" and "Back End" are about as terrible of terms as one could come up with to describe the areas of work. It's like acting like building a house requires two jobs, "Inside Builder" and "Outside Builder". Both areas are actually many specific areas of expertise. For non-clientside-development I think the industry has just gotten more specific in job titles, ie now there are SREs, "Platform Engineers", "Microservices Developers", "Cloud Devs" etc. Some places have gotten into having more specific clientside titles, but IME mostly it's still pretty vague.
Also, meaning no disrespect to Javascript people, I think lots of trendy "modern" "frontend" tools make things harder. React flipflopping on styles + devs wanting to stay up with the trends + SPAs in general being somewhat of a bastardization of the technology, I think are decent examples to suggest that living in the JS realm is, in part, accepting that things are going to be hard sometimes for the sake of it.
You can still build featureful rails/jquery/htmx applications and, IME, outpace FE specific technologies in terms of feature output.
Your anology is flawed. There are different tools and different skillsets involved. A more apt analogy is that building a house requires two jobs, a “carpenter” and a “cabinet maker”.
A back end developer need not concern them self with UX design, CSS animations, accessibility, browser compatibility, etc. and very seldomly with localization. These are all things a skilled web programmer will become an expert at if they are building websites served to tens of thousands of people.
Similarly a cabinet maker need not concern them selves with ventilation, load bearing walls, stud spacing, etc.
On the backend you can (hopefully) revert from a backup, or conjure up a clever SQL query to patch things up. On the frontend however, well, you just have to wait for the user to call you to tell you it is broken, and then tell them—somehow—that they must delete the service worker.
Oh yeah, and you also have to deal with shipping a feature which brakes everything for users on 5 year old versions of Safari.
True, but also tooling is better. I have seen a data corruption in a database only once in my life (at least in production). Finding some issue with ui is closer to norm then exception.
You are right. BE is declarative hence solid (pun) once put in place. FE is design, aesthetics, ease of use, beauty, culture, above all functional. Hence tougher.
You're dealing with crazy environments, far faster changing best practices, libraries, frameworks, and tooling, increasingly demanding audiences, and any imperfections on whatever you deliver are extremely noticeable.
If a backend developer does a database query that's a little inefficient, odds are nobody is going to even notice that.
If a frontend developer does some animation that's a little choppy and with bad timing, they might have the entire company management crawling up their ass the next day.
but these things have a bad habit of forming loop-like structures, turning back in on themselves.
Speaking to the actual question - my own observation is that the “hardness” of something is entirely subjective. We have a physics math phd in my company who sees 3D modeling as hard because it is so tedious and dependent on clicking around UI’s. Under the same roof we have a couple of 3D modellers who spend all their time clicking away and they see all the complex math and physics simulation and it’s all tedious gibberish to them. One can’t imagine doing the other job.
Many people find the thing they do sort of easy. Many people make judgements about adjacent disciplines and think “I could do that”.
But generally yeah - I would agree that FED is hard and in many ways comprised of layers standards and strange caveats. But they do say that’s the case for any expertise-driven domain.
I was working for an agency doing mostly apps and websites, one of our customers had a couple of projects running in parallel. One was sorting out an app that their own developers had made a pigs-ear of, and another - larger - project on new ground.
The customer's project manager called us up asking for some more resource for the larger project to keep to deadlines, it got to the point of trying to micromanage the other app project that wasn't theirs, and they blurted out:
"${app} doesn't even need a senior developer, it's just front-end!"
It wasn't eye-opening, we could already see what a state their other "front-end" projects were in, but hearing it from the horse's mouth was a little amusing.
https://reagent-project.github.io/
I will grant you one thing: on the backend, you can use whatever languages and operating systems you want. On the frontend, you're pretty much stuck with javascript and the browser (css, DOM, event handlers, etc).
To be good at front end web, one needs to care deeply and sink a ton of time and energy into framework and component choice and understanding what’s going on under the hood. Gluing together whatever is shiny or trendy at the moment without deeper consideration is a surefire way to end up with something that technically works but is thoroughly mediocre.
Of course deeper understanding of the technologies being used is helpful in other types of front end as well, but it’s not quite as important there because they have well established conventions and best practices that cut past trouble of this sort. Point in case, in an iOS or Android app, the system stock table views with many rows won’t perform badly because as long as you’re using the APIs as designed, they recycle their cells right out of the box — no need to hunt down a special package or anything.
But yeah, front-end even feels harder to debug at some points like the one I mentioned in the OP, at least for me. Not to mention the facts you keep overthinking what might be a good solution in terms of UX (in case that too many DOM elements is the issue of slow performance).
Front-end technologies are not "progressing rapidly", they are thrashing. People are (rightfully) extremely frustrated with the limitations of the tools they have, so they (wrongfully) go off and invent new tools that get around those limitations, while inevitably re-introducing tons of difficulty in whatever the tools they're replacing were developed to avoid. It's just around and around. Developers aren't falling behind, they're simply getting dizzy. What they should be doing, instead of throwing out all the babies with all the bathwater and going and inventing their own giant frameworks with Blackjack and Hookers, is working on the theory of software engineering.
Our theories of software engineering are terrible, and I very rarely see discussions where I see actual theory-building. There are a lot of religious discussions, and a lot of slick new tools that let newbies make cool things quickly but always make complicated things harder. We need better theories of software engineering, not more new JavaScript frameworks and NoSQL database engines.
So don't worry about which one is harder than the other. It's an arbitrary line anyway, and it depends way too heavily on the specifics of the project. Realize that by and large, almost everyone is still shit at the entire stack.
I feel this is an obsolete view. React has been on top since what, 2017? It's extremely popular and there's nothing close to it. Now, data world... amount of new technologies there has way overtaken early 10s frontend.
React is obsolete. Cool kids are now using Svelte or Qwik.
React: 21,879,845
Svelte: 722,312
Qwik: 11,702
[1] https://npmtrends.com/@builder.io/qwik-vs-react-vs-svelte
Web front-end is horrific by comparison.
But frontend doesn't need to deal with as many categories of failure modes as backend (imagine running out of file handles in *nix OS, or dealing with a deteriorating hard drive), doesn't need to worry about security to the same extent, and doesn't need to scale to many users. You know that you're running on a single machine, in (usually) a single thread. If you got it to work in all target devices, and handled low connectivity conditions, you're probably good.
On the backend, you might get it to work, but that's just step one. Now you have to make sure it's secure, make sure you handle all weird thread safety edge cases, db deadlocks from connection limits, and make it scale, which can take you very far from what you had when you just made it work. Running a feature at scale is an entirely different beast than making a feature work. Every backend function can turn into an iceberg of code, databases, queues, and other infrastructure to facilitate that feature.
1. You have your signals and stuff - the actual data you want rendered.
2. React creates a virtual DOM tree thing out of your markup.
3. That virtual DOM gets turned into real DOM.
4. React gives the real DOM to the browser, who probably has to shift a lot of internal data around to accommodate changes.
5. The browser loops through its DOM and draws it on the screen (somehow - another black box).
This is a crazy amount of internal bookkeeping. Compare this with something like Dear ImGui (https://github.com/ocornut/imgui) where it's more like:
1. You have raw data in memory (just ints and char arrays).
2. You loop over your data, generating vertices for the GPU.
3. You give those vertices to the GPU to render a frame.
IMO this is way easier to reason about. It may seem "inefficient" as you're building up the entire screen from scratch for each frame. But if your content is static, who cares? You can draw one frame and leave it there for as long as you need. If your content is animated, you're probably already redrawing each frame from scratch anyway. At least you know that it's happening now that you've removed the endless layers of black box tree structures.
1. “Discord, friends - Discord window, direct messages, selected cell”
2. “You are currently on a cell inside of a table. To navigate the cells within a table, press…”
3. (when navigating with the keyboard) “1 mention, $SERVER_NAME, cell” “$SERVER_NAME, cell” etc
And here’s when I do the same with a random Dear ImGui app I have installed:
1. “$APP_NAME, $APP_NAME window, $APP_NAME window”
2. “You are currently in a window”
3. (when navigating with the keyboard) [silence; no additional instructions]
So that Dear ImGui app is entirely unusable for anyone who needs a screen reader. This is something every React app — really every web app, period — gets basically for free.
And it’s not just screen readers, right? It’s different viewport sizes and alternate character sets and right-to-left text and user-defined fonts and searching through text on a page and the zillion-and-one other things that you either take for granted or don’t need at all but are crucial for millions of people.
Yes, if you could make a good UI by just filling a frame buffer with pixels, web browsers and React would all be hideously over-engineered. But we don’t live in that world.
All in all, I don't think "there is a reason things are the way they are" quite means "the way things are is actually the best they possibly could be".
I don’t want to get too hung up on Dear ImGui. The official repo says that it’s meant as a developer tool rather than for building end-user UIs, so it’s not a fair comparison. My point is simply that all these things require layers of abstraction. Maybe the way things are isn’t the best way, but even the best-case scenario will be significantly more complex than what you described once you start adding in the things I mentioned.