Coder Social home page Coder Social logo

dds-monedero's Introduction

Monedero

Contexto

Este repositorio contiene el código de un monedero virtual, al que podemos agregarle y quitarle dinero, a través de los métodos Monedero.sacar y Monedero.poner, respectivamente. Pero hay algunos problemas: por un lado el código no está muy bien testeado, y por el otro, hay numeros code smells.

Consigna

Tenés seis tareas:

  1. 🍴 Hacé un repositorio usando este template (presionando desde Github el botón use this template)
  2. ⬇️ Descargalo y construí el proyecto, utilizando maven
  3. 👃 Identificá y anotá todos los code smells que encuentres
  4. 🧪 Agregá los tests faltantes y mejorá los existentes.
    • 👀 Ojo: ¡un test sin ningún tipo de aserción está incompleto!
  5. ⛑️ Corregí smells, de a un commit por vez.
  6. ⬆️ Subí todos los cambios a tu fork
  7. 🐛 Activá los issues de Github desde https://github.com/TU_GITHUB_USERNAME/dds-monedero-java8/settings así podemos darte nuestras devoluciones

Tecnologías usadas

Solucion

Code Smells:

  1. Duplicated code en Cuenta poner y sacar
   if (cuanto <= 0) { 
   throw new MontoNegativoException(cuanto + ": el monto a ingresar debe ser un valor positivo");
   }
  1. Numeros Magicos en Cuenta:
double limite = 1000 - montoExtraidoHoy;

if (getMovimientos().stream().filter(movimiento -> movimiento.isDeposito()).count() >= 3) {

  1. Long Method en Cuenta poner y sacar
  2. Message Chain en Cuenta getMontoExtraidoA
movimiento.getFecha().equals(fecha)
  1. Misplaced Method en Movimiento agregateA
  public void agregateA(Cuenta cuenta) {
    cuenta.setSaldo(calcularValor(cuenta));
    cuenta.agregarMovimiento(fecha, monto, esDeposito);
  }
  1. Type Test y Misplaced Method en Movimiento calcularValor
  public double calcularValor(Cuenta cuenta) {
    if (esDeposito) { // type test
      return cuenta.getSaldo() + getMonto();
    } else {
      return cuenta.getSaldo() - getMonto();
    }
  }

dds-monedero's People

Contributors

valentinarau avatar

Watchers

 avatar

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.