DEV Community

Nick Ciolpan
Nick Ciolpan

Posted on

Beyond the Hype: Rethinking Decoupled Architecture and the Pursuit of Modern Frontends

Decoupled architecture used to be the magic bullet when one generator (data source) catered to multiple consumers (multiple frontends, third-party services). But that narrative has shifted. Nowadays, it's often seen as the key to leveraging React.

Chasing after the most popular frameworks can sometimes lead us astray. While it might look appealing on job listings, introducing a new layer, like a “beautiful” RESTful JSON API, comes with its own set of complications. Think JWT authentication, state management, data serialization, and API versioning. Remember, these are strategies to mitigate problems, not features!

I recall a conversation where I cautioned against mindlessly using "react-create-new-app" for every new project. The retort was, "What's the alternative? It was worse before with templates." We mustn't be trapped by the past. It's crucial to keep an eye on the horizon.

Single Page Applications (SPAs) have indeed revolutionized front-end development, introducing many best practices. Let's delve into a few:

  1. Isomorphism: A JavaScript boon. First, JavaScript runs on the server, then again on the client. Frameworks like meteor.js elevate this by offering data on-the-fly through live databases.
  2. Server-driven UI: Take Livewire or Blazor as examples. As Alan Kay once said, "For all it matters, for the user, the interface is the end product." Such tools allow developers to craft end-to-end apps in a contemporary fashion.
  3. Adapters and Glue: Consider Interia.js or Hilla for Java. The latter seamlessly translates Java types and resources into TypeScript types. It even supports calling Java services from a React component without any extra setup.

In sum, while JSP pages and old index.php files might have their detractors, there are innovative solutions available that don't necessitate maintaining an extra layer just for the pleasure of using React.

What about future mobile app needs? Unless it's specified by the client, are you factoring in the costs of your personal assumptions?

Let's conclude with a parable: A young boy asked his mother why she chopped off the ends of the corn before boiling it. She didn’t know, saying it was a method learned from her own mother. The grandmother similarly pointed to her mother. The great-grandmother, when questioned, revealed she had a small pot, necessitating the corn’s truncation. Three generations persisted with an unnecessary practice, oblivious to its origins.

This story underlines a key point: don't blindly follow industry trends. Understand the compromises and context behind every choice. Before jumping into modern frontend, question if there's a smarter approach that sidesteps the pitfalls, putting you firmly in the driver's seat of solution architecture.

Top comments (0)