I am currently working on a small game I did in about ten days. Since I am programming for myself, I am being lazy and going to the easiest solution with (too) little concern about bad code quality.
However I am reaching a point where it begins to matter. I am starting to move booleans that references states into classes etc. and now I wanted to know experienced programmers opinion about mutual referencing objects.
What I mean by mutual referencing objects is this: we have a server which can create multiple games, such as chess games when two clients connect to play. Everytime a player makes a move, his connection handler must update a specific board on the server. After the update, once the board is updated, a broadcast of the new state needs to be done to each client.
I found convenient to have two Client objects in the Board (so Board can Client.send() to both) and a Board in each Client (so Client can call Board.update (move)). For some reason, I'm inclined to think this is generally bad and could be avoided, but what is your opinion ?
Is this fine as it is, or am I missing something here ?
Order
needs a collection ofLineItem
's and that eachLineItem
must live under an order, you ought to tightly couple those classes. (Not to imply that you don't also find plenty of opportunity for loose coupling in your "philosophy" layer.)