Keep Complexity At Bay, or You Aren't Going to Need That Compiler

Joseph
Tooling fatigue in web development is real, and Drupal is not exempt from having its own version of this. Depending on the chosen tooling and approach, additional tooling may just end up adding overhead, cognitive load, and unnecessary effort. Another thing to learn, another thing that can break, another thing to debug, another thing to exploit.
Learning Drupal is already complex on its own, we shouldn't add any more complexity than what's actually needed.
This session will dive into:
- The state of development tooling (e.g. transpilers, minifiers, etc.)
- Development mindset (writing custom code vs using what comes with Drupal)
- The issues these tools/approaches aimed to fix (e.g. bandwidth, developer experience, etc.)
- The unseen/untold/unheard side-effects of using these tools (e.g. complexity, productivity loss, dependency hell, cognitive overload, security issues)
- And alternatives to mitigate or completely avoid them.
For example (raw brain dump incoming):
- CSS
- Transpilation may not be needed anymore. CSS has been compiled from Sass/LESS/PCSS in the last decade. But CSS itself has progressed in the last decade, now having many of what used to be features only available to Sass/LESS.
- There may not be a need to minify anymore. Drupal has CSS aggregation which, if combined with network Gzip and HTTP/2, may eliminate the need for minification.
- Drupal has a CSS dependency loading mechanism. This may make native CSS layering and imports redundant.
- Plain CSS may be sufficient for your needs.
- JS
- Transpilation may not be needed anymore. JS in the last decade has been compiled from newer variants down to older variants for browser compatibility. But with the death of IE and the proliferation of Chromium-based browsers, there may not be a need to transpile code.
- Minification may not be needed anymore. Drupal has JS aggregation which, if combined with network Gzip and HTTP/2, may eliminate the need for minification.
- Transpilers are used because everyone is using them. A study/article looked into how developers used transpilers (I'll have to find that article). Majority of the transpilers transpile back to ES5 by default for IE compatibility. Majority of developers just use the defaults. This results in unnecessary bloat and code served to browsers that do not need them.
- Plain JS may be sufficient for your needs.
- Drupal
- You don't need that custom entity. Many times, when we're working with new functionality, we tend to lean towards writing everything custom. But we tend to underestimate the effort of building it custom. The moment that custom entity grows beyond just "storing some data in an entity under our control" (e.g. it needs revisioning, index support, translations, fields), it becomes a rabbit hole you never signed up for.
- Do not circumvent Drupal's rendering mechanism. Many times I've seen devs overdo Twig overrides, hardcode things into hooks, put two dozen utility classes into HTML. Short term, these work. But in the long run, these introduce subtle bugs that grow over time, and cause the nastiest outcomes (e.g. out-of-memory errors, slow sites, incorrectly cached content, etc.) which takes up someone's time later.
- Core entities and plugins may be sufficient for your needs.
- And the troubles:
- Technical debt: All the additional effort, bloat, and cognitive overhead introduced by the things above may just slowly eat away at your timeline/budget without anyone suspecting and dismissed as "Technical Debt" or "Just Part Of The Work" - when it shouldn't be.
- Not beginner-friendly and gives Drupal a bad reputation: All the bespoke things introduced in a project will most likely diverge from core Drupal, and many of the online tutorials and guides. This creates a huge gap between what beginners learn from online guides and tutorials and the actual thing being built. Reducing complexity closes this gap, allowing for a more approachable project.
Of course, the answer to everything is a "It Depends" and this may all just be me having a "old man yelling at cloud" moment. Complexity may be necessary at some point. But having this "You aren't gonna need it" (YAGNI) mentality at the start may just save everyone from losing hair in the long run.
Additional Details:
- Audience level: Beginner
- Topic: Developer
- Room: Gaige Hall 201