Re: [Spaceships] Getting started on a Java-based ship builder
Personally, I would not chain myself to the file format. Tab Separated Values is not the best format for data storage, but it's easy to parse and read, it's a good preliminary format. Do things right, and use proper layer separation between data, business and presentation layers, so you can change the data layer later on, to something more sophisticated. This, I like from your project plan, because you tart with the data, and then slowly move to the upper layers.
As for how to store the systems (and remember, I have just a passing acquaintance with the spaceships system from forum posts and the Vorkosigan book), I would move away from static arrays. Java collections are quite good. I would design the Spaceship object as having 5 vectors (front, central, and real hull, core and systems that don't require slots). Give them the appropriate type via inheritance and interfaces (So a system that can be placed into any location would be a class mySystem extends abstractSystem implements frontHullSystem, centralHullSystem, rearHullSystem, coreSystem). Give your spaceship object appropriate methods to make sure that every system can only be assigned to the proper location (so addFrontHullSystem(frontHullSystem system)). Modularize. Use version control, even if you're working alone.
|