Saturday, February 03, 2007

Encapsulate - Please!

I just spent the last hours trolling through the Fall of Rome source encapsulating Pop Center types. The concept of pop center type was littered throughout the code as public characters - either 'C', 'T' or 'V'. This has made it exceedingly painful to introduce the new Kingdoms of Arcania pop center types, like the hamlet. The code never cares about the letters C, T or V - they care about what these letters represent. Unfortunately, the logic that applies to cities, towns and villages is now spread throughout the application instead of being encaplated in one centralised location.

This work has laid the foundation for proper Cities, Towns and Villages to come to life in the code. Once I manage to encapsulate the behavior, I will then be able to add the new pop center types.

For any software develoeprs reading this, please encapsulate your data. It makes life so much easier for the next person.

0 Comments:

Post a Comment

<< Home