DEV Community

Discussion on: What makes frontend so miserable for backend developers?

Collapse
 
dmfay profile image
Dian Fay

Lots of fingers pointing at CSS, but I don't think that's really the culprit. There are minor difficulties inherent to using CSS infrequently: it's easy to forget the long keywords, which order you go in defining margins or borders (and with two or four elements?), or which flex attributes do what again. But structurally, CSS is all about sets of elements and sets of classes, and principles you pick up working with datasets apply just the same until you get to the really fiddly details, which again are the sorts of things that take regular use to master.

What the frontend does dramatically differently is state. For ~twenty years now, services and APIs have evolved toward the relational database principles of atomicity and isolation. Backend developers live by the rule that the proper place for state across requests is the database; stateful APIs are an absolute nightmare to maintain.

Meanwhile, the frontend is all state all the time. Contemporaneously with the movement toward stateless backends, web frontends started becoming stateful with XMLHttpRequest, and the web's availability and comparative universality helped it overtake the desktop as the target environment of choice. State management on the frontend has only gotten more and more complicated with time and single-page apps. There are dozens of flavors of state management, even more toolchains, transpiling, polyfilling, and finally Electron bringing all that fun full circle to the desktop. It's unfamiliar territory for people who focus most of their attention on the backend, and there's so much of it it's next to impossible to stay current.

Collapse
 
dfockler profile image
Dan Fockler

This is soooo true. Almost all of the frontend problems I run into are state management. Like "Do I have this data yet? If I don't have the data yet, what should the UI do? When I get the data, what needs to change? What happens if a user types in this field or clicks this button? What changes do I need to make to get the data in the right shape to work with these two different places."

The days of static websites are long gone, which is why people complain about the complexity of JS tooling. Most of that tooling is there to help with asynchronous state management (which is a "hard" problem). I think it's natural that as people expect more interactive websites we'd end up with more state management as a consequence.