2011-05-23, 10:47 PM
Whenever you sense that something is tedious in programming it usually indicates a code smell. And this is definitely a code smell.
The deck class does not deal cards out to players. Have you ever seen a deck of cards, in real life, deal cards to each player? That doesn't make logical sense. The Dealer does this or - in this case - the poker class should do it. The poker class knows how many hands/players there are to deal. A deck of cards does not know nor care how many players/hands there are. It only knows how to let other people shuffle and draw cards.
The poker class should also deal with point values for different cards. Think of it this way. You can also have a deck object for when you play Blackjack, but the same point totals for each card do not apply in Blackjack as they do in poker, right? That's because having Two Jacks in your hand isn't the same across all decks in all games. So the fact that Two Jacks is X amount of points is special to Poker. So it should be in the Poker class.
The deck class does not deal cards out to players. Have you ever seen a deck of cards, in real life, deal cards to each player? That doesn't make logical sense. The Dealer does this or - in this case - the poker class should do it. The poker class knows how many hands/players there are to deal. A deck of cards does not know nor care how many players/hands there are. It only knows how to let other people shuffle and draw cards.
The poker class should also deal with point values for different cards. Think of it this way. You can also have a deck object for when you play Blackjack, but the same point totals for each card do not apply in Blackjack as they do in poker, right? That's because having Two Jacks in your hand isn't the same across all decks in all games. So the fact that Two Jacks is X amount of points is special to Poker. So it should be in the Poker class.
