Presentation is loading. Please wait.

Presentation is loading. Please wait.

Reusing Patterns in the ARENA Case Study Done by: Fatma Al-Ansari.

Similar presentations


Presentation on theme: "Reusing Patterns in the ARENA Case Study Done by: Fatma Al-Ansari."— Presentation transcript:

1 Reusing Patterns in the ARENA Case Study Done by: Fatma Al-Ansari

2 Outlines: ARENA Object design patterns –Abstract Factory design pattern –Command design pattern –Observer design pattern Lessons Learned:

3 Abstract Factory design pattern We shield the Tournament and League object from Game specifics by turning the Game abstract interface into an AbstractFactory. This way, only concrete Products need to be supplied for a new concrete Game.

4 Abstract Factory design pattern Arena LeagueOwner Statistics Chess LeagueGame Result Player Match TicTacToe Move Tournament

5 Abstract Factory design pattern Game CreateMatch() CreateStatistics() Tournament TicTacToeChess Match playMove() Replay() Statistics Update() getStat() TTTMatchChessMatchTTTStatsChessStats

6 Command design pattern We shield the objects related to playing and replaying Matches by encapsulating concrete Moves for each Game.

7 Command design pattern ReplayedMarch nextMove() previousMove() Match play() replay() Move execute() * GameBoardTicTacToeMove ChessMove “binds”

8 Observer design pattern We standardize the interactions between Match and Move entity objects with MatchView objects across all Games with a subscriber/publisher paradigm.

9 Observer Design Pattern Subject subscribe (Subscriber) unsubscribe (Subscriber) notify() Observer update() GameBoard getState() playMove() state MatchView update() gameBoard * 1 observers

10 Lessons Learned Design patterns mesh and overlap –F–For example, the Match class participates in two patterns. It is an abstractProduct in the Abstract Factory and an Invoker in the Command pattern.

11 Selecting the right pattern is not trivial. –T–There are many published catalogs of design patterns. Unless a developer is familiar with them and has used them in the past, it is difficult to assess which pattern to apply in which context. This emphasizes the importance of documenting patterns with example, which can then be used by developers to assess whether a specific pattern is applicable to their problem.

12 Design patterns must be refined. –P–Patterns are template solutions, and most often must be adapted to the problem at hand. When refining a pattern, the use of specification inheritance and delegation must be examined carefully so that the extensibility advantages provided by the pattern are not destroyed.

13 Thank you


Download ppt "Reusing Patterns in the ARENA Case Study Done by: Fatma Al-Ansari."

Similar presentations


Ads by Google