← Back to Projects

Coffee Shop

A customizable coffee ordering system using the Decorator design pattern.

Decorator Design PatternObject-Oriented DesignJavaFX

About This Project

The Coffee Shop project is a JavaFX application that demonstrates the use of the Decorator design pattern to dynamically build coffee orders. Each order begins with a basic black coffee and allows users to add or remove various add-ons such as cream, sugar, extra shots, vanilla and cinnamon. The application uses FXML and CSS to separate UI layout and styling from application logic, and follows a clean MVC-style structure with controller classes handling user interaction. The final order displays a detailed cost breakdown for each add-on along with the total price, and users can reset and build multiple orders within a single session.

Key Features

  • Build coffee orders dynamically using the Decorator design pattern
  • JavaFX GUI with FXML layout and custom CSS styling
  • Ability to add and remove coffee add-ons and view a full price breakdown
  • Support for creating and resetting multiple orders in one session
  • Unit-tested core logic using Maven and JUnit

Technologies Used

  • IDE: VS Code
  • Java
  • JavaFX
  • FXML
  • CSS
  • Maven
  • JUnit

Challenges & Learnings

Challenges:

One of the main challenges was managing the dynamic addition and removal of decorators while maintaining accurate pricing and order descriptions. Ensuring that the GUI stayed synchronized with the underlying decorated coffee object required careful controller logic. Integrating JavaFX with Maven and properly structuring FXML, CSS, and controller classes was also challenging, especially while keeping the design pattern implementation clean and testable.

What I Learned:

This project strengthened my understanding of the Decorator design pattern and how it can be applied to real-world scenarios. I gained hands-on experience building JavaFX applications using FXML and CSS, reinforcing the importance of separating UI, logic, and styling. Additionally, working with Maven and unit tests improved my confidence in creating maintainable, well-tested object-oriented applications.

This project was created in November 2025