Anirudha
← Work
15 Days of CodingDay 15September 26, 2025~3 min read

Coffee Machine Program

Building momentum is the most difficult part

Considering how much I love coffee (and the fact that I need at least one cup a day just to function), it feels a little late to be doing this on Day 15… but today I built a coffee machine. Well, not a real one but a program that simulates one. Basically, wrote a program that takes orders for espresso, latte or cappuccino, checks if there are enough ingredients left, asks the user to deposit coins, computes the transaction and finally “serves” your drink.

Like I have been saying every single day, if you look at the full task, it feels like a lot. But breaking it down into small functions like checking resources, handling money and making coffee makes the task easy and much more comprehensible. The function where I had to ask the user to insert quarters, dimes, nickles and pennies felt like designing my arcade machine and I could almost hear the clink clink of coins dropping in while I wrote that function.

It was interesting to write the tracking function for something simple like water and coffee quantities which mimicked inventory control. In the beginning, the machine kept happily serving drinks even when water or milk had run out. Sorry for the bad coffee guys! But then I used a simple check to cross reference the inventory levels first and to print out a simple statement about the ingredients not being enough. I also added a secret command to be used by admins which printed out the current levels of the ingredients as well as the total profit made by the coffee machine. Only thing missing now is the ability to press a button and have a real coffee appear on my desk. One can dream!

Honestly, the hardest part today was… starting. It was Friday, my brain kept saying “just do it tomorrow,” and I procrastinated way too long. But once I finally pushed myself to begin, momentum kicked in, and I ended up doing more than I planned. And that is my insight for today- Resistance vs. Momentum. Some days, starting feels like the hardest part, and you come up with all kinds of reasons to push it off. But once you give that first small push to yourself, you are in it and you end up doing more than you planned to. So if you are struggling with starting something, just set yourself the smallest goal you can and once you start doing it, you won’t stop. I promise!

With the project wrapped up, I’m off to the gym for my favorite workout. Then it’s dinner and weekly movie night with my wife. Honestly, this feels like the perfect way to end the week.

Have a happy weekend, and see you next week!