Skip to main content
added 196 characters in body
Source Link

Comments such as this:

    // Display results

followed by a chunk of code should better be factored out into a method of its own, usually getting their names from the comment itself.

Comments such as this:

    // Display results

followed by a chunk of code should better be factored out into a method of its own, usually getting their names from the comment itself.

added 396 characters in body
Source Link

DRY: Don't repeat yourself. Repeating instances of dealer.pushNewCard(0, deck1.popLastCard()) should move in to a function. Also note that that function can be a method of an object that contains both deck and player. Also note that method names containing implementation details like push or pop and the magic constant 0 are clues that that behavior needs to be encapsulated.

DRY: Don't repeat yourself. Repeating instances of dealer.pushNewCard(0, deck1.popLastCard()) should move in to a function. Also note that that function can be a method of an object that contains both deck and player. Also note that method names containing implementation details like push or pop and the magic constant 0 are clues that that behavior needs to be encapsulated.

move content from comment into answer
Source Link

The same is true for you main() method. 2 players and a deck are asking to be moved into a class BlackJackGame or some other name.

The same is true for you main() method. 2 players and a deck are asking to be moved into a class BlackJackGame or some other name.

move content from comment into answer
Source Link
Loading
move content from comment into answer
Source Link
Loading
added 379 characters in body
Source Link
Loading
Source Link
Loading