Read it on the website |
ISSUE 9Hey Reader, I hope you had a fantastic week. Mine was great—I took some time off work to enjoy the beautiful California woods with my wife and kids, which was a much needed rest but also the reason there was no Frontend at Scale last weekend. I hope you didn't miss the newsletter too much 😊 Today I'm flying out to NYC for this year's React Summit US. I'm super excited to hang out with the nice folks from the React community and to give my talk, The Messy Middle, during the remote track this Wednesday. If you don't have a chance to watch it live, I'll make sure to share the recording once it's up! This week, we'll talk about the life-changing magic of organizing your codebase, hybrid rendering architectures, React server components, and how to draw SOFTWARE DESIGNBetter Together or Better Apart?I like to imagine Marie Kondo would be an amazing software engineer. Not necessarily because of her coding skills (which might be pretty good for all I know), but because she's really good at keeping things organized. Some of the most challenging questions we ask ourselves when building software have to do with the way we organize our codebase:
The answers to these questions will depend on a number of different factors, so there is no one-size-fits-all answer here. But a guideline that ✨sparks joy✨ for me and that I like to follow when I'm not sure how to best organize my code is to keep together things that change together. Whenever we break down a block of code into two or more pieces, those pieces will remain coupled to each other. This is not necessarily a bad thing—some level of coupling is always expected. But when changes to one of the parts always require changes to another, it typically means that those pieces are tightly coupled. And the more tightly things are coupled, the closer they should stay together. Imagine you have a shared function in your codebase's common folder that is used by several different components throughout your application. This shared function might start out as a truly general-purpose utility, but as the codebase evolves, it may start to incorporate special-purpose code to support one or more specific use cases. What's problematic about this is that those two modules (the shared function and the module that uses the special-purpose functionality) are now more likely to change together, even if they live in completely separate parts of the codebase. This could result in changes to one of the parts unintentionally affecting all of the other users of the shared abstraction, causing bugs that can be really hard to track down. What helps here is to keep the pieces that change together closer together. In our example, that means separating the special-purpose code from the general-purpose abstraction. The diagram above shows two possible solutions for this scenario: we could refactor the code to pull the special-purpose code out of our shared function, or we could duplicate the shared function and put it closer to the code that actually uses it. Regardless of which option you choose, keeping related code closer together and reducing the scope of changes will always result in more organized and maintainable codebases. For a deeper dive into this topic, I have a few books to recommend that you can check out next. If you're a frequent reader of the newsletter, you might recognize some of them from previous issues:
FROM THE BLOG 📝Hybrid Frontend Architecture with Astro and StarlightA couple of weeks ago, Ben Holmes from the Astro team joined me on stream to do a little exercise on application design and architecture. We looked at a fictitious (but realistic) project, and we came up with an initial design and a rough prototype using Starlight, Astro’s official docs template. Check out the latest article on the blog for a recap of our discussion and a detailed look at our project’s architecture. If you’re looking to build a similar site with Astro or Starlight, I’m sure this write-up can be of some inspiration.
ARCHITECTURE SNACKSLinks Worth Checking OutWATCH LISTSimplifying Server ComponentsI must have read dozens of articles explaining what React Server Components are at this point, and still, I can't say the concept has really clicked for me yet. Thankfully, this talk by Mark Dalgleish started to change that. To answer the question "what are server components?", Mark goes beyond the typical answer of "they're components that run only on the server" (which, as he mentions, it's just rearranging the words in the question) to explain things from a different angle. Mark gives us a more useful answer: server components are just virtual DOM over the network. This might not make things immediately obvious, but it can help us develop a mental model of how they differ from traditional React components. The talk also goes through a simple implementation of server components from scratch, which not only helps us grasp the essence of server components but also clarifies which parts of this feature come from React and which from a framework like Next.js.
|
113 Cherry St #92768, Seattle, WA 98104-2205 |
Get the latest articles, talks, case studies, and insights from the world of software design and architecture—tailored specifically to frontend engineers. Delivered right to your inbox every two weeks.
Read it on the website ISSUE 10 Hey Reader, I have some exciting news to share before we start—Frontend at Scale has officially reached 1,000 subscribers 🎉 This is absolutely incredible to me, and I cannot thank you enough for being part of this journey so far. Whether you’ve been reading my ramblings from the very beginning or you just joined us last week, I want you to know how much I appreciate you hanging out with me every two weeks. If you enjoy the newsletter, the absolutely best way to...
Read it on the website ISSUE 8 Hey Reader, Do you have plans for this upcoming Friday, October 27th, at 9:30am Pacific? Work, you said? I'm not entirely sure what that word means, but I hope you can make some time come chat about application design in Astro with Ben Holmes and me on my Twitch channel. This is the first of what I'm hoping will become a series of talks on frontend architecture and software design with different framework authors and experts, and I couldn't be more excited to...
ISSUE 7 Hey Reader, Welcome to October. Did you all forget to wake up the Green Day person again? I know, I also think it's time to retire that joke, but it's too late now. Maybe next year. These past few weeks I've been doing some coding streams on Twitch and I have to say I'm really enjoing them. I plan to do a few more of these over the next few weeks, covering application design with Astro, SvelteKit, and Next.js. If that sounds interesting, stay tuned! In today's issue, we'll talk about...