Horizontal and Vertical in software architecture

Horizontal and Vertical in software architecture

As the image above suggests:

I like to use DDD to give some verticality to the app and design patterns to give some horizontallity to the app.

You potentially use design patterns every day as a software engineer (or at least I hope for you). In mobile development the star patterns are actually MVVM-C (in iOS world) and MVP (in Android world).

You can find few other examples in this good book: https://www.objc.io/books/app-architecture/ (even if I sometimes disagree a little bit with some of their implementation, but those guys are definitely very good and the patterns that they present are smart - especially the ELM part)

What’s good with this kind of design pattern is the fact that they will structure your UI in small silos, thus enabling you to reuse/industrialise/facilitate your software development.

Now let’s think about an app in general. You have screens to interact with users and you have others parts to interact with your APIs, your DBs and all your specific elements (could be a specific sync engine, a specific image processing engine, etc.). In an MVVM-C, those specific elements are generally hidden in the VM part (the View Model), but if you have to reuse part of your implementation in another use case then comes the moment when a bad developer will start to link one ViewModel with another one, or when a better developer will present the ViewModel to the other ViewModel through an interface/protocol.

But sometimes a better approach is to put them in another part and thus to have more like a DDD approach on it (one could say that it is not the exact definition of DDD - Domain Driven Design: https://domainlanguage.com - and I would completely agree, but I like to use DDD - which normally includes the UI - as a pragmatic approach for one specific part of the app, a specific domain of the app).