Small Victories
Yesterday feels like a victory. I managed to rewrite my coffee machine twice. The first time was to create menu options and make it so that the machine could respond to someone trying to buy one of three different types of coffee, or refill the machine, or remove money from the machine.
The second rewrite made sure that the machine always presented the initial menu once a transaction was complete until the machine was turned off. The second part of the rewrite made sure the user could cancel out of making a purchase before deciding which type of coffee to buy.
The second iteration showcased the power of break statements. I had to track down a few things and figure out why after creating a coffee the machine was asking the user for restock information. The nested switch for the coffee choice ended up missing the last break statement at the end of the entire switch code (rather than just in each individual case.)
Getting it to work felt like a small victory. And then I learned I'll be recoding the entire machine as an object. So for now I'm continuing learning before wrapping up my initial project. I'm just impressed that even in this initial form, my machine is totally usable.



Comments
Post a Comment