logo

Factory and Adapter Patterns

   

Added on  2019-09-13

10 Pages1460 Words601 Views
 | 
 | 
 | 
Factory and Adapter PatternsThe goal of this project is to give you experience withthe factory and adapter patterns. Note: The assignment must be completed in the specific manner described in the instructions. Any deviations from the instructions will possibly cause the automated grading to fail and will be considered incorrect. Following the instructions includes, but is not limited to:Do not change the test code in any way. If the test code does not compile, change your implementation of the classes being tested, not the tests! (you may add additional tests)Do not modify interfaces and abstract classes provided to you in any way unless specifically instructed to do so.Do not modify class constructors, method signatures, or local field names unless specifically instructed to do so.Do not add fields to any classes unless specifically instructed to do so.
Factory and Adapter Patterns_1

High Level GoalWe will again be continuing development of our Blobgame by using the factory pattern to create different game configurations which will determine how blobs and points are created and how blobs are turned intoGameStateObservers. By using the factory pattern we can ensure that the game remains consistent.For instance, in previous versions of the code we allowed users to create Blob objects and provide them to the game. This means that the user could also initialize the Blob with a SimplePoint or BoundedPoint. If we wanted all objects to remain in abounded game space, this would not work.To get around this, we could, for example, create a factory that performs the actual Blob creation and code it to use BoundedPoint objects and guarantee that all blobs created using this factory are bounded!We will apply this principle to a few other cases and then we will make our Game configurable by passing it a factory providing the functionality it needs to create Point object, Blob objects and for creating GameStateObserver objects which adapt Blobobjects so that they can observe the game state changes in a consistent way.As with previous projects, some of the classes you have used in the past have changed slightly, so be sure to pay attention to the specifics of this project
Factory and Adapter Patterns_2

and do not assume that you know what all the interfaces, classes, etc. look like already! The changes from the previous project include, but are not necessarily limited to the following:The SimpleBlob no longer implements GameStateObserver in order for a Blob to observe game state, we must use an adapter.To join the game, you no longer provide a Blob. Instead, you will simply provide a MoveStrategyand the Game will actually create the Blob using a factory, then the Blob will be returned to the callerTestingYou are provided with a very inadequate test suite and will need to write additional tests in order to make sure that your code works properly. To help with this task, I have added testing notes below to get you thinking in the right direction.
Factory and Adapter Patterns_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Refactoring and DAO Implementation
|5
|775
|296

Task 7.1 - Initial Setup
|7
|3497
|353

Image Class Design and Implementation
|2
|819
|278

C# and ASP.NET: A Powerhouse Combination
|12
|2581
|488

Comparing WordGram Objects
|13
|6068
|431

Drawing a House Using Shapes
|16
|2346
|292