Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Coding Help Thread
#12
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.
Reply


Messages In This Thread
Coding Help Thread - by Kalovale - 2011-05-21, 11:11 PM
Coding Help Thread - by Tykian - 2011-05-21, 11:18 PM
Coding Help Thread - by Kalovale - 2011-05-21, 11:30 PM
Coding Help Thread - by Spaz - 2011-05-22, 12:28 AM
Coding Help Thread - by Unauthorized Intruder - 2011-05-22, 12:34 AM
Coding Help Thread - by Kalovale - 2011-05-22, 12:40 AM
Coding Help Thread - by Fiel - 2011-05-22, 01:18 AM
Coding Help Thread - by Fiel - 2011-05-22, 01:44 AM
Coding Help Thread - by Kalovale - 2011-05-22, 01:52 AM
Coding Help Thread - by Luacake - 2011-05-22, 01:43 PM
Coding Help Thread - by Kalovale - 2011-05-23, 06:26 PM
Coding Help Thread - by Fiel - 2011-05-23, 10:47 PM
Coding Help Thread - by Kalovale - 2011-05-23, 11:14 PM
Coding Help Thread - by Fiel - 2011-05-23, 11:48 PM
Coding Help Thread - by Kalovale - 2011-05-24, 03:07 AM
Coding Help Thread - by Stereo - 2011-05-24, 04:05 AM
Coding Help Thread - by Kalovale - 2011-05-26, 10:11 AM
Coding Help Thread - by Fiel - 2011-05-26, 12:39 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)