Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rattfieldnz/factorydesignwildlifesimulator
This is my first go at implementing the Factory Design Pattern for an application. By using this design pattern, I was able to decouple a lot of code, by delegating responsibility of animal creation to their respective factories. In this example, I implemented two factories - one for North American species, and the other for Australian species. After finishing this application, I quickly realized the code will be easier to maintain than previous applications I have coded. I used Single Responsibility principle so each object is only responsible for its own jobs, Open-Closed principle so classes/objects can be modified by extension, and the Liskov Substitution principle for the Animal classes (each child can be substituted for it's base class).
https://github.com/rattfieldnz/factorydesignwildlifesimulator
Last synced: 2 days ago
JSON representation
This is my first go at implementing the Factory Design Pattern for an application. By using this design pattern, I was able to decouple a lot of code, by delegating responsibility of animal creation to their respective factories. In this example, I implemented two factories - one for North American species, and the other for Australian species. After finishing this application, I quickly realized the code will be easier to maintain than previous applications I have coded. I used Single Responsibility principle so each object is only responsible for its own jobs, Open-Closed principle so classes/objects can be modified by extension, and the Liskov Substitution principle for the Animal classes (each child can be substituted for it's base class).
- Host: GitHub
- URL: https://github.com/rattfieldnz/factorydesignwildlifesimulator
- Owner: rattfieldnz
- Created: 2014-03-19T06:08:27.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-03-19T06:15:01.000Z (over 10 years ago)
- Last Synced: 2024-10-12T10:47:16.455Z (about 1 month ago)
- Language: C#
- Size: 391 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FactoryDesignWildlifeSimulator
==============================This is my first go at implementing the Factory Design Pattern for an application. By using this design pattern, I was able to decouple a lot of code, by delegating responsibility of animal creation to their respective factories.
In this example, I implemented two factories - one for North American species, and the other for Australian species. After finishing this application, I quickly realized the code will be easier to maintain than previous applications I have coded.
I used Single Responsibility principle so each object is only responsible for its own jobs, Open-Closed principle so classes/objects can be modified by extension, and the Liskov Substitution principle for the Animal classes (each child can be substituted for it's base class).
I could also create a factory for the continents in this application - e.g. if I wanted to add South American or African animals.