I'm currently writing a networked application, and I just wanted to bounce my ideas off you guys and make sure I'm not doing anything awful.
The interaction of my objects looks like this:
The client and server both have copies of the networking components (for communicating changes to each other) and the model (for storing the current state of the information). I am now at a stage where I want to store the model in a MySQL database so I am planning on adding SQLView objects.
I am having hesitations since this is now a third type of view in my system; I have read that software should have no more layers than is necessary. Alternatively, I am considering adding logic to the NetworkView along the lines of:
if this is the server: push the change to the database
What seems reasonable to you guys?
A further niggling doubt in my mind is that I have moved away from model objects being related via composition, and instead am using ids. By doing this I am hoping my model will work nicer with the database, and I am preventing situations where every single relation of an object needs to be loaded at the same time.
This raises questions about how model objects will be loaded in the first place, since they will need to be requested from the server. Furthermore, in the same way I have a MenuManager for the MenuViews and a NetworkManager for the NetworkViews, I will need to have a manager for the loose model objects.
In this case, I feel like perhaps I am writing "god" objects.
Apologies for the rambly post, I'm just looking for some reassurance that I'm making good decisions. Alternatively, this project is very young, so please tell me if I should rewrite everything.