Jump to content

  • Log In with Google      Sign In   
  • Create Account


PixelPrime11

Member Since 08 Mar 2011
Offline Last Active Nov 13 2012 01:45 AM
-----

#4999628 Static self referencing classes, a good idea or not?

Posted by PixelPrime11 on 10 November 2012 - 06:43 AM

Thanks, I can see your point about it potentially closing the door to using further instances of the class for other reasons.

It might help to give some background on the class. It's a Canvas for a drawing / modelling application, so I know for a certainty that there can only ever be one instance of the class active at any time (this isn't a multiple-workspace type of project). A workspace can only have one canvas.

Perhaps I need to think about reorganising the communication of data between the classes outside of the workspace so that rather than relying on a call directly to a static method inside of the Canvas object, I can pass a reference to the (only) instance of the Canvas to the required classes as an argument.

It'll just mean a bunch of refactoring - but eh, if we had a few bucks everytime we did that... Posted Image


PARTNERS