Is the decorator pattern really needed here?

Is the decorator pattern really needed here?

I am learning the decorator design pattern from the Head first design patterns book. Their example treats different types of coffees as a Beverage. The beverages are decorated with things like milk, soy, whip cream etc. For example, the DarkRoast coffee with mocha and whip cream :&nbsp;<a href="https://i.stack.imgur.com/AaQQY.png" target="_blank"><img src="https://i.stack.imgur.com/AaQQY.png"></a>

I am learning the decorator design pattern from the Head first design patterns book. Their example treats different types of coffees as a Beverage. The beverages are decorated with things like milk, soy, whip cream etc. For example, the DarkRoast coffee with mocha and whip cream : 

The class diagram : 

I understand that this example is used only because it is simple. But, I have an alternate and simpler way to implement this example without decorator pattern. We can have an Item class with description and cost. Then, the Beverage class can have baseCost, totalCost and list of Items.

Does this alternative design have any major disadvantages over the decorator pattern ? Can you give any specific scenarios where the decorator pattern would be better than my design ?

PS - In case anyone wants to see the decorator code : https://github.com/bethrobson/Head-First-Design-Patterns/tree/master/src/headfirst/designpatterns/decorator/starbuzz

java design-pattern

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Proxy Design Pattern in JAVA

In this blog, we will discuss Proxy Design Pattern, its example, and how it is different from the other design patterns. But, it’s important to have an understanding of the design patterns first. You can refer here.

Java Design Patterns for Beginners - Design Patterns in Java

"Java Design Patterns for Beginners - Design Patterns in Java - Design Patterns Tutorial" will provide you with detailed knowledge about Java Design Patterns and along with it. Why do we need Design Patterns? Structure of Design Patterns. Types of Design Patterns. Creational Design Patterns. Factory Design Pattern. Overview of Design Patterns

Design Patterns — Decorator Design Pattern

The decorator design pattern is a software design pattern that helps you add responsibilities to an object at runtime. This pattern is considered to be a structural design pattern. This type of pattern focuses on the relationships between classes and how they can help solve specific problems.

Abstract Design Pattern in Java

In this blog, we will discuss Abstract Design Pattern, its example, and how it is different from the Factory Design Pattern. But, it’s important to have an understanding of the Factory Design Pattern first.

Design Patterns for Beginners with real-world Examples

Design Patterns for Beginners with real-world Examples. When do you use Design Patterns? How do you implement different Design Patterns in Java? What are Design Patterns? Why do you use Design Patterns? What are the different types of Design Patterns? When do you use Design Patterns? What are the real-world examples for Design Patterns.