Giter Site home page Giter Site logo

enum pour le priorite about glo4002-eq5 HOT 8 CLOSED

MilknCookie avatar MilknCookie commented on June 22, 2024
enum pour le priorite

from glo4002-eq5.

Comments (8)

jpgiroux avatar jpgiroux commented on June 22, 2024

ou est le code? je vois ton commit nulle part?

from glo4002-eq5.

francoislg avatar francoislg commented on June 22, 2024

75685e8
et
00d41cb

from glo4002-eq5.

Trylz avatar Trylz commented on June 22, 2024

looool hope that fixed :)

from glo4002-eq5.

jpgiroux avatar jpgiroux commented on June 22, 2024

On devrait supprimer la InvalidPriorityException si elle n'est plus utilisée.

Le switch case viole le SRP (ajouté un niveau de priorité ne devrait pas impacté booking.)

Et je ne crois pas qu'un switch/case soit la solution ici, on est passé de Integer.compare à un switch de 30 lignes et si on veux ajouter ou supprimé des priorités ont doit ajouter/supprimer un nouveau case...

De plus, pour tester ça il faut tester tout les cas limites. Dans une solution générique pour toute les priorité ça ce résume à 3 test (<, = et >). Mais dans le cas du switch case il faudrait tester les 3 (<, = et >) pour tout les cases ce qui donne 15 tests!

from glo4002-eq5.

Trylz avatar Trylz commented on June 22, 2024

j'ai changé ca :)

from glo4002-eq5.

jpgiroux avatar jpgiroux commented on June 22, 2024

Looks good! Resterait juste à supprimer l'InvalidPriorityException et le throw dans setPriority.

Pour que ça soit encore plus jolie :) ,
je rajouterais une méthode int compare(Priority priorityToCompare) dans l'enum
et booking ne ferait que return priority.compare(bookingToCompare.priority);

from glo4002-eq5.

Trylz avatar Trylz commented on June 22, 2024

une methode dans un enum ? je te laisse faire ahah

from glo4002-eq5.

francoislg avatar francoislg commented on June 22, 2024

Non mais vous pouvez donner une valeur à vos enum !

public enum Test {
HIGH(5), LOW(1);
private final int value;
Test(int value) {
this.value = value;
}
public int getValue() { return value; }
}

Y'a peut-être même une façon de le faire sans constructeur, fouillez un peu si ça vous tente :)

from glo4002-eq5.

Related Issues (20)

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.