Using Deck
as the type of the property keeps your CardGameViewController
more generic. If you wanted to use a different type of deck in the future, you could simply change that one line of code where the deck is created.
Also, if you simply made that property public, you could then create different CardGameViewController
s with different kinds of decks instead of having a PlayingCardDeckGameViewController
and a TarotCardDeckGameViewController
and a PinochleCardDeckGameViewController
, etc.
In general, using Deck
instead of PlayingCardDeck
keeps more options open for you and increases the reusability of CardGameViewController
.