Earlier quoted context omitted.
"It is useless to have a conversation with those who will not listen." Neither of us are listening, because we're both sure we're right. So I'm out. You get the last word, if you want.
Don't be stupid. I'm listening to you. I'm actually responding to you. You say theory is different from the real world so I present you with a real world solution and examples of how it works with embedded specifically. Your job should you choose to continue is to use other real world examples to counter my arguments. That's all, if you convince me it's done, If i convince you it's also done. Until then leaving the d…
void handleEvent1() {
if (currentState == state1) {
currentState = state2;
setHardwareState2();
} else {
currentState = state3();
setHardwareState3();
}
}
You can move state to the boundary, and IO to the boundary, and then... what's left? It was all boundary.A bit more realistically, here's an automobile cruise control that uses the same button for "reduce set speed" and "set the speed". (Don't blame me, I've had more than one car with that exact setup).
void buttonXEvent() {
if (cruiseControlEnabled) {
if (cruiseSpeedSet) {
cruiseSpeed--;
} else {
cruiseSpeed = currentSpeed;
cruiseSpeedSet = true;
}
writeSpeedToEngineComputer(currentCruiseSpeed);
} // else do nothing
}
How would you write this in your approach?