06-18-2016 07:50 PM
I'm trying to do the Traffic Signal CLD practice program using OOP techniques. As you can tell by my question, I'm new to OOP programming. In my attachment, I've constructed a class for the individual traffic lights in a signal head. Intuitively, it seems that the next step would be to create a class for the traffic signal assembly (signal head) which contains at least 3 of the traffic light objects. But if I do this, I won't be adding any new information. Should I just be satisfied with what I've got so far and instantiate a traffic lite for each of the 4 traffic signal heads?
Thanks in advance.
06-18-2016 09:18 PM
06-19-2016 07:42 AM
Thanks for your advice. Not planning to take the exam. Just trying to learn OOP.
06-19-2016 07:50 AM
The biggest issue I have had with OOP is people trying to make it a lot more complicated than it needs to be. I am with Mike: each individual LED does not make sense as an object (you are not gaining anything at all). But the collection of LEDs that work together does make sense as an object. Then you have 4 of those object for an intersection (which does make sense as an object).
06-19-2016 08:38 AM