It is currently 08 Sep 2025, 08:43
   
Text Size

r20503

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

r20503

Postby 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

Postby 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
Code: Select all
this.flipped = false;
at line 62.
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

Postby 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()).
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 60 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 60 users online :: 0 registered, 0 hidden and 60 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 60 guests

Login Form