Posts tagged with architecture

Server-side apps with client-side rendering

reinink.ca

Jonathan Reinink proposes a new take on what Vue's role could be in a server rendered app.

What I have here is a classic server-side app, that uses server-side routing and controllers. There is no API. The controllers lookup the data from the database, and then pass it to the templates. Except, I'm not using any server-side (ie. Blade) templates. Instead I'm doing full client-side rendering using Vue.js. Confused yet? Let me explain.

Read more [reinink.ca]

Going deep on UUIDs and ULIDs

blog.honeybadger.io

Over at the Honeybadger blog, Starr Horne wrote an interesting article on the different types of UUIDs and ULIDs.

UUIDs are and will continue to be the standard. They've been around forever, and libraries are available in every language imaginable. However, new approaches are worth considering, especially as we enter a world that's increasingly run by distributed systems. New unique-id approaches may help us solve problems that weren't prevalent at the publication of RFC4122.

Read more [blog.honeybadger.io]

Join thousands of developers

Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.

No spam. Unsubscribe anytime. You can also follow me on X.

Domain Events vs. Event Sourcing

www.innoq.com

Christian Stettler explains why domain events and event sourcing should not be mixed up.

What do domain events have in common with event sourcing? Certainly the word “event” in the name. But beyond that, when talking to architects and developers in projects, at conferences or trainings, I often hear that domain events go well with event sourcing and that event sourcing is an ideal source of domain events. In this blog post I would like to outline why I personally do not share this view.

Read more [www.innoq.com]

Laravel domains

stitcher.io

My colleague Brent shares how we've been structuring our non-trivial projects at Spatie.

In this post we'll look at a different approach of structuring large code bases into separate domains. The name "domain" is derived from the popular paradigm DDD, or also: domain driven design.

Read more [stitcher.io]

Reusing domain code

matthiasnoback.nl

Here's another excellent post by Matthias Noback.

Reuse-in-the-small is definitely possible. Reuse-in-the-large is deemed to be impossible, because no two problems/projects are alike, but practice proves otherwise. There are reusable components covering entire subdomains, which are nonetheless quite successful. The chance of success is bigger if such a reusable component is used to cover for a generic subdomain. Using an off-the-shelf solution in such a case helps you save development effort which can instead be redirected to the core domain.

Read more [matthiasnoback.nl]

Inside look at modern web browser

developers.google.com

Mariko Kosaka, an engineer at Google, started a beautifully illustrated series on how Chrome works behind the scenes.

In this 4-part blog series, we’ll look inside the Chrome browser from high-level architecture to the specifics of the rendering pipeline. If you ever wondered how the browser turns your code into a functional website, or you are unsure why a specific technique is suggested for performance improvements, this series is for you.

Read more [developers.google.com]

Using anonymous classes as private classes

markbakeruk.net

Mark Baker, serial conference speaker and creator of the PhpSpreadsheet package shares some thoughts on how to create private classes using anonymous classes.

I’ve written before about the benefits of using PHP’s Anonymous Classes for test doubles; but Anonymous Classes also have potential usecases within production code as well. In this article I’m going to describe one such usecase that can be particularly useful within libraries, and that is replicating the access of Package Private (in Java), or Protected Internal Classes (as per C#).

Read more [markbakeruk.net]

The road to dependecy injection

matthiasnoback.nl

Mattias Noback shares how you can migrate a code base that fetches its dependencies using static method calls to code that uses dependency injection.

I've worked with several code bases that were littered with calls to Zend_Registry::get(), sfContext::getInstance(), etc. to fetch a dependency when needed. I'm a little afraid to mention façades here, but they also belong in this list. The point of this article is not to bash a certain framework (they are all lovely), but to show how to get rid of these "centralized dependency managers" when you need to.

Read more [matthiasnoback.nl]

What you'll need to build projections

dev.to

A great post by Barry O Sullivan on what, in my mind, is one of the biggest advantages of event sourcing: the ability to create projections.

Projections are a necessary part of any event sourced or CQRS system. These systems don't rely on a single generic data source such as a normalised MySQL database. Instead you build up your data sets by playing through the events, i.e the “film”, "projecting" them into the shape you want. This allows lot of flexibility as you're no longer bound by a single data model on which you have to run increasingly monstrous SQL queries (12+ joins anyone?). With projections you can build a data model specifically for the problem/question at hand.

Read more [dev.to]

A package that makes event sourcing in Laravel a breeze ?

by Freek Van der Herten – 11 minute read

In most applications you store the state of the application in the database. If something needs to be changed you simply update values in a table. When using event sourcing you'll take a different approach. All changes to application state are stored as a series of events. The key benefit here is…

Read more

Event sourcing made simple

The team at Kickstarter made a simple, synchronous event sourcing library implemented in Ruby.

We’ll go over a high level introduction to Event Sourcing where we will highlight the four components that make a (minimal) Event Sourcing system: Events, Calculators, Aggregates and Reactors. We will then talk about how we implemented a (minimal) Event Sourcing Framework at Kickstarter for d.rip. And finally we’ll reflect a bit on the ah-ha moments and the challenges that we’re going through with this approach — 9 months after having started to work on d.rip and 4 months after launch.

https://kickstarter.engineering/event-sourcing-made-simple-4a2625113224

Read more

Make a clear distinction between different layers of validation

In an older, but still very interesting article, Mattias Verraes has some interesting thoughts on form, command and model validation.

Many of the frameworks I’ve worked with, promise to separate responsibilities with MVC. In practice, they end up coupling everything to everything. The forms are coupled to the models, and there’s a grand unified validation layer. This may be convenient at first, but it breaks down for larger systems, and creates headaches when having to support multiple clients. My approach is to clearly separate the validation for the form itself, from the Command validation and the model validation.

http://verraes.net/2015/02/form-command-model-validation/

Read more

FP vs. OO

In a new post Uncle Bob explains that you shouldn't have to choose between functional programming and object orientation.

In this blog I will make the case that while OO and FP are orthogonal, they are not mutually exclusive. That a good functional program can (and should) be object oriented. And that a good object oriented program can (and should) be functional. But to accomplish this goal we are going to have to define our terms very carefully.

http://blog.cleancoder.com/uncle-bob/2018/04/13/FPvsOO.html

Read more

Organizing code into domain modules

In a new post to his site Mathieu Napoli makes the case for organising your code based on it's function rather than it's type.

We recently discussed 2 topics seemingly unrelated with my colleagues at Wizaplace: how to organize code? How to organize teams? ... Organizing code into domain modules is not a silver bullet but it forces to better understand the problem we are solving and better structure our code.

http://mnapoli.fr/organizing-code-into-domain-modules/

Read more