Sat 03 Feb 2007 08:50:50 PM UTC, original submission:
As it is mentioned in many Game programming books, tutorials and articles, we should program to interface, not classes. Also, it is almost impossible to create a good object hierarchy, but with interfaces it is different.
TASK: We should redesign the engine to use interfaces.
Few proposals:
interface Movable {
int linearVelocityX;
...
}
interface Drawable {
void draw(...);
}
interface ITrigger {
...
}
[note: give names like "Something"able or like I"Something"]
We should also use composition of objects instead of extending - is the public opinion ;)If we decide that interfaces are better and smarter way to program, then we should also decide what to do with methods defined in abstract classes. Maybe move them to static utility classes? Or let every implementation define them?
CONCLUSION: we need to talk about this more. Game design is very important, and if we continue to program in wrong direction, it may be difficult to refactor the code later. Maybe few (UML) sketches can help.
|