r20503
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
3 posts
• Page 1 of 1
r20503
by myk » 21 Mar 2013, 16:29
Hey Max, I reverted 20503 and added a comment explaining why it was written the way it was. The throw was there specifically to warn against misalignment between showCard() and flipCard().
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
Re: r20503
by Max mtg » 21 Mar 2013, 19:57
I see the comment about misalignment... but don't understand how that misaligment can ever happen.
Especially, if we add
Especially, if we add
- Code: Select all
this.flipped = false;
Single class for single responsibility.
- Max mtg
- Programmer
- Posts: 1997
- Joined: 02 Jul 2011, 14:26
- Has thanked: 173 times
- Been thanked: 334 times
Re: r20503
by myk » 21 Mar 2013, 22:35
the way the code is currently written, the two functions are in alignment. every case that is handled in showCard() is handled in flipCard(). The exception will never be thrown in current code. The throw is there to make it obvious that something is wrong if showCard() is modified in the future to handle additional types, but flipCard() is forgotten. I'll clarify the comment in the code.
I'll add flipped = false at line 62 for clarity, but it is not strictly necessary. currentCard being null is enough to ensure the logic in flipCard is never run (see the first line of flipCard()).
I'll add flipped = false at line 62 for clarity, but it is not strictly necessary. currentCard being null is enough to ensure the logic in flipCard is never run (see the first line of flipCard()).
- myk
- Posts: 439
- Joined: 17 Jan 2013, 02:39
- Location: California
- Has thanked: 38 times
- Been thanked: 57 times
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 60 guests