| Summary: | Clean Code Method Sorter | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Marcel Bruch <marcel.bruch> |
| Component: | Recommenders | Assignee: | Marcel Bruch <marcel.bruch> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | bernhard.merkle, christophe.bismuth, cpuidle, d_a_carver, erik.brangs, gerry, janreimone, MadocDoyu, michael.keppler, parzonka, rsternberg, tobbaumann |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
A preliminary version is available here. If you are curios, download and install this version via Eclipse, give it a try one a few classes. Feedback is greatly appreciated and will be forwarded to Mateusz. http://goo.gl/tKcmV Feedback on Clean Code Method Sorter - 0.1.0.v20110812-1633-b81 I'm using Eclipse Helios. I'll abbreviate „Clean Code Method Sorter“ as CCMS as it is done in the plugin. The plugin makes a good overall impression, it's already working very well. With that said, here are my observations: Installation All windows shown during the installation from the update site contain only placeholder text. This also seems to apply to the ids for the source and the feature (e.g. „org.eclipse.recommenders.ep.template.feature.feature.group“). Apart from that, the installation was without problems. Documentation Should there be any included documentation? I did not find any. Usage of CCMS vs. CCMS2 The behaviour of CCMS is not consistent with CMMS2. Let's say i have a Java class A. Using CCMS in the context menu on A.java only has an effect if that file that is already open. When I use CCMS2 the file is automatically opened. I suppose that is also the reason why CCMS does not work when I try to use it on a package. Because CCMS is inconvenient to use, I used CCMS2 in the following. Neither CCMS nor CCMS2 work when I try to use them on the /src folder directly. That is a pity because it means every package needs to be changed separately. Safety of reordering The reordering seems safe. I did not encount any issues when using CCMS2 (I did not test CCMS) while I used it on ~20 packages. Suggestions 1) After the methods in a class are sorted, save automatically. This would be consistent with Refactorings and Source actions. 2) Put the entries for CCMS and CCMS2 under the „source“ menu if possible. There is already a „Sort members“, so „Sort methods“ would fit well. 3) Do not open the editor windows for changing the source files. Just change them in the background. It would already be helpful if files that remain unchanged would be closed automatically. 4) It would be cool if one could set a hotkey for sorting methods via Window → Preferences → General → Keys Thanks Erik. I forwarded your comments to Mateusz. We already agreed on all your suggestions. Thanks again Erik for your detailed feedback. Very nice to read it is working quite well already, but note that this version is still alpha. As for the current build, be very careful to use the experimental CCMS(1)-version on bigger classes (> 5 Methods) containing a cyclic callgraph. Due to algorithmic complexity of the used approach the IDE can freeze quite easily. That is the reason why application on packages is not implemented: Handle with care, apply solely on handpicked classes. CCMS2 uses a different solution and is intended to handle a whole src-folder with arbitrary classes (cyclic or not), so for the moment use this. We will notify you, when your suggestions are implemented. You can install the newest build of the Clean Code Method Sorter from our new update site: http://vandyk.st.informatik.tu-darmstadt.de/updates/students/ep/mateusz-method-sorter/org.eclipselabs.recommenders.cleancode.methodsorter.repository/target/site/ . A documentation is provided at the Eclipsepedia at http://wiki.eclipse.org/Recommenders/CleanCodeMethodSorter . @Erik Brangs: All of your suggestions should be now implemented. The plugin officially left alpha-status and is now in public beta. A few planned features are still missing and will be implemented in the next days. Enhanced plugin with new features and preferences. Check out the documentation at Eclipsepedia for details. New build 102: - Fixed issue with very irregular sorting when methods were mixed with fields in larger classes (reported by Thomas) - Constructors and non-constructor methods are now always separated in sorted source - Improved invocation start-point heuristic: Static initializer blocks and constructors are now recognized as starting points for invocation chains New build 105: - Fixed issue when using clustering New build 113: - preferences-GUI now allows adjustment of method order priorities via jface-ListEditor - fixed issue with getter/setter-clustering - fixed issue with method invocations in static field initializers Wouldn't it be also interesting to be able to: - Group sorted methods by implemented interfaces? Methods from the same interface usually enclose a common business logic. It could be useful to group them together. - Group getters/setters together with hashCode and equals? I think it could be a little bit weird to see a getter declaration among business logic methods. Hope it helps, Chris I was just trying to install the plugin, but Eclipse gave me an error message. I am using Eclipse SDK 3.6.2, Build id M20110210-1200 on Ubuntu.
This is the error message:
Cannot complete the install because one or more required items could not be found.
Software being installed: Clean Code Method Sorter (Feature) 0.1.0.v20111013-0132-b120 (org.eclipselabs.recommenders.cleancode.methodsorter.feature.feature.group 0.1.0.v20111013-0132-b120)
Missing requirement: Clean Code Method Sorter 0.1.0.v20111013-0132-b120 (org.eclipselabs.recommenders.cleancode.methodsorter 0.1.0.v20111013-0132-b120) requires 'package org.slf4j 1.6.1' but it could not be found
Cannot satisfy dependency:
From: Clean Code Method Sorter (Feature) 0.1.0.v20111013-0132-b120 (org.eclipselabs.recommenders.cleancode.methodsorter.feature.feature.group 0.1.0.v20111013-0132-b120)
To: org.eclipselabs.recommenders.cleancode.methodsorter [0.1.0.v20111013-0132-b120]
Can you please point me to a solution? Thanks.
(In reply to comment #10) > Wouldn't it be also interesting to be able to: > > - Group sorted methods by implemented interfaces? > Methods from the same interface usually enclose a common business logic. It > could be useful to group them together. > > - Group getters/setters together with hashCode and equals? > I think it could be a little bit weird to see a getter declaration among > business logic methods. Hello Chris, thanks, interesting ideas! Both make sense to me, the second one was already on my personal wish-list :) I try to implement both in a future version. (In reply to comment #11) > I was just trying to install the plugin, but Eclipse gave me an error message. > I am using Eclipse SDK 3.6.2, Build id M20110210-1200 on Ubuntu. > > Missing requirement: Clean Code Method Sorter 0.1.0.v20111013-0132-b120 > (org.eclipselabs.recommenders.cleancode.methodsorter 0.1.0.v20111013-0132-b120) > requires 'package org.slf4j 1.6.1' but it could not be found > > Can you please point me to a solution? Thanks. Thanks for the report, Madoc: A dependency is missing in Eclipse Helios which is included in Eclipse Indigo. Therefor an upgrade to Eclipse 3.7 would be a valid solution, but I will also include the dependency asap to maintain compatibility with 3.6. New build 123: - Fixed issue with missing dependency when using Eclipse Helios 3.6.2 reported by Madoc (In reply to comment #12) > (In reply to comment #10) > > Wouldn't it be also interesting to be able to: > > > > - Group sorted methods by implemented interfaces? > > Methods from the same interface usually enclose a common business logic. It > > could be useful to group them together. > > > > - Group getters/setters together with hashCode and equals? > > I think it could be a little bit weird to see a getter declaration among > > business logic methods. > > Hello Chris, thanks, interesting ideas! Both make sense to me, the second one > was already on my personal wish-list :) I try to implement both in a future > version. Hi Mateusz, A few months ago I've started a project to clean a legacy code base. The primary goal was to "sort" order insensitive Java code elements to make things a little bit more consistent. I didn't provide any unit test, but I've successfully run it step by step on a 30k LOC project. There may be some interesting stuff, feel free to pick up any idea you like. The project is released under EPL 1.0 and available on GitHub. https://github.com/cbismuth/jdtsort (In reply to comment #14) > A few months ago I've started a project to clean a legacy code base. The > primary goal was to "sort" order insensitive Java code elements to make things > a little bit more consistent. > I didn't provide any unit test, but I've successfully run it step by step on a > 30k LOC project. > There may be some interesting stuff, feel free to pick up any idea you like. > The project is released under EPL 1.0 and available on GitHub. > https://github.com/cbismuth/jdtsort Hi Christophe, looks definitely interesting! Looking forward to dig into it when I have more time :) Thanks for posting! (In reply to comment #15) > (In reply to comment #14) > > > A few months ago I've started a project to clean a legacy code base. The > > primary goal was to "sort" order insensitive Java code elements to make things > > a little bit more consistent. > > I didn't provide any unit test, but I've successfully run it step by step on a > > 30k LOC project. > > There may be some interesting stuff, feel free to pick up any idea you like. > > The project is released under EPL 1.0 and available on GitHub. > > https://github.com/cbismuth/jdtsort > > Hi Christophe, > > looks definitely interesting! Looking forward to dig into it when I have more > time :) Thanks for posting! You're welcome Mateusz. Just one more thing, most sorts are alphanumeric based on class name. It may have been a little bit more "clean" to sort not only on class name but on fully qualified names. I think it could be more consistent to group classes by package (i.e business logic). The most interesting stuff in this project may be how getters/setters are grouped together and ordered according the targeted field declarations through the class hierarchy. See "Sort accessors by field index" in the preferences. Besides, the work you can see isn't all mine, I found some really relevant help from the Eclipse Community Forums guys. Comments in source code will lead you to the dedicated forum threads. Hope it helps, Chris Hi, I just want to say: The Clean Code Method Sorter is a great feature. It is one of the first things I install into a new eclipse. Kind regards, Tobias. I'm actually surprised where you get the binaries from ;-). The update site linked here is offline. Hi, last time I used the update site linked on GitHub: http://parzonka.com/tud/ccms Kind regards, Tobias. Hi, nice to read there are people (still) using the feature :-) The source was added to github a while ago( https://github.com/parzonka/Clean-Code-Method-Sorter ). A working update site is provided there as well. Kind regards Mateusz Closing this issue since there is no further discussion or progress. It's a pity. I still like the feature very much. Mateusz, will the current version stay available at github? Kind regards, Tobias. |
This bug is thought for progress tracking of the "Clean Code Method Sorter for Eclipse" described in more detail here: http://code-recommenders.blogspot.com/2011/04/clean-code-method-sorter-for-eclipse.html Add yourself to cc to keep updated or use this bug to discuss features you would like to see.