Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Application Revise the code to incorporate common design patterns to make your code more efficient. Given the starter code, complete the Game Service, Program Driver,

Application
Revise the code to incorporate common design patterns to make your code more efficient. Given the starter code, complete the Game Service, Program Driver, and SingletonTester classes.
Begin by uploading CS 230 Project One Game App.zip as a new project in Eclipse. A tutorial is available for uploading files to Eclipse: Uploading Files to Eclipse Desktop Version Tutorial PDF. Please note: You will not complete the Player and Team classes at this time.
To view the tasks you have been assigned, navigate in your Eclipse project to the Window, Show View, and Tasks view. You can double-click on any of the tasks (as seen in the image) to be directed to the line of code that needs to be completed where the tasks are located. A text version of this image is available: FIXME Text Version Word Document.
Review the code for the Game Service class provided for you. Notice the static variables holding the next identifier to be assigned for game Id.
Use the singleton pattern to adapt an ordinary class definition, so that only one instance of the GameService class exists in memory at any time.
Explain the purpose and characteristics of the singleton pattern you are using in the context of this application. Include this brief explanation as comments in your code. The comments will be used to communicate your understanding of the pattern you implemented to your instructor.
This multi-user game application must have the ability to have multiple instances of the game running at once, each having players and teams. Often, individual instances of the game will prompt users to save the new game being played. To ensure there are no duplicate instances of the game at the point of saving, the application must check to ensure that the name chosen by the user is not already in use.
To meet this requirement, you will want to use an iterator pattern in the application. This will ensure that when a user starts a new game to play, the application checks every instance of the game already in play to determine if the new name chosen by the user is in use. Currently, most frameworks have iterator capabilities built in; it is rare to need to build an iterator from scratch. Therefore, well practice using one provided in Java.
In the Game Service class, use the iterator pattern to complete the coding for the addGame() and both getGame() methods. Note: The getGame(name) method is needed to allow a game instance to be retrieved using only the unique name.
Explain the purpose and characteristics of the iterator pattern you are using in the context of this application. Include this brief explanation as comments in your code. The comments will be used to communicate your understanding of the pattern you implemented to your instructor.
Demonstrate industry standard best practices to enhance the readability of your code, including appropriate naming conventions and in-line comments that describe the functionality.
Run and compile the code to ensure the application is functional and the requirements have been met.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions