SOLID Principles#
This section contains concepts, notes and examples with diagrams and code about design patterns.
We mostly show text, diagrams and the main pieces of code in the pages, and unit tests can be found in the source code directory for each example.
Some notes and examples on SOLID principles.
SRP: Single Responsibility
OCP: Open–Closed
LSP: Liskov Substitution
ISP: Interface Segregation
DIP: Dependency Inversion
NOTE: The main repo is the one on Gitlab. The Github repo is only a mirror. Discussion, issues, PRs, etc. should be happen on Gitlab.
NOTE: Gitlab renders the PlantUML diagrams (Github does not). Therefore, we strongly recommend that this text be read on the Gitlab repo.
Java#
The Java setup was achieve with this:
$ mvn archetype:generate \
-DgroupId=dev.fernandobasso.solid \
-DartifactId=java \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DarchetypeVersion=1.4 \
-DinteractiveMode=false
And tested with the first time with:
$ cd java
$ mvn package
$ java \
-cp target/java-1.0-SNAPSHOT.jar \
dev.fernandobasso.solid.App
Running the Examples#
Check java/Makefile
. Run the examples with something like:
$ make hello
$ make lsp_productsdiscount_nok1