Abstraction is one of the https://stackify.com/oops-concepts-in-java/ of object-oriented programming (OOP) languages. That’s a very generic concept that’s not limited to object-oriented programming.

In this case, the hazelnut coffee bean itself is an abstraction of the original data, the raw coffee beans.

import org.thoughts.on.java.coffee.CoffeeException; import java.utils.Map; public class CoffeeMachine { private Map beans; public CoffeeMachine(Map beans) { this.beans = beans } public Coffee brewCoffee(CoffeeSelection selection) throws CoffeeException { Coffee coffee = new Coffee(); System.out.println(“Making coffee...”); return coffee; }}

public class Grinder { public GroundCoffee grind(CoffeeBean coffeeBean, double quantityCoffee) { //... }} public class BrewingUnit { public Coffee brew(CoffeeSelection selection, GroundCoffee groundCoffee, double quantity) { //... }}

Related Articles