Skip to content

Commit

Permalink
Add LO-OCP
Browse files Browse the repository at this point in the history
  • Loading branch information
damithc committed Sep 12, 2016
1 parent dee0384 commit 309456a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions doc/LearningOutcomes.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ After studying this code and completing the corresponding exercises, you should
1. [Use Java-FX for GUI programming `[LO-JavaFx]`](#use-java-fx-for-gui-programming-lo-javafx)
1. [Apply Dependency Inversion Principle `[LO-DIP]`](#apply-dependency-inversion-principle)
1. [Use Dependency Injection `[LO-DI]`](#use-dependency-injection)


1. [Apply Open-Closed Principle `[LO-OCP]`](#apply-open-closed-principle)

------------------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -124,3 +123,16 @@ Covered by `[LO-Polymorphism]`

------------------------------------------------------------------------------------------------------

## Apply Open-Closed Principle `[LO-OCP]`

#### Exercise: Add a new command

* Add a new command to the Address Book. e.g. an `edit` command
* Notice how little you need to change in the `Logic` class that is responsible for executing the commands.
That is because classes `Logic` and `*Command` follow the OCP i.e. `Logic` is *open to be extended* with more
commands but *closed for modifications*.
* Think about how to make the `Person` class similarly open to be extended with more contact details
(e.g. `SkypeId`) without needing modifications to its code during those extensions.

------------------------------------------------------------------------------------------------------

0 comments on commit 309456a

Please sign in to comment.