Skip to content

Find Long Methods

  1. Open up the Blackjack codebase and become familiar with the rules of Blackjack found in the README (if you're not already familiar with the game).

  2. Look through the three classes, Card, Deck, and Game. For each method, determine if it qualifies as being a Long Method based on what was covered in class.

    Note

    Ignore equals(), hashCode(), and toString() methods as these were code-generated.

  3. For each method that you consider to be Long, make a note as to why it's long (what makes it long?). Do not make any code changes at this time (it's tempting, I know!), just write down which methods are long and why.

    Consider:

    • Nesting/indentation: nested if and for blocks
    • Mixed levels of abstraction: detailed/low-level code combined with method calls
    • Doing too many different things: are there blank lines separating them?
    • Easy to understand and comprehend at a glance?
  4. After the lab is over, you'll be asked to share what you found, so type your notes in a convenient place.


You are done!