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.