It is currently 09 Sep 2025, 04:06
   
Text Size

Code duplications and other bad practices

Post MTG Forge Related Programming Questions Here

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

Code duplications and other bad practices

Postby Max mtg » 15 Mar 2013, 11:00

We've been discussing tracker that has not been used for months.

There are other tools in cardforge.org that have been abandoned and not used for a long time.

see for instance duplication detector module: http://cardforge.org/releases/site/cpd.html

There are also dependency listing modules like http://cardforge.org/releases/site/plug ... eport.html


Checkstyle report - http://cardforge.org/releases/site/checkstyle.html - I think its rules should be reconsidered to produce less errors.

And there's more to see.
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: Code duplications and other bad practices

Postby Max mtg » 15 Mar 2013, 21:07

Code: Select all
forge/card/replacement/ReplacementEffect.java:267
forge/card/trigger/Trigger.java:385
Adressed by r20352
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: Code duplications and other bad practices

Postby myk » 15 Mar 2013, 21:59

hey Max, could you possibly hold off on code cleanup until after I've merged my branch? I actually spent a good amount of time doing cleanup in there, and it would make things a little easier not to have to manage our merge conflicts.

Testing in there is coming along well, and it won't be too much longer before I can merge it.

Thanks for the pointer to the maven-generated code analysis, btw! It does really highlight the duplication problem we have.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: Code duplications and other bad practices

Postby Max mtg » 16 Mar 2013, 07:50

You've asked me to hold off any development in trunk, without even specifying which modules are problematic to merge for you.
That's not how the branches are supposed to work.
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: Code duplications and other bad practices

Postby Sloth » 16 Mar 2013, 10:06

Don't bother too much with the AI ability classes Max. Some of the functions are just copy and pasted stubs from other abilities that are meant to be expanded/rewritten one day.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Code duplications and other bad practices

Postby Chris H. » 16 Mar 2013, 12:47

myk wrote:hey Max, could you possibly hold off on code cleanup until after I've merged my branch? I actually spent a good amount of time doing cleanup in there, and it would make things a little easier not to have to manage our merge conflicts.

Testing in there is coming along well, and it won't be too much longer before I can merge it.
 
I think that you and I have ran about as many tests as we could come up with and it appears to be working really well at this time from what I can see.

I would suggest that the merge into the trunk be done this weekend if you have the time. This in turn will increase the number of testers that we have as those people who download the daily snapshots will then have a chance to explore this new feature.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code duplications and other bad practices

Postby Max mtg » 16 Mar 2013, 12:55

Will the merge have all decks and quests deleted?
Once I tried to switch to that branch and surprisingly lost all decks in res folder
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: Code duplications and other bad practices

Postby Chris H. » 16 Mar 2013, 13:38

Max mtg wrote:Will the merge have all decks and quests deleted?
Once I tried to switch to that branch and surprisingly lost all decks in res folder
 
I ran a number of tests over the last few days with several different but recent builds from his branch and my decks were transferred and were not lost. Lets take a look, Constructed, Planar, Scheme and my quest data were transferred.

I had to reselect the deck in my quest file to continue my quest. But the quest data deck was there and my quest deck was listed, just had to double click on it to get it to the point where I would have opponents to face.

If you are curious you can try the most recent version at new branch build version here.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code duplications and other bad practices

Postby myk » 17 Mar 2013, 03:57

Max mtg wrote:Will the merge have all decks and quests deleted?
Once I tried to switch to that branch and surprisingly lost all decks in res folder
In merging, I see what you mean. Subversion is removing unversioned files instead of just removing the directory from version control. I'll add the (empty) directories back in to avoid the problem that you discovered. We can remove them again later after the people who update via subversion have all migrated their data. I apologize if the branch switch made you lose any data.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: Code duplications and other bad practices

Postby Max mtg » 17 Mar 2013, 06:21

Yes, this is what I meant. I used a secondary copy of sources to experiment with branches, so there was a primary copy to restore from.

Thank you for arranging this problem
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: Code duplications and other bad practices

Postby myk » 17 Mar 2013, 06:36

I really do apologize. This was a side effect I did not anticipate. Most revision control systems will leave unversioned files untouched when their parent directories are removed form source control.
myk
 
Posts: 439
Joined: 17 Jan 2013, 02:39
Location: California
Has thanked: 38 times
Been thanked: 57 times

Re: Code duplications and other bad practices

Postby Max mtg » 17 Mar 2013, 07:23

Oops, looks like "arranging" is not a synonym to "fixing"... =(

I meant to say that despite of deletion of decks folder my personal losses were minimal due to presence of another copy.
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: Code duplications and other bad practices

Postby myk » 17 Mar 2013, 07:38

haha : ) understood.
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 25 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 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 25 guests

Login Form