Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been programming for about a year now.

Pretty soon I realized that I need a great Tool for writing code and learned Vim. I was happy with C and Ruby and never liked the idea of an IDE. Which was encouraged by a lot of reading about programming.[1]

However I started with (my first) Java Project. In a CS Course we were using Visual Paradigm and encouraged to let the program generate our code from a class diagram.

I did not like that Idea because:

  1. Our class diagram was buggy.
  2. Students more experienced in Java said they would write the code per hand.
  3. I had never written any Java before and would not understand a lot of the generated code.

So I took a different approach and wrote all methods per Hand (getter and Setter included).

My Team-members have written their parts (partly generated by VP) in an IDE and I was "forced" to use it too. I realized they had generated equal amounts of code in a shorter amount of time and did not spend a lot of time setting their CLASSPATH and writing scripts for compiling that son of a b***.

Additionally we had to implement a GUI and I dont see how we could have done that in a sane matter in Vim.

So here is my Problem: I fell in love with Vim and the Unix way. But it looks like for getting this job done (on time) the IDE/Code generation approach is superior.

Do you have equal experiences? Is Java by the nature of the language just more suitable for an IDE/Code generated approach? Or am I lacking the knowledge to produce equal amounts of code "per Hand"?


share|improve this question

migrated from Jan 13 '12 at 3:14

This question came from our site for professional and enthusiast programmers.

I use Netbeans IDE, but I don't use code generation of getters and setters as I like to type stuff. It's just a matter of practice and preference. Do what you love and prefer. I love VIM too, but IDE has its benefits too. – thandasoru Jan 11 '12 at 8:09
Once I saw the site referenced I remembered about another page from the same professor, where some years ago I found how to remove Vim's cursor blink (:set gcr=a:blinkon0) among others nice tips: – mMontu Jan 11 '12 at 10:37
@Cameron There are shortcuts for basically any important action in eclipse that exists in emacs so it's really only a matter of preference.. and more important, customs. I'm not using the mouse when writing code in eclipse either. But then with enough plugins you can get emacs to do basically anything a modern IDE would do either, so again: preferences. – Voo Jan 11 '12 at 11:57
Another tool you might want to check out: Eclim. "Instead of trying to write an IDE in Vim or a Vim editor in Eclipse, eclim provides an Eclipse plug-in that exposes Eclipse features through a server interface, and a set of Vim plug-ins that communicate with Eclipse over that interface." – rampion Jan 11 '12 at 13:24
@Voo: It's hard to appreciate the value of an editor with a built-in scripting language until you have used one for a while, and then switch to an IDE that doesn't support scripting. – kevin cline Jan 14 '12 at 4:09
up vote 4 down vote accepted

Deciding between writing the code by hand or making use of an IDE depends on several factors :

A) Time at hand. Most of the times we are under the pressure of delivering the project on time. In that case IDE can definitely make the job easier , by fixing in a lot of filler code.

B) Knowledge of the language. If you are a beginner then it is recommended that you write the code on your own without the help of an IDE. This helps in the learning process. However if you have mastered the language then it would not matter whether you use an IDE or write the code on your own, as you already know the nuances of the language.

I would suggest you to take the best out of the two scenarios. Use the appropriate approach as required by the situation.

Hope this helps. I would love to get a feedback on this topic from other Java professionals , as it would add to my understanding of the current trend. Please correct me if I am wrong.

share|improve this answer
Although it's often claimed that beginners shouldn't use an IDE I never followed the argument. I'd say ESPECIALLY beginners shouldn't have to worry about command line arguments, classpaths and whatnot - they should concentrate on learning the language. And really when was the last time you compiled a larger project by hand without ant or any other tool? Yep me neither. – Voo Jan 11 '12 at 11:53
@Voo, I agree and for another reason. Good IDEs can make it easier to learn the language and libraries because of things like autocomplete. It also can help teach proper formatting if it tries to automate it. – Philip Jan 13 '12 at 15:02

IDEs and code generation from class diagrams are two different things. Nobody generates code from class diagrams. Class diagrams are just too high-level, and the goal of UML is to describe a system, IMHO. Not to implement it.

All my Java code is hand-crafted, even GUI code, but an IDE is a huge time-saver because it allows navigating into the code easily, compiles in the background, tells you where errors are, auto-completes method names and arguments, provides a lot of shortcuts, allows refactoring.

Want to:

  • edit MyGreatClass: Ctrl-Shift-T MGC
  • see the definition of the method: Ctrl-click on it
  • find where a method is called: right-click and choose Open call hierarchy
  • rename a method and all its uses : Alt-Shift-R and type new name

That's where an IDE shines.

share|improve this answer
+1 for the difference between IDEs and code generation tools. – Michael Kjörling Jan 13 '12 at 9:50

As far as Java is concerned, there are standards defined for lot of things and that is why IDEs can help you a lot with automatics code generation. For example, getters and setters as per Java bean standard ( saves you a lot of time) or more importantly, generating hashcode() and equals() as per the members of the class. These things are correctly generated by IDEs like eclipse because there is a contract defined for hashcode and equals, specified in javadoc of class Object.

Eclipse also helps you with other things like constructor generation

Another part where IDEs like eclipse help a lot is to browse through the source code quickly - finding references, call hierarchy, type hierarchy and so on.

Also, the formatting done by the IDE also makes the code a lot more readable. Not just for you, but for others as well.

This is why I think its of really good help.

I have also worked with vi and the only thing it does is formatting. And that is sufficient for shell scripting or doing scripting in language like perl. But for larger project, IDE helps.

share|improve this answer

If you prefer Vim and the main worry is about the time to insert code then you may find interesting some Vim plugins that speed-up insertion of repetitive snippets of code as snipMate, javacomplete and Vim JDE.

For GUI I usually 'draw' it in an IDE and also use it to automatically create the method hooks, and then Vim to do all the rest. This approach is useful when you are not interested in creating a very efficient and shinning and GUI (where all the code/details taken care by the IDE would matter), but mainly interested in the service/results delivered by your program.

share|improve this answer

I don't use VIM, but often a core editor with hotkeys and macros, to produce boilerplate code. I'm pretty sure VIM can do it to.

Writing GUI-Code in the IDE isn't hard, if you create short factory methods, which produce uniformly looking components like buttons with tooltiptext and eventhandler on the fly.

share|improve this answer

Don't forget the auto unit test generation (or at least all the boilerplate generation) which many Java IDEs can do. This makes it insanely easy to write TDD code, and if you're trying to sell your group on TDD, it is MUCH easier to make the deal when you can point and say "just right click- write unit tests, then fill in the scaffold".

share|improve this answer

Code generation from a class diagram is only good if at each model creation the code is also generated. I mean that you create your class diagram and the code is immediately generated, then you complete your code manually because UML specification doesn't include business rules etc... you have to code it manually. You then go back to your class diagram and update the newly hand codded created method etc...

Code generation once the class diagram is finished is not recommended because at this code generation stage code would be incomplete, not reflect the reality because class diagram is only a view of the problem but the not the problem itself etc..

Omondo has promoted a new way of modeling which is between the MDA code generation and the live code and model synchronization. The concept is the code to model merge at each iteration but doesn't require live permanent synchronization. Each model element has a single id which is mapped to a single java id. You can trace it during all project life because the id is a kind of number. You can therefore refactor your project, change names, move it etc... without changing the id number. Last time I refactored a full project and my model was still valid when I opened my class diagrams. This is impossible with other tools because only Omondo EclipseUML UML diagrams allow to close your diagrams during refactoring and desactivate the listener. Only remain the model Id and traceability between the model and the code therefore graphical and model is updated when needed. Opposed to other tools permanently updating the model (e.g. Togethersoft, eUML) which slow hand codding and is a problem for RAM (e.g. the IDE usually freeze when using live code and model synchronization) Omondo would disappear from your processes and come back when required without loosing any model information.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.