Saturday, March 24, 2007

Simple Components

XNA Framework provides the simple task mechanism whose name is "GameComponent". I did not understand the concept of this class at first. GameComponent is very simple and is not better than various task systems that I have seen. I thought that this class is just utility class for beginners.

But, now, I understand the merit of this class design a little.

The GameComponent has only minimum methods --- Initialize, LoadResouce, UnloadResouce, Update, Draw, Dispose and some events... These methods are fundamental process that all classes need. So, sub-classes of GameComponent are always exportable for other projects.

When a developer defines exchangable components, he tries to write helpful mechanism for rapid development. But, a class having many methods needs discussions, because it has extra features which are not must to exchange.

A class which is pure for its goal does not have extra methods, even if it looks poor.

No comments: