Skip to main content

Timeline for Making classes available to others

Current License: CC BY-SA 3.0

12 events
when toggle format what by license comment
May 27, 2011 at 20:15 comment added Maik Semder It is known as the BaseBean Anti-Pattern.
May 27, 2011 at 20:02 comment added Maik Semder Hence there is no obvious contract (read: clear interface) to the users of the controller-class, just a huge interface mess.
May 27, 2011 at 19:59 comment added Maik Semder The controller class interface will be polluted by each and every public method of any inherited device. It's not controlling anything, just being bypassed. Users can simply call Mutitouchscreen-methods on the controller, even though there might not even be such a device on the current machine. Its supposed to be the job of a controller to call methods on the individual device, the user must not even see the devices nor care from which device the input is coming from. Such a class can be called a controller. But the above posted design exposes all devices instead of controlling access to them.
May 27, 2011 at 18:48 comment added Ali1S232 @Maik, in my design there are some classes that have basic functionality for use of every input, there is no limit why you should define base classes that can use trackball or multitouch Screen, and for the second gamepad there are two approches, you can either define your GamePad Controller to provide support for second gamepad or have a array of 2 or more GamePads in your base GamepadReader class.
May 27, 2011 at 18:45 comment added Ali1S232 when you say c# doesn't support multiple inheritence it's a fair point, but at least my answer can meet all the question needs, it's not singleton, almost not a global variable, and it doesn't insult encapsulation,
May 27, 2011 at 17:54 comment added Maik Semder -1 What will you do with a Trackball, Multitouch Screen, Gamepad? Inherit from them too? What about a second Game-Pad? Really terrible design!
May 27, 2011 at 17:16 comment added Tetrad Also this is exactly the kind of overuse of inheritance that people have been shying away from. A game controller should not have a "is a" relationship with an input manager. At the very least you should make the inheritance private. But a less messy solution (for example, to avoid multiple inheritance name collision) would be to use composition, but since in this case you're using static instances you'd have to make them public anyway, the composition members wouldn't actually do anything, so you might as well make them globals.
May 27, 2011 at 17:01 comment added Tetrad -1 because c# doesn't support multiple inheritance
May 27, 2011 at 13:11 history edited Ali1S232 CC BY-SA 3.0
added 41 characters in body
May 27, 2011 at 12:41 comment added Ali1S232 and that's what my answer is all about, for all your resources you have a base class that can use that, and every class that need to use resources, should inherit from classes that provide them, in these architecture there is no need for singleton but you still have some static variables in your code. in this approch the keyboard value in KeyboardReader is once initialized by some class, (for example main function) and after that it's that value is shared with all the classes that inherit KeyboardReader. without passing keyboard to them or defineing Keyboard as a singleton.
May 27, 2011 at 11:25 comment added Jonathan Connell Thanks but my question is more about global architecture, not inheritence.
May 27, 2011 at 11:05 history answered Ali1S232 CC BY-SA 3.0