Here are some ideas/questions for refactoring of the class:
1. List configuration parameters prominently (Layer itemLayer, boolean
deleteOnlySameAttributes)
So it is easier to see what parameters could be tested or used.
2. List language strings prominently (String langDescription, String
langDeleteOnlySameAttributes, ...)
So it is easier to find the translation strings in the translation files.
3. Split contents of initialize() into two methods
(initializeLanguageStrings, initializeMenuItem)
[Neal Ford calls this "Composed Method" (
http://www.ibm.com/developerworks/java/library/j-eaed4/index.html)]
4. Why is createEnableCheck static?
5. TaskMonitor is not used in delete(), delete() should return a
FeatureCollection.
6. Extract attributesEqual logic into a new method areAttributesEqual().
7. Never use one letter (or two letter) variable names ;)
8. Is there a better way to use while (it.hasNext())?
I always used "for (Feature feature in featureCollection)" in Groovy, but
this is not that simple
in Java :(
I will make these changes to the classes and add some test cases to the
testing class.
Then I will commit my changes to trunk. (We really need to dump Subversion
in some point of time and
switch to Git or Mercurial!)
--Benjamin
2012/1/15 Benjamin Gudehus <hasteb...@googlemail.com>
> including 8 strict features => including 8 strict duplicates ;)
>
>
> 2012/1/15 Benjamin Gudehus <hasteb...@googlemail.com>
>
>> 2012/1/15 Michaël Michaud <michael.mich...@free.fr>
>>>
>>> It took me a while to make it work, because in the same time, I tried
>>> to use Eclipse, then Netbeans that I've never really used for a big
>>> project.
>>> It was a horrible experience. How can Eclipse be so popular ? I'm
>>> really wondering.
>>>
>>
>> But JUnit also works for Netbeans, does it? I'm personally a fan of
>> Eclipse, because
>> of GroovyEclipse and Mylyn. Makes life so much easier.
>>
>>
>>> Finally, I could optimize DeleteDuplicateItemsPlugIn and create a
>>> unit-test.
>>> For a 50 000 building layer, it takes about 1 s instead of 2 mn !
>>>
>>
>> Wow, that's much. I looked at a diff for the changes and saw
>> the IndexedFeatureCollection
>> and the HashSet. I wonder if there is a webapplication to upload the diff
>> and review/comment it online.
>>
>> Here is a small suggestion for an improvement to the test:
>>
>> // when: "union by attribute is called"
>> ...
>>
>> // Dataset has 41 features, including
>> // 8 strict duplicates -> 33 features after process
>> assertEquals(...)
>>
>> Could be changed to:
>>
>> // when: "processed a dataset with 41 features, including 8
>> strict features"
>> ...
>>
>> // then: "results with 33 features"
>> assertEquals(...)
>>
>> For me the given-when-then comments are accually part of the code.
>>
>> Would also like to give a second try to IntelliJIDEA (there is a free
>>> version which is user-friendly).
>>>
>>
>> IntelliJ is an amazing IDE. I'm personally too stuck with Eclipse, but I
>> regulary used
>> the other products from Jetbrains that are based in IntelliJ (RubyMine
>> and WebStorm).
>>
>> And it's good that Jetbrains open-sourced some parts of IntelliJ.
>>
>>
>>
>>
>
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel