It is currently 25 Apr 2024, 04:37
   
Text Size

[refactoring] remove generic type where not needed

Moderators: North, BetaSteward, noxx, jeffwadsworth, JayDi, TheElk801, LevelX, CCGHQ Admins

[refactoring] remove generic type where not needed

Postby North » 31 May 2014, 13:08

I propose to remove the generic type definition from the MAGE framework (MageObjectImpl, AbilityImpl, Effect ...). As I can see, it is only used for the copy method. This one does not need to be more specific then the base abstraction. It is something that does not bring any value whatsoever but is more of a hindrance for the developers.

If there are any reasons to keep the generic types please let me know. The only one I can think of is the fact that it will be a bit of work to remove them.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times

Re: [refactoring] remove generic type where not needed

Postby North » 31 May 2014, 16:15

I went on ahead and did the refactoring for the Counter class. Because I was in the area I went on ahead to fix more than this and increase the consistency when using counters.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times

Re: [refactoring] remove generic type where not needed

Postby North » 03 Jun 2014, 14:24

I think I finished removing the generic type for all the classes. The ones that implement some kind of Collection kept their generic types but those aren't used anywhere outside the framework core.

I think that the code became a bit easier on the eyes. Also, one doesn't have to decide what the generic parameter to use since they're no longer required.

The only thing that one should watch out for is the copy method implementation. It should always return a new instance of the object being copied.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times

Re: [refactoring] remove generic type where not needed

Postby jeffwadsworth » 04 Jun 2014, 20:28

Thanks for doing this. It is so much easier to read the code now. Now if only the Forge crew would do the same for that JavaDoc stuff.
jeffwadsworth
Super Tester Elite
 
Posts: 1171
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 69 times

Re: [refactoring] remove generic type where not needed

Postby North » 04 Jun 2014, 21:02

Thank you for the great feedback. I'm glad to hear my changes do make a difference.
North
DEVELOPER
 
Posts: 93
Joined: 15 May 2011, 08:20
Has thanked: 8 times
Been thanked: 15 times


Return to Developers Talk

Who is online

Users browsing this forum: No registered users and 6 guests


Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 6 guests

Login Form