I've been making more of an effort lately to build better OO designs, creating classes for distinct collections of members etc. However, i've hit a bit of a wall in my project.
The program is designed to control an automated watering system. The system is split into multiple bays which are turned on and off independantly.
I have my form which shows a map of the system with a custom button for each bay. I also have controls that allow the user to create a sequence of bays. eg, turn on bay 1, then bay 2, then 3 & 4..etc.
I have a class which stores details of the bay, one which stores a step in the sequence, one which stores the entire sequence and the form to handle user input. (see attached class diagram)
The problem i have is that the Bay Class has a draw method that paints it to the form. The colour it is painted depends on wether the bay is on or off. This is no problem since the on/off status is stored within the bay. The problem is that i need to add a third colour option, the third colour will be used if the bay isnt on in the current step, but IS part of a different step in the sequence.
My quandary is this: do i a) include a flag in the bay to show that it is in another step, b) have the step check with the sequence to see if any steps contain it, or c) check in the main form and pass a colour to the draw method?
Ive always had a problem thinkin in terms of OO...my early projects were coded ENTIRELY on a single form...makes me cringe looking back lol. To my mind, having a flag in the bay class is storing information about the sequence in the bay which doesnt feel right, but having the bay communicate with the sequence feels wrong too; i may be wrong, but i thought the classes behaviour should be internal.
Anyone with a good grasp of OO wanna throw me a bone :p Whats the best way to handle this, and have i made a complete mess of it so far. I'd rather get it right and get a better grasp on OO than kludge it :)