Question

Software design [Singleton v.s. Static] You are producing a mobile game that allows both single player...

Software design

[Singleton v.s. Static] You are producing a mobile game that allows both single player gameplayer and networked multiplayer gameplay. Your team is debating how you should approach the NetworkController, which is a single point of control for the game's network connections and traffic. The language you are using is C#.

  • Sandy, the system analyst, believes that a Singleton pattern will be needed here
  • Terence, the product manager, believes a static class is sufficient

Please analyze the advantages and disadvantages of the two design choices. Make intelligent assumptions where necessary. Which one would you vote on, and why?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

I would suggest to go with singleton pattern.

Because in case of static class we cannot make instance of it which would be required in network multiplayer gameplay .Incase of singleton we can make a single instance but incase of network multiplayer gameplay a singleton class can be extended with the help of an interface.Singleton object can be passed to methods whereas incase of static class it cant be done.

Singleton is able to implement interfaces

Singleton can inherit from other classes

Singleton is more flexible than static and singleton can maintain its state

Add a comment
Know the answer?
Add Answer to:
Software design [Singleton v.s. Static] You are producing a mobile game that allows both single player...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT