Trusted by 2+ million users, 1000+ happy students everyday
Showing pages 1 to 3 of 10 pages
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.
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
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.
Found this document preview useful?
You are reading a preview Upload your documents to download or Become a Desklib member to get accesss