Skip to content

Open-Closed

The OCP principle in short is defined as "A software artifact should be open for extension but closed for modification". You should avoid situations where new requirement causes the existing system architecture changes. Such changes are costly and usually lead to a project failure.

Can you design the CityShare in a way it anticipates new type of subjects to share in future? Should the rental process depends on concrete type of subject? What is generic and what is specific for each already known subject type?

Boat hiring experiment

Let's imagine you want to expand the business so the CityShare offers hiring boats in cities with canals as Amsterdam. Does the current design support such extension? Is there any refactoring and on which system level required?

ocp-example

Recommendation

You should design the system in a way to create re-usable and highly cohesive components, which are organized in layers with clear responsibilities and dependencies. Changes in lower level layer components should not introduce changes to compoments in upper levels.

References