Advice for mapping an undocumented Java Eclipse Project - java

I have started at a new firm and as part of my duties am making small changes on a Java Project that was developed previously. The problem is that it is mostly undocumented and very complex. By undocumented I mean no comments, no Java doc, no documentation guide, nothing. It's a website Java project developed in Eclipse and built using Ant. My question is what tools are available to help me map out the project to better understand it. Or is there any advice on the best set of steps to follow.
Thank you for your time.

Look into reverse engineering tools that can create UML diagrams for java, like omondo. If the ant build script is complex aswell - I once visualized some complex ant build script using yEd, that helped a lot.

I personally found that UML-based tools do not scale well in such cases, except for some very specific cases, where sequence diagrams might help a lot.
Instead, I would refer to the following book (available online) for a general approach to the problem:
http://scg.unibe.ch/download/oorp/
And try out some research tools for code visualization to get an overview, for example:
http://www.inf.usi.ch/faculty/lanza/codecrawler.html
(would love to post more links, but can't due to stackoverflow's spam prevention mechanism)

Related

Where to find design patterns, best practices for Eclipse plugin development

Our team is developing a Eclipse based IDE (typically a plugins), currently we are progressing good but I feel somehow we are feeling smell of bad practices in code. Example I can give here is, eventListeners :
Consider we have button named button1 and in the same java file (just below the button) we are adding selection listener to it like:
button1.addSelectionListener(new SelectionListener() {
//Remaining code here
}
Which I feel is completly bad idea, and my question, is there any design pattern, best practices etc available for eclipse plugin development? Or do you have any small tips/suggestions for the same? I know there are books available like Code Complete 2 etc etc, but I need bit suggestions respect to eclipse plugin development.
I tried in Google and didn't get much good informations regarding same, I got this IBM's article. But I feel it's not very useful, any suggestions or tip is appreciated.
Note: Please let me know if it is not appropriate here or is it good for anyother stackexchange networks (like programmers), I can move it there.
After several years of plugin development, I find these resources to be most useful for me when I find myself struggling on how to implement new feature:
Eclipse sources. Nothing will beat this. Try to find some already existing analogic part of what you're just doing and look how Eclipse developers did it - what patterns and extensions they used and so on. Helps to keep you plugins consistent with other parts of Eclipse. Eclipse Plugin Spy is your friend here (Alt + Shift + F1/F2).
Platform Plug-in Developer Guide - will guide you through basic concepts of Eclipse, like how to create menus properly, implement an editor, or save user preferences.
Eclipse Plug-ins (4th Edition) - Well known must-have for plugins developer.
And, of course, Stack overflow :)
I like to add some more resources that I have found useful to dreo's answer. The eclipse sources are invaluable, if you want to understand something in detail. To understand global concepts however, I suggest to read as much tutorials as you can. I can recommend the following websites:
Eclipse Corner Articles Has a lot of tutorials ranging from basic concepts to plugins specific topics.
Vogella Eclipse Tutorials Also a good tutorial website. It deals with a lot of topics that are important for Eclipse RCP development.
SWT Snippets More than 100 code snippets. Really useful, if you want to learn more about SWT and its capabilities.
The Official Eclipse FAQs Last but not least, I can recommend the official Eclipse FAQs. They provide compact solutions for a variety of topics.

UML Plugin for Eclipse - Class Diagrams & Java Code Generation - Indigo/Juno

I am looking for a UML plugin for Eclipse. I know this questions has been asked several times, but most of them are a few years old. From what I read I would say that most people prefer eUML2, but this officially supports only Helios.
So far I am using argoUML, but the absence of an undo-button is really an usability nightmare, to say the least. Additionally I would prefer integration into Eclipse.
What I want is:
Free/Open-source
Actively developed tool (support for Indigo, planned support for Juno)
Hassle-free installation in Eclipse
Class diagrams
Generate Java code from diagrams
Update the class diagrams after implementation is done (round-trip)
What would be nice:
Other diagrams, where for me the most important are sequence and use case diagrams
If there are in fact no suitable Eclipse plugins, than I would be happy if you could point out other tools that are free/open source and linux-based and which workflow you are using to accomplish the aforementioned requirements.
I'll definitely go with ObjectAid.
It supports drag and drop of classes and packages directly from your code in eclipse.
No need to open another application for your modeling.
Model files (*.ucls) can be kept in a separate project in eclipse while you code/develop your Java codes in another project. All these can be done on a single eclipse session.
Just want to emphasize on the drag-n-drop. I simply love it!
I'm using Eclipse Juno.
I tried other modeling tools but didn't get what I wanted.
P.S.
Creation of class diagrams is free, but needs an evaluation license for creating Sequence diagrams.
For now I will go with either Green UML or UML Lab. Green UML fulfills all the points I asked for, except that I'm not a hundred percent sure it is very actively developed. But the last update is from November 2011. It only supports class diagrams, but that is ok for me. It can be found here.
Other than that I will try the academic version of UML Lab as it looks a bit more promising, though not being free is a draw back.
Papyrus is probably the best choice. It is actively developed and is an industry backed project. It does not have code-generation capabilities by since the uml model is stored as an emf model you can use acceleo for code generation.
Round trip (update of diagram after code update) is also not supported.
But it does support many other UML diagrams.
I tried a number of open source tools, and actually found none that are good to use inside eclipse, so I am using Visual Paradigm for UML, community edition. Not free, does not do what you want, but for modeling purposes it is way above any eclipse plug-in.
The best is Omondo EclipseUML for Java code generation because I can model but also hand code. I never loose my model because multiple iterations are possible opposite to other tools just working from model to code.
Accelero code generation is too complex and the code is not really good. It requires to fix it manually once generated. If more than one package then relations between packages are not generated. I would say that accelero is good for a single class diagram code generation but as soon as you have more than one diagram in a package or multiple package then it is better not to use this plugin.
I was looking for UML Round Trip Engineering tool that supports reversing and drawing sequence Diagrams. Focus is on sequence diagrams as majority of tools can help with class diagrams, but not sequence diags.
Among the Free or cheap tools: I tried Papyrus, Modisco, Modelio, ObjectAid - first 3 are bit over complicated for some basic reversing, tend to ask too many question to locate source and libraries and all is bit clumsy, and they don't help much with sequence diagrams. ObjectAid works well even with the most recent eclipse (Luna). Sequence diagrams have cheap license. Sadly - none of them understands Spring annotations (e.g. #autowire).
Among big and expensive tools like EA, Sparx, Magic Draw, UML Lab (Yatta) - I like none, I find them too expensive for what they offer. Also, Complicated to reverse code (endless search source path problems). Magic and Modelio can't reverse and auto-generate sequence diagrams.
Alternative to these expensive tools is Altova UModel, it works as independent tool or eclipse plugin (I used it independently of eclipse, faster install, offers sync diagram with code function). It's the only tool that can open eclipse project extensions (doesn't ask about classpaths, however can't find maven libraries) and no support for Spring annotations. Java 7 is not officially supported but it works (minor exceptions with some rare generics). If they add: full java 7 support, spring support, open whole eclipse workspace and support pom/maven libraries, that would be the best round trip engineering tool around.
I ended up using ObjectAid, which is free/cheap and does things well (except spring autowire), lacks communication diagram which was great thing in Altova.
HTH someone...
PS: I use MyEclipse Pro sometimes, decent yearly price, it can do some things from above, you need to see trial version and if UML are suitable for business documentation (too many boxes/packages make diagrams confusing).

Slicing Tools for Eclipse

Does anyone know if there are any open source tools for eclipse that can generate static program slices according to the slicing technique outlined by Mark Weiser (http://en.wikipedia.org/wiki/Program_slicing)? I can only seem to find JSlice, which only works for Fedora. Any pointers about how I could tackle this (and libraries out there, or example algorithms for java) would be great.
Disclaimer: I haven't tried the tool listed below.
Indus. It appears to make itself useful via the Kaveri plugin in Eclipse.
It would be worth noting that apart from JSlice and Indus, no other known code slicers for Java appear to be available, although there are quite a few papers that discuss building a code slicer for Java. Sadly, the authors do not appear to have made these tools available for further research.
How about WALA and javaslicer.

open source swing based application that employs good practices

I'm trying to learn swing and I was thinking you guys may know a really good swing based open source application that I could study and inspire from. I'm looking for something that has a real world use, not just some concepts explained (like examples in most books and tutorials).
Thank you!
It's certainly less well-known than some of the other projects mentioned here, but have a look at GoGrinder. The code is well written and documented.
It might also be a good idea to look for something that you'll actually use. I find it easier to read the source of applications that I'm familiar with from using them.
In the same spirit as the answer suggesting to check NetBeans, I would suggest to get the sources of IntelliJ IDEA Community Edition and IntelliJ Platform from their git repository. At some point, IDEA was IMO a state of the art Swing application (fast, responsive, not ugly, nice user experience, etc).
Maybe you could have a look at the open source NetBeans IDE. It is huge, but it is using Swing intensively and is well designed and documented. Moreover, it is also a generic platform to build modular GUI applications.
The Swing Tutorial is filled with excellent code, and the Swing code itself is available for study in most IDEs.
jEdit is a programmer's text editor that I wrote some plugins for a few years ago. Partially due to the plugin system, the code is well documented, and after having been in development for many years is generally very high quality.
You could take a look at the jgoodies examples. They are not plain swing though, and I don't know the license.

Open source projects with Java and Scala interaction

I'm going to give a talk about using Java and Scala together and I want to investigate some projects (large and small) which contains Java and Scala code.
If you know links to correspondent projects post them here.
This page on the Scala wiki is a good starting point...
The various scala testing frameworks come to mind. They all have some integration with JUnit or TestNG
Gimd is one example of small project: http://code.google.com/p/gimd/
Although development stalled for a while because I'm busy with other duties it already contains some examples of Scala<->Java integration. Notably:
unit tests are written using junit
Gimd is using JGit (library in Java) as underlying layer
While working on Gimd I found that using Java from Scala is mostly easy and seamless the contrary is not always true. It's not really a fault of Scala as it's simple manifestation that Java is a less expressive language.
Unfortunately I don't know any open source project but I have worked on very large projects over the last few years that have java and scala interacting and my experience has been mostly very positive. If I had one piece of advice it would be to use scala-javautils. It's a life saver and is far better than the scala jcl code. Before we started using it trying to get some interactions involving collections was heart-breaking. However I'm led to believe 2.8 will solve this.
In general I find the interactions between scala and java very close to using one language.

Categories