- Sparta, 13
Rohan, Rupanshu, Sumith, Yogesh
One can imagine that simulating a football game and coding it up, will be a huge object-oriented problem. There are more than one ways in which various objects interface i.e. ball, players, referee, strategies, etc.
In the software engineering world consistent classification of patterns for common design problems are provided.
And a football match requires more than one.
Our goal was to get close to Fifa Manager, we'll brief on how close we got.
The Ball
The design pattern applied to handle this entity is Observer pattern.
"When the position of the ball changes all players should be notified straight away."
Hence the name, all the player objects are "observing" the ball.
UML Diagram
Screenshot
Check out the code for that implemets Observer Pattern, in our GitHub repo, here.
The Players
The design pattern applied to handle this entity is Decorator pattern.
"A player in a team should have additional responsibilities, like Forward, Defender etc, that can be assigned during runtime. "
Hence the name, you are "decorating" the player objects with various responsibilities as inheritance is no longer an option.
UML Diagram
Screenshot
Check out the code for that implemets Decorator Pattern, in our GitHub repo, here.
The Team Strategy
The design pattern applied to handle this entity is Strategy pattern.
"When the game is in progress, the end user can change the strategy of his team(e.g. from Attack to Defend)."
Hence the name.
UML Diagram
Screenshot
Check out the code for that implemets Strategy Pattern, in our GitHub repo,
here.
A trait-based simulation algorithm was implemented to simulate attack.
Learning points
Scope for improvement
Web and Coding Club, STAB
and all others who contributed to this project