关于Component Diagram中同主机内部数据库表示方式的技术咨询
Should a Colocated Internal Database Be a Separate Component in a Component Diagram?
Great question! This is a common point of confusion when building component diagrams, and the answer boils down to two key considerations: the level of detail you need to communicate, and the architectural significance of the database to your system.
When to Represent It as a Separate Component
- If your application treats the database as a distinct logical service (even if it’s on the same host), go with a separate component. This is especially true if:
- You might split the database onto its own host in the future (even hypothetically)
- Other components (even running locally) interact directly with the database
- You need to make explicit dependencies clear to your audience (developers, architects, stakeholders)
- Label it something like
Internal Databaseand define its interface (e.g.,Database CRUD API) to show how your application component interacts with it.
When to Embed It in the Main Application Component
- If the database is a purely internal implementation detail with no external interactions or future separation plans, you can include it within your main application component. For example:
- A local SQLite database that only this specific app instance uses
- A database that’s tightly coupled to the app’s code and can’t function independently
- In this case, you can note the database in the component’s description or interface documentation (e.g.,
MyApp - Includes embedded SQLite database) instead of drawing a separate box.
Key Takeaway
The priority is clarity for your audience. If the database’s existence and interactions are relevant to understanding the system’s architecture, make it a separate component. If it’s a hidden detail that doesn’t impact the overall design, embedding it is perfectly acceptable.
内容的提问来源于stack exchange,提问作者Amr Saeed
相关产品推荐
相关产品推荐

