Integrated Development Environments

     

To make a Java program, you write Java source code, which gets compiled into class files, which are composed of bytecodes, which are then executed by the Java Runtime Environment when you run your program. That's a number of steps. The more complex your program, the more external details are involved in completing the system. It can be difficult to maintain two or three or four hundred class files for each project you're working on. It gets tiring repeating lengthy classpath arguments when testing your code. Perhaps you are working with other developers and would like to coordinate your efforts by using a common code repository. Or perhaps, being new to the language, you would like to have an environment in which to write code that gives you hints about what you are doing.

All of the above reasons are good reasons to take a little time, and perhaps money, to get a good Integrated Development Environment.

IDEs are very good at organizing projects. But unless you take a non-trivial amount of time learning the IDE itself, you won't find much more benefit to using an IDE than using some text editor and a shell script or Ant build. That being said, there are a number of IDEs that you can get for free or buy.

Friend, here's a list of some good, free Java IDEs:

  • Eclipse . Available from http://www.eclipse.org. This is the one I use at work. The performance is improving, and this one will be really cool once it is integrated with IBM Rational tools in the form of XDE. There are a lot of plugins now available for Eclipse; you can write EJBs and integrate with JBoss, Tomcat, JUnit, Ant, and many other tools with ease. Its extensibility makes it very attractive. A notable drag about using it is its lean XML support.

  • Sun ONE Studio 5 . Available from http://wwws.sun.com/software/sundev/jde/. Sun bought NetBeans, and this is their Java IDE. This one has a free version and another version that is a couple thousand dollars. A new Sun IDE is stepping up to the plate in the form of Java Studio Creator, which looks and acts a little more like the Microsoft IDE Visual Studio. But for now, that IDE is meant to support JavaServerFaces programming for Web stuff, which we aren't discussing in this book. But it is a groovy tool, and you can read more about it here: http://wwws.sun.com/software/products/jscreator/.

  • Jext . Available from http://www.jext.org/. This one is really more of a code editor, but it supports a lot of languages, and I like it. This one will soon become part of the Debian Linux distro.

  • Jcreator . Available from http://www.jcreator.com/. Comes in Lite and Pro Editions.

  • BlueJ . Available from http://www.bluej.org/. Good, simple tool for learning with visual aids.

Some good Java IDEs that aren't free:

  • IntelliJ . Available from http://www.intellij.com. This is what many developers used at Macromedia to write the JRun 4 JSP, servlet, and EJB app server. Perhaps with less glamor, I used IntelliJ at my last job. I loved it: it works great, is integrated with Ant and CVS, and provides easy EJBs and plugin facilities. This is not integrated with any deployment environment, which could be good or bad depending on where you run stuff. If you have Apache Web Server and Tomcat and JBoss for EJBs, you're just fine. If you have Borland App Server, you're just fine too. But you don't get tools specific to that environment.

  • Jbuilder . Available in Personal, Developer, and Enterprise editions from http://www.borland.com/jbuilder/. There are some very nice code generation facilities in JBuilder, but that's not the best way to learn in my view, and the price tag can be steep. Not available for Mac OS or HP-UX. Heavily integrated with Borland's other tools.

You can write Java source code in any plain text editor. You don't need an IDE, but it is pretty silly to think that you can do a project of any matter without one. If you can't decide, get Eclipse or NetBeans. If you want an excuse to go shopping, need an easy way to create desktop apps without writing Swing code, and aren't worried about proprietary JARs in your app, get IntelliJ. You'll probably use what you need to use as dictated by your current or prospective employer.

In this book, and at my work, I use Eclipse. But it doesn't matter. If you want to know exactly what it is that an IDE does that people think they can charge thousands of dollars for, we can talk about that for a second.

What I Hate About IDEs in 50 Words or Less

IDEs are great when you're learning, and great after you've learned a lot. Don't spend your time right now learning some IDE; spend your time learning Java. That might mean typing things like public static void main(String...args) a bunch instead of checking a box in a wizard. That's a Good Thing for now.

What IDEs Are Good at

I won't tell you how much easier your life will be if you get this or that IDE. You hear that a lot in tech books, about how such and such feature is going to make your life so much easier. That always makes me nuts. The fact is, until you learn the IDE itself, and especially until you learn Java, your life will get worse. Way worse . That's because it is hard work to learn something new of any complexity. More often than not, you've got a boss breathing down your neck, and you need to get going fast, and computer languages are complicated.

And with an IDE, you've really got two things to learn: getting around in the IDE, and the language you're interested in learning. And it is a bad idea to start learning some IDE before learning the language in question (in this case, Java). It's a bad idea because it is nonportable. You can't take your tremendous knowledge of JBuilder with you to IntelliJ (for instance). And one thing they never do is help you write well-designed, slim code. You need to at least know how to run java , javac , and set up your classpath before using an IDE. If you don't, you'll be forever on crutches.

On the other hand, you're going to use one because that's what all the cool kids do, and it is simply idiotic to try a project of any complexity without one. Most importantly, many IDEs do have terrific features that eventually are useful, including debuggers , code generators, Java-specific project organizers, and so forth. So, to make us feel a little less cynical about ponying up and clicking the download link, let's look at some of the many real benefits we get with most IDEs:

  • Debugging . This is arguably the best reason to get involved in a relationship with an IDE. It can be very daunting to debug programs while you are learning, and debuggers improve your chances of working through problems quickly. You can specify a point to stop in the middle of the execution of your program, then step line-by-line through the code as it executes, and see all of the current values of all of your variables at each step. That is very helpful to see exactly where code is failing, and why. Using a debugger is not an immediately intuitive thing, but after you get a handle on it, this skill is more or less transferable between IDEs.

  • Code Completion . This is a fantastic aspect of IDEs that is hard to do without, and is an excellent learning assistant. When you type the name of a package, a small menu pops up for you to choose available classes in that package. Or when you type a variable name , it knows to what class it is assigned, and pops up all of its fields and methods . Also, many IDEs will make suggestions about what you're trying to do. They'll tell you stuff like, "you declared this array but then never referenced it," or do you want to import this or that class. My favorite warning is from IntelliJ: "silly assignment." That's exactly what I thought throughout graduate school.

  • Integration with external tools . You get an easy, consistent interface for configuring many external tools. While you're learning Java, this isn't too big of a deal. But you do get a way to run programs, and applets, and execute an Ant build.

  • Language Support . After you've learned the basics of the Java language, you'll likely begin to expand the complexity and reach of your programs. Reach often means heterogeniety. IDEs often support multiple languages, including not only Java but also others you'll need, such as HTML, XML, JavaScript, JSP, and so forth. That comes in handy, and if your IDE is sort of configurable, you can go off the deep end.

  • Project Handling . Notice that I didn't call this "Project Management" because that sounds misleading: an IDE does not do schedules or budgets or any of that managerial jazz. But it does make a clear way to organize your code, make packages, and deploy a complete application. This also means you can view not only the files in your project, but the structure of your code (its constructors, fields, and methods).

  • Refactoring . Refactoring is something we'll talk about in more depth later. It means taking existing code and making it better without adding functionality. Refactoring is extraordinarily important to the long life and health of your projects. The IDE version of this often means making it easy to rename or move a package or class. Sometimes it means more. Again, this "something more" is something I'd like to do myself .

  • Code Generation . There are a lot of repetitive tasks in writing code. The most common examples in object-oriented programming are probably getter and setter methods. Often, developers write classes that contain private variables and public methods to retrieve and update their values; those methods are called accessors and mutators, or more commonly (and perhaps less idiotically), getters and setters. It is wicked tedious to write all those, especially if you decide that your userID String should be an int. Or whatever. Now you have to go change two methods too. IDEs keep this kind of housekeeping in order with little hassle on your part. Be wary of generating huge blocks of meaningful code, however. If you want an IDE to do all your work, save your time and go do VB. I don't mean that. I take it back. I don't want you to go do VB. I think Java is better. I don't really like all that code generation for stuff like updating your database at all. In fact, I hate it. Don't you?

So I'm not going to tell you what to do. That would be beside the point, because probably you're going to use whatever they have at your school or your work. But if you're shopping around, this gives you some ideas. All I want to stress is: write your code by hand for a while ”possibly a long while ”so that you have real, portable skills.



Java Garage
Java Garage
ISBN: 0321246233
EAN: 2147483647
Year: 2006
Pages: 228
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net