With only a small number of object types in the game, the database function list is already unwieldy and not easily expandable. For example, while adding ports, you need to modify:
save_object()
_write_file()
_read_file()
and add:
add_port()
get_port()
The problem is that add_port and get_port are basically copied from other parts of the FlatFileDatabase class definition, which generates ugly, duplicated code. This also limits the expandability, since you need to add functions to the base Database class when you want to an an object to the universe.
One part of this should be implementing load_object, which should take some sort or parameters list which will have the object type and its name
Then all of the add* and get* functions should be deprecated so the save_object and load_object are used instead. With that, there are only two functions in Database that need to be modified, and nothing added.
With only a small number of object types in the game, the database function list is already unwieldy and not easily expandable. For example, while adding ports, you need to modify:
and add:
The problem is that add_port and get_port are basically copied from other parts of the FlatFileDatabase class definition, which generates ugly, duplicated code. This also limits the expandability, since you need to add functions to the base Database class when you want to an an object to the universe.
One part of this should be implementing load_object, which should take some sort or parameters list which will have the object type and its name
Then all of the add* and get* functions should be deprecated so the save_object and load_object are used instead. With that, there are only two functions in Database that need to be modified, and nothing added.