I am toying with a game (or maybe just a simulator) that involves a lot of data. I need to define lots of characters, skills, creatures and so on. I suppose ideally I should use XML or JSON to store the data but I’m lazy so I am creating little subclasses like this:
public static class FightingBow extends Skill {
private FightingBow() {
name = this.getClass().getName();
experienceMultiplier = 2;
skillCost = SkillCost.linear;
lock = new BowTraining();
description = "General skill in using bows.";
}
And I have one big class called Skills containing lots of the above inner class definitions.
So I am effectively turning Java into a data file format. Of course this does not lock me in to compiled code, down the road I can add a file reader to load the data from XML. And some regular expressions will convert my Java data file to XML for me - but I was wondering if this approach is in general evil for reasons I cannot see, or virtuous?