Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Stay away from singleton if possible</strong></p> <p>Singleton has its uses, however I believe it's overused in a lot of cases.</p> <p>The biggest problem with a singleton is that you're using Global State, which is generally regarded as a bad thing as when complexity in your software grows it can cause you to have unintended side effects.</p> <p><strong>Object composition might be a better way</strong></p> <p>For games you might want to take a look at using Object Composition rather than traditional OOD Modelling.</p> <blockquote> <p>A software component is a software element that conforms to a component model and can be independently deployed and composed without modification according to a composition standard.</p> <p>A component model defines specific interaction and composition standards. A component model implementation is the dedicated set of executable software elements required to support the execution of components that conform to the model.</p> <p>A software component infrastructure is a set of interacting software components designed to ensure that a software system or subsystem constructed using those components and interfaces will satisfy clearly defined performance specifications.</p> </blockquote> <ul> <li><p><a href="https://stackoverflow.com/questions/1901251/component-based-game-engine-design">Component based game engine design</a></p></li> <li><p><a href="http://www.as3dp.com/2009/02/21/design-pattern-principles-for-actionscript-30-favor-object-composition-over-class-inheritance/" rel="nofollow noreferrer">http://www.as3dp.com/2009/02/21/design-pattern-principles-for-actionscript-30-favor-object-composition-over-class-inheritance/</a></p></li> </ul> <p>Reading over the material in the first link should give you some excellent ideas on how to model your inventory system and have it extendable in a nice way.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload