Git Product home page Git Product logo

coffee-shop-cashier's Introduction

Coffee-Shop-Cashier

A simple Java cashier program (with touch-screen GUI) that I developed a long time ago

Screenshot

screenshot

Functionality

  1. Add Order and display the prices in the screen on the right
  2. Delete previous item
  3. Subtotal = total + tax
  4. If member get discount

Not sure if your shop will be exactly like this but maybe you can use this repo and modify it according to your shop

COPYRIGHT

JUST KIDDING NO COPYRIGHT FOR THIS. PLS USE IT AND STAR THE REPO

coffee-shop-cashier's People

Contributors

obedtandadjaja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

coffee-shop-cashier's Issues

Builder Pattern

Problema. -
La clase Baguel se va armando por masa, spread y topping mediante un conjunto complejo de condiciones esparcidas por la clase. Hay varios casos de código innecesario respecto a la creación del objeto.
image
image
Solución. -
Usando el patrón de diseño creacional de Builder, podemos construir el objeto paso a paso, reusar algún constructor previo y separar responsabilidades. De la misma manera, se podría agregar productor que compartan el mismo comportamiento. Por ejemplo, en un futuro agregar crepes al menú.
UML. -
image

Decorator pattern

Problema. -
Se trabaja con productos que se les puede añadir ciertas características extras que pueden ser tanto todas añadidas a la vez como no o incluso mezcladas entre sí.
image
Solución. -
Por esta razón se recomendaría usar el patrón de diseño estructural de Decorator, este facilitaría la escalabilidad del código e incluso su uso, no creeríamos herencia innecesaria. Podemos combinar varios comportamientos de un objeto con varios decorators y separar responsabilidades.
UML. -
image

Suggestion for a possible Decorator Pattern Implementation for scalability purposes

The way you handle different types of shop's products (coffee, bagels, pastries) is ok, but if you want to add more products of even more flavors, or add variety to the same products it will be hard to update and maintain, in other words, your code could be cleaner and allow scalability pretty well if you consider implementing a design pattern, which in this case I considerer should be decorator
Screen Shot 2020-08-06 at 19 45 47

Use extract method to refactoring the code smell: long method.

The constructor of the BagelApp class is very long and implements functionalities that it should not, when refactoring using Extract Method the constructor only takes care of instantiating the business classes, and apart from that a buildApp () method is created which in turn contains setAppProperties () and setPanelsToLayout ().
ExtractMethod

Use the duplicate observed data technique to keep business logic separate from views

The Coffee, Bagel and Pastry classes have the getSelectedButton method with different implementations that involve graphical interface objects, to maintain a more orderly and clean code, the business classes must be kept separate from the views. In addition, in the BagelApp class in the actionPerformed method there is a method that is too long because it contains the logic of all the Bagel, Coffee and Pastry sub-panels. It is necessary to refactor and create new classes for the graphical interface of the subpanels, where the getSelectedButton methods of the Business classes and other methods associated with the GUI of the Order class that involve these classes are moved, in this way it is possible to have greater readability and code maintenance.

30
3-2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.