views:

56

answers:

3

im developing a game in android, and i've been thinking about subdividing many of the elements of the game (e.g. game objects) into separate classes and sub-classes. but i know that method calls to these objects will cause some overhead. would it be better to improve performance or to improve extensibility?

A: 

Only you can answer that question - some games require the utmost in performance, others become so complex that ease of extensibility is the only way to go.

Bear in mind though that the 'overhead' you're referring to is likely to be VERY small - nearly infinitesimal - and should not be high on your list of concerns for any initial release.

Remember too that it's always easier to extract performance later, the same can not be said of extensibility.

Finally, note that premature performance tweaks frequently fail. Ascertaining where the performance bottlenecks are can seldom be predicted, testing in situ is far more like to yield good results.

KevinDTimm
Indeed, remember the quote "Premature optimisation is the root of all evil"! In other words, don't try to make it 'better' until you know that it will actually make a difference, and that the difference is needed.
Steve H
A: 

Have you considered inline functions? That way you may preserve extensibility and clearness of code, ideally without a performance loss.

Vincent
A: 

At first just build in the most elegant way.

At last optimize the bottlenecks leaving the rest intact.

Lo'oris