SA : Component-based Architecture 基于构建的软件架构
《Software Architecture with Spring 5.0》参考书
https://spring.io 参考资料
软件体系结构的定义
Architecture is a subjective thing, a shared understanding of a system’s design by the expert developers on a project. Commonly this shared understanding is in the form of the major components of the system and how they interact. It’s also about decisions, in that it’s the decisions that developers wish they could get right early on because they’re perceived as hard to change
Software Component
定义
A software component is a unit of composition (用来组装的单元) with contractually specified interfaces(合同化明确的接口) and explicit context dependencies(显式的依赖) only. A software component can be deployed independently(独立地部署) and is subject to composition by third parties
CBSE
- Component-based software enginerring
- Goals
- Assemble a system out of existing components
- Update a system by adding / replacing components
CBD
- Component-based development
构建模型
- Facets : 部件提供的功能
- Receptacles :需要外界提供的东西
- Event sinks :对系统中某些事件感兴趣的监听器
- Event sources :在系统中产生事件
- Attributes :可以通过Attributes调整构建的工作模式
- interface :管理接口,可以通过它创建、销毁部件
哲学家问题
控制反转 IoC
提供服务的组件是被"注入"的而不是被“直接写入”到请求者的代码中
解决问题:
A component should NEVER create (instantiate) its dependencies
IoC means that a component does not create (instantiate) its dependencies but has someone else creating them for it.
Inversion of Control 实现方法:
- Dependency Injection
- Service Locator