Factory and Adapter Patterns | Project

Added on - 13 Sep 2019

  • 10


  • 1460


  • 277


  • 0


Trusted by +2 million users,
1000+ happy students everyday
Showing pages 1 to 3 of 10 pages
Factory and AdapterPatternsThe goal of this project is to give you experience withthe factory and adapter patterns.Note: The assignment must be completed in thespecific manner described in the instructions. Anydeviations from the instructions will possibly causethe automated grading to fail and will be consideredincorrect. Following the instructions includes, but isnot limited to:Do not change the test code inanyway. If the testcode does not compile, change yourimplementation of the classes being tested, notthe tests! (you mayadd additional tests)Do not modify interfaces and abstract classesprovided to you inanyway unless specificallyinstructed to do so.Do not modify class constructors, methodsignatures, or local field names unlessspecifically instructed to do so.Do not add fields to any classes unless specificallyinstructed to do so.
High Level GoalWe will again be continuing development of ourBlobgame by using the factory pattern to create differentgame configurations which will determine how blobsand points are created and how blobs are turned intoGameStateObservers. By using the factory patternwe can ensure that the game remains consistent.For instance, in previous versions of the code weallowed users to createBlobobjects and providethem to the game. This means that the user couldalso initialize theBlobwith aSimplePointorBoundedPoint. If we wanted all objects to remain in abounded game space, this would not work.To get around this, we could, for example, create afactory that performs the actualBlobcreation andcode it to useBoundedPointobjects and guaranteethat all blobs created using this factory are bounded!We will apply this principle to a few other cases andthen we will make ourGameconfigurable by passingit a factory providing the functionality it needs tocreatePointobject,Blobobjects and for creatingGameStateObserverobjects which adaptBlobobjects so that they can observe the game statechanges in a consistent way.As with previous projects, some of the classes youhave used in the past have changed slightly, so besure to pay attention to the specifics ofthisproject
and do not assume that you know what all theinterfaces, classes, etc. look like already! Thechanges from the previous project include, but arenot necessarily limited to the following:TheSimpleBlobno longer implementsGameStateObserverin order for aBlobtoobserve game state, we must use an adapter.To join the game, you no longer provide aBlob.Instead, you will simply provide aMoveStrategyand theGamewill actually create theBlobusinga factory, then theBlobwill be returned to thecallerTestingYou are provided with a very inadequate test suiteand will need to write additional tests in order tomake sure that your code works properly. To helpwith this task, I have added testing notes below toget you thinking in the right direction.
You’re reading a preview
Preview Documents

To View Complete Document

Click the button to download
Subscribe to our plans

Download This Document