Advanced Programming Techniques (COSC1076)
Pastry Vending Machine
2023 · Group Project (Syntax Squad) - 4 members

✦ THE IDEA
What were we trying to build?
The assignment was to build a pastry vending machine in C++, but it quickly became more complicated than simply taking an order and returning change. The system had to manage pastry stock, purchases, payments, inventory, and coin denominations while handling files, memory, user input, and different program states. We also had to build our own linked-list data structure rather than relying on the one provided by the C++ library.
✦ THE JOURNEY
How did we get there?
I worked as part of a four-member team to develop the vending machine, while also taking on several individual enhancements to push the system further. I added colour-coded payment feedback so users could immediately see the amount still owed, incorrect denominations, and change being returned. I then took the original linked-list structure and transformed it into a two-dimensional linked list, changing how the stock was organised and requiring several existing functions to be reworked around the new structure. Finally, I redesigned the main menu using the Command Design Pattern, creating separate command classes for each menu action and an invoker responsible for executing them.
✦ THE CHALLENGE
Where did things get tricky?
The biggest challenge came when I changed the linked list into a two-dimensional structure. The change wasn't isolated to one class or function — the way stock was loaded affected how it needed to be sorted, added, removed, and accessed elsewhere in the program. I had to trace these dependencies and make sure the new structure worked across the system without breaking existing functionality. This was one of the first times I experienced how a seemingly small architectural change can ripple through an entire codebase.
✦ WHAT I TOOK AWAY
What did this project teach me?
This project changed the way I think about data structures and program design. I became more confident working with C++, pointers, dynamic memory, linked lists, file processing, and exception handling, while also getting hands-on experience restructuring an existing implementation rather than always starting from scratch. Implementing the Command Design Pattern also showed me how separating responsibilities can make a system easier to extend when new functionality needs to be added.