Ask HN: Why did Frontend development explode in complexity?
I&#x27;m going to attempt to give some fact- &amp; data- based answers, as there seems to be too much ideological axe-grinding in (many of) the existing responses (as is, unfortunately typical on HN it seems, when discussing Front End Development). Even if my attempt seems...boring? (And sorry for the length; hopefully it makes up for that a bit in quality...?)<p>HN: &quot;Why did Frontend development explode in complexity?&quot;<p>Answers:<p>0) It&#x27;s not ONE thing--it&#x27;s a combination for forces&#x2F;trends&#x2F;factors...<p>1) The underlying technologies have become more complex (at least CSS and JavaScript have, but much less so w.r.t. HTML). For example: Flex layout, Grid layout, calc(), variables, etc., in CSS. Async&#x2F;await, destructuring assignment, import(), optional chaining, spread operator, yield, ...more in JavaScript.<p>2) Customers and Users &#x27;see&#x27; something that looks complex (whether inherently or accidentally), using Web technologies, so they are increasingly conditioned to expect that any application (regardless of complexity) can be build&#x2F;delivered using Web technologies. A few examples, off the top of my head:
<a href="https:&#x2F;&#x2F;www.figma.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.figma.com&#x2F;</a>
<a href="https:&#x2F;&#x2F;docs.google.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;docs.google.com&#x2F;</a>
<a href="https:&#x2F;&#x2F;www.onshape.com&#x2F;en&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.onshape.com&#x2F;en&#x2F;</a><p>3) HTML is--egregiously--impoverished! Quick, when was that last time you saw a non-trivial LOB application (or even most CRUD applications) that did NOT need some sort of data-grid style presentation? Well, luckily we have the HTML5 data grid control for that...oh wait, F** me! And then there&#x27;s less common needs, like a &#x27;tree control&#x27;. Or more common needs like: a robust dialog control (with proper focus mgmt., etc.). To PROPERLY implement (documented, rigorously tested, styleable, i18n support, accessibility support, DOM attributess, JS API exposure, and on and on) just one of those is weeks, even months of work. Sure, if you&#x27;re only creating something for your own project, you can take short-cuts. But how much effort--and complexity--has been foisted, collectively, on Web application Developers, because the BROWSERS don&#x27;t have a complete control set???
Arguably, the HTML control set is not much richer (except in styling) than what one could do on a 327X terminal; which is 1960s-vintage technology!<p>HN &quot;Follow up question : Is that complexity necessary or artificially inflated?&quot;<p>3) Short answer: YES.<p>Long answer: as the technologies mature (whether the built-in troika of HTML&#x2F;CSS&#x2F;JS; or the add-on stacks), and as Developers become more experienced at delivering applications with &#x27;Web stacks&#x27;, what I&#x27;ve experienced is that some of the accidental complexity is decreasing. But certainly FOMO and RDD, and similar self-serving imperatives are a factor in having artificial complexity. For example now that &#x27;legacy&#x27; browsers are no longer a concern&#x2F;constraint for many projects, the complexity of Babel, and Webpack are often no longer needed. Or, at worst, can be replaced by more: modern, simpler, and generally performant tools.<p>Example: <a href="https:&#x2F;&#x2F;vitejs.dev&#x2F;guide&#x2F;why.html" rel="nofollow">https:&#x2F;&#x2F;vitejs.dev&#x2F;guide&#x2F;why.html</a><p>Also consider the madness which is the global namespace + cascade approach of CSS to selecting where&#x2F;how styles get applied. There are (? were) benefits to this approach when CSS was exclusively being used for a relatively small number of styles that needed to be applied, consistently, to a large number of pages (i.e., via a rel link to a SHARED stylesheet). But those days are LONG gone! There have been numerous attempts to address that madness, traditionally via naming conventions, for example:
<a href="https:&#x2F;&#x2F;en.bem.info&#x2F;methodology&#x2F;naming-convention&#x2F;" rel="nofollow">https:&#x2F;&#x2F;en.bem.info&#x2F;methodology&#x2F;naming-convention&#x2F;</a>
<a href="https:&#x2F;&#x2F;www.keycdn.com&#x2F;blog&#x2F;oocss" rel="nofollow">https:&#x2F;&#x2F;www.keycdn.com&#x2F;blog&#x2F;oocss</a><p>But those approches are (IMO) tedious; and experience has shown they are not scalable, on multiple axes (application complexity, project longevity, team size, experience level diversity).<p>So Developers added tooling, such as SaSS, to attempt to overcome the weaknesses of CSS for large&#x2F;complex projects. That&#x27;s been at least a partial success. BUT, at the cost of additional complexity in the tooling and build chain. Maybe even having to have an additional language run-time for some tooling like that!<p>Just having two &#x27;newish&#x27; features of CSS: variables, and the calc() operator can potentially reduce a lot of the traditional usage of things like SaSS. In some cases, the need for tools like that goes away completely! That&#x27;s a win, for reducing artifical complexity.<p>Another example is the strict scoping of style selectors in Vue&#x27;s single file components:<p><a href="https:&#x2F;&#x2F;vuejs.org&#x2F;api&#x2F;sfc-css-features.html#scoped-css" rel="nofollow">https:&#x2F;&#x2F;vuejs.org&#x2F;api&#x2F;sfc-css-features.html#scoped-css</a><p>Just that one feature alone, completely eliminates the traditional CSS madness, but without the weakness of the conventions (like BEM and O-OCSS), and with minimal (and pre-configured&#x2F;included) tooling.<p>CLOSING THOUGHTS: state management is still very complex; at least for non-trivial, and at least moderately interactive applications. In my experience (and I was designing, and implementing, complex GUIs _long_ before the Web was a thing), at least some of that state management is necessary (inherent), for those non-trivial &amp; interaqctive applications. The best we can do is to research and investigate, and try-out various approaches to minimizing the _accidental_ complexity that our state management approach&#x2F;library&#x2F;etc. adds to the inherent complexity.<p>I&#x27;m somewhat adverse to making recommndations on specific technologies, but I&#x27;d suggest that Developers who are contemplating a Web applicatiion with demanding state managment needs take a look at the following state managment library:<p><a href="https:&#x2F;&#x2F;tanstack.com&#x2F;query&#x2F;v4&#x2F;docs&#x2F;react&#x2F;overview" rel="nofollow">https:&#x2F;&#x2F;tanstack.com&#x2F;query&#x2F;v4&#x2F;docs&#x2F;react&#x2F;overview</a><p>Comment: it addresses a LOT of the pain points that many Web Developers&#x2F;Projects encounter. Moreover, I&#x27;ve had some very positive experience with the predecessor project to this one (i.e., React Query). N.B. If you&#x27;re going to be using: Vue, Svelte, or Solid.js (i.e., NOT React), then make sure to click on the drop-down menu in the UL corner of that page!