Uncle Bob: Architecture is About Intent, not Frameworks
Architecture is about intent, we have made it about frameworks and details, Robert C. Martin, "Uncle Bob", stated earlier at this year’s DDD Exchange Day in London.
Robert refers to an architecture model described in the book Growing Object-Oriented Software Guided by Tests, (similar to the Hexagonal architecture), which describes an architecture with three zones with dependencies going only one way, from the volatile parts towards the more stable parts:
- A Domain Model with the core business rules, the most stable and important part for the business, not depending on anything else.
- Application Services for the use cases of the system which uses, and depends on, the domain model.
- External Details, database, user interface, network, etc., that are less relevant for the business model. The most volatile part and depending on the other two.
Robert notes that this model fails to describe what he regards as a key aspect; architecture is about intent, what the application does. He thinks we focus too much on details and frameworks and have made them the centre of our systems.
To deal with this shortage Robert goes back to a book by Ivar Jacobson, "Object-Oriented Software Engineering, A Use Case Driven Approach" from 1992 where Ivar is defining a mechanism for application architecture based on small use cases without details.
Ivar introduces three types of objects, that fits naturally in the architecture model, and described by Robert as:
- Interactors that understands the use cases and has application specific business rules.
- Entities with the business rules, used by the Interactors.
- Boundary objects that transfer data between the external world and the Interactors.
A significant advantage with this model, Robert claims, is that it's a very testable model; it can be tested without any dependency on infrastructure by just sending and receiving data structures trough the boundary objects.
Robert then moves to his Clean Architecture model, a variant of the already mentioned architectures. An essential aspect of all the three models is that they follow the Stable Dependencies Principle; "Do not depend on things that change or are likely to change". The models do this by letting the external volatile parts depend on the more stable parts e.g. the domain model, and not the other way around. This also makes it easier to change an implementation; the volatile part is depending on something that is stable, quoting Robert:
A good architecture allows volatile decisions to be easily changed
Robert also refers to Jim Coplien and the DCI architecture which he thinks is similar to the other architectures.
Some criticism has been raised against some of these ideas that Robert has expressed in recent years, criticism that Robert also have responded to.
相关推荐
《AndroDialysis:分析Android Intent在恶意软件检测中的有效性》这篇文章探讨了在Android系统中恶意软件数量随着其流行度上升而增加的问题。Android系统的开放性是导致这个问题的主要原因。恶意软件的目标是利用...
### Android Intent Action 大全 #### 一、概述 在Android开发中,`Intent`作为组件间通信的重要机制之一,其通过携带特定的信息在不同组件之间进行传递,从而实现组件间的交互与通信。`Intent`有两种类型:显式...
- 隐式Intent: 不指定目标组件,而是通过动作和数据来寻找能处理该Intent的组件。这种方式可以跨应用通信,增加了系统的开放性和互操作性。 4. **Intent的附加信息** - `putExtra()`: 用于添加额外的数据到Intent...
在AndroidManifest.xml中,为组件定义Intent Filter,使得组件可以响应隐式Intent: ```xml <activity android:name=".MyActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> ...
在Android开发中,Intent和BroadcastReceiver是两个至关重要的组件,它们构成了Android系统中不同组件间通信的核心机制。Intent用于在应用程序的不同组件之间传递消息,而BroadcastReceiver则是一种响应这些消息的...
- 隐式Intent:不指定具体组件,而是通过Action、Data、Category等元数据来定义一个意图,任何能够处理这些元数据的组件都可以响应。 2. **Intent构造器**: - `Intent(Context packageContext, Class<?> cls)`:...
- 隐式Intent:不指定具体目标组件,而是通过动作(Action)、数据(Data)、类别(Category)等元数据来定义一个操作,系统会根据这些信息寻找最适合处理Intent的组件。 3. **Intent的创建** 创建Intent通常有两...
Android中的Intent是应用程序之间通信的重要桥梁,用于启动其他Activity、Service或者BroadcastReceiver,甚至可以触发系统级别的操作。本文将全面总结Intent的几种主要用法。 1. 显示网页: 使用`ACTION_VIEW`与...
2. 隐式Intent:隐式Intent不指定特定的接收者,而是根据Intent的数据(如Action、Data、Category等)来匹配能够处理该Intent的组件。这种方式允许不同的应用程序组件共享功能,增强了系统的可扩展性。 三、Intent...
- 隐式Intent:不指定具体组件,而是通过Action、Data、Category等元数据来定义意图,任何能处理这些元数据的组件都可以响应。 2. **Intent构造器**: - `new Intent(Context, Class)`:创建一个显式Intent,用于...
- 隐式Intent:不指定具体组件,而是通过Action、Data、Category等元数据描述Intent意图,由系统根据这些信息寻找最适合处理Intent的组件。 2. Intent的主要组成部分: - Action:描述Intent要执行的操作,如...
Android 中使用 Intent 打开各种文件类型 Android 操作系统提供了 Intent 机制,允许应用程序之间进行交互和通信。Intent 是一个异步的消息机制,用于在应用程序之间请求或提供服务。通过使用 Intent,可以实现打开...
在Android应用开发中,Intent是一种强大的机制,用于在组件之间进行通信。Intent不仅可以用来启动新的Activity,还可以启动服务、广播接收器等。本教程将详细讲解如何使用Intent来实现特定的功能,包括打开新的...
2. 隐式Intent:不指定具体的目标组件,而是通过Action、Data、Category等元数据来描述意图,让系统根据这些信息找到合适的组件来处理。这使得不同应用间的组件可以互相调用,实现了组件之间的解耦。 二、Intent...
在Android开发中,Intent是一种非常重要的组件,它用于在应用程序的不同组件之间传递消息,实现活动(Activity)之间的交互。Intent不仅用于启动新的Activity,还能启动服务(Service)或广播接收器...
在Android开发中,Intent是一种非常重要的组件间通信机制。它被用来启动活动(Activity)、服务(Service)或者广播接收器(Broadcast Receiver),并且可以传递数据和执行动作。本篇文章将详细解析Intent的用法。 ...
### Android Intent跳转详解 在Android开发中,`Intent`是一种非常重要的机制,它主要用于启动新的活动(Activity)或者向其他组件发送消息。通过Intent,我们可以实现Activity之间的跳转、数据传递等功能,这对于...
在Android操作系统中,Intent是一种非常核心的组件,它充当了应用程序之间、组件之间通信的桥梁。Intent不仅可以用于启动一个新的Activity,还可以启动Service、BroadcastReceiver,甚至可以传递数据。本资料...
2. 隐式Intent:不直接指定目标组件,而是通过Action、Category、Data等元数据来描述意图,让系统根据这些信息自动匹配合适的组件。 二、Intent的构造 Intent的构造通常涉及以下几个关键部分: - Action:定义...