salvin francis wrote:1. If the code only wants to track the states and do nothing else with the lamp, use an array of enums:
wayne brandon wrote:But he said that isn't necessary and had instructed the students that asked that three methods was enough
Carey Brown wrote:<shakes head sadly>
wayne brandon wrote:...but we are only allowed to use 3 methods
I wrote:... using the type system and object-orientation to make decisions and selections. Think more functional.
Winston Gutkowski wrote:
Junilu Lacar wrote:What if you had to implement some conditional logic but couldn't use any if statements. How would you do that?
Well, one thing I remember from my early days is that
x ^ x (and ONLY x) == 0
... probably far below the "objective" level you're talking about. :-)