Skip to content

milotodorovich/gripnsip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gripnsip

Example repo to discuss composition.

This repo runs a simulation against two different ways of organizing code. The results are almost the same. Yet, the design using composition leads to less code, simpler code, and more flexibility.

Take a look and see for yourself.

Commands

mvn clean
mvn test
mvn package
mvn exec:java

Output

STARTING HIERARCHICAL SIMULATION:
Pouring your new coffee
Daniel is enjoying their drink.
Gripping coffee
Sipping coffee
Daniel is satisfied.

Pouring your new iced tea
Speedy is enjoying their drink.
Gripping iced tea
Protecting your shirt.
Sipping iced tea
Speedy is satisfied.

Pouring your new boiled tea
Sniffly is enjoying their drink.
Protecting your hands.
Gripping boiled tea
Sipping boiled tea
Sniffly is satisfied.

Pouring your new extra-hot coffee
Wired is enjoying their drink.
Protecting your hands.
Gripping extra-hot coffee
Protecting your shirt.
Sipping extra-hot coffee
Wired is satisfied.

STARTING COMPOSED SIMULATION:
Pouring your new coffee
Daniel is enjoying their drink.
Gripping coffee
Sipping coffee
Daniel is satisfied.

Pouring your new iced tea
Speedy is enjoying their drink.
Gripping iced tea
Protecting your shirt.
Sipping iced tea
Speedy is satisfied.

Pouring your new boiled tea
Sniffly is enjoying their drink.
Protecting your hands.
Gripping boiled tea
Sipping boiled tea
Sniffly is satisfied.

Pouring your new extra-hot coffee
Wired is enjoying their drink.
Protecting your hands.
Gripping extra-hot coffee
Protecting your shirt.
Sipping extra-hot coffee
Wired is satisfied.

COMPOSITION ALLOWS MORE OPTIONS!
Pouring your new extra-hot coffee
Quite Picky is enjoying their drink.
Protecting your hands.
Gripping extra-hot coffee
Protecting your shirt.
Sipping extra-hot coffee
Quite Picky is satisfied.

...and if it's still too hot...
Quite Picky is enjoying their drink.
Protecting your hands.
Protecting your hands.
Gripping extra-hot coffee
Protecting your shirt.
Sipping extra-hot coffee
Quite Picky is satisfied.

Just right!

About

Example repo to discuss composition.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages