Ad
  • Custom User Avatar

    There are a number of potential issues here:

    • Description says DataGame but the provided boilerplate says GamesDetails (should be singular, GameDetails).
    • It's unclear why the stock is part of the instructions if it's supposed to be ignored.
    • There's not much motivation for the class since it's just a String -> Integer mapping after stock disappears.
    • The GameShop class should probably receive its stock in the constructor rather than be hardcoded.
    • The method shop would be better-named as isCartWithinBudget, canAffordCart or similar.
    • This method should probably belong to a Cart class with a contract like, for example, cart.isWithinBudget(budget) and methods to add and remove items. GameShop seems like too high a level of abstraction--that feels like the whole enterprise.
    • Prices generally shouldn't be represented as floats due to precision issues.
    • It seems like poor design to be converting string names to objects in the first place--normally, strings would be deserialized directly into classes, or they'd be properties on objects.
    • Typo "porpuse" -> "purpose".
    • "And thirdly the porpuse of your kata is to when a client has enough budget to buy the games he desires." is not a sentence.
    • I believe import java.util.* isn't considered good practice. Better to explicitly import HashMap and List (in that order, alphabetically).
  • Custom User Avatar

    There are no tests where one would want to buy more items than available in stock: https://www.codewars.com/kata/reviews/634d800c238807000175778f/groups/634e7e6efb7a7d0001865f8c