Friday, April 28, 2006

 

Language Envy

t is been almost 9 years now that I have been professionally working with Java. It is even longer if you count the time before when I did it as a hobby when I first started using OS/2 Warp 4 which was one of the first OS's to come with Java out of the box. Of course I have used other languages in that time but Java has almost always been my primary language as long as I have been a professional programmer. But I find myself envious of other languages/platforms from time to time. Even though I may want to change, it doesn't really doesn't make much business sense at my company. Here are few languages I often think of that give that “grass is greener over there feeling”:


C/C++: I miss being so close to the hardware sometimes and have a close relationship with the machine. I even enjoy working with pointers. But the problem is that with what I do I would have to reinvent a lot of wheels that Java already has.

Ruby: The way Ruby does things is just a breath of fresh air compared to Java. Java was just meant to be a better C/C++ which is pretty much means it is general purpose language. That means it is difficult to do tasks quick and easy. But as of today, Ruby isn't as good as Java to glue various systems together. But Ruby on Rails show signs in the right direction.

C#: I did a small few month project in .NET a while back using C#. If you like Java then you'll like C#. It was fun for me but it really isn't different enough from Java. Some parts in .NET are better than what the Java platform has but some aren't. But for the most part it is Java with a slightly different philosophy. I really only have one complaint, it is tied to a OS that isn't my favorite. (Don't give that stuff about Mono, it doesn't make much business sense)

Perl: I always enjoyed Perl. It is hard to explain, it more about the feel of Perl that I like.

TRS-80 BASIC: This is what I first learned to program with. OK I don't envy anything about it, just thought I would throw it on the list anyway. When I went to school and learned Pascal I remember being amazed at how there were no line numbers! Things sure have changed since then haven't they?

Wednesday, April 26, 2006

 

Pittsburgh OpenSolaris User Group?

I will be moving back to my home town of Pittsburgh PA in a few months. I was working on getting an OpenSolaris user group going in New York but everyone involved is extremely busy we haven't got anything off the ground yet. So I figure maybe I'll give an OpenSolaris user group a shot in Pittsburgh.

So if anyone is interested let me know.

And by the way, Pittsburgh is great place to live for programmers. It is a city with a good technology culture to livability ratio.

Wednesday, April 19, 2006

 

UNIX, Something New Everyday

I first used UNIX in 1996. Even after all this time I am still learning. Today I learned about the "-" option for su. Basically it simulates as if the user logged in from outside rather than piggy back on the current login. So after I found out about I gave "su -" a try and what you know, root had mail!

Tuesday, April 18, 2006

 

The Next Big Thing on the Desktop: 3D

A few years ago I saw a demo of Project Looking Glass from Sun and my eyes were opened up to what was the next evolution for the desktop. What a great way to make a more pleasant experience for users and a way to convey more knowledge to the user. However, I am a little disappointed that we don’t have this technology in production yet. I wish OpenSolaris would take this on. But as developers we must be ready because it is coming, one day. We need to start thinking about ways to take advantage of the new frontier.

Monday, April 17, 2006

 

The Next Phase in Computing: Virtualization

Part of having a successful programming career is to try and predict future trends since our skills become out of date so quickly. Just take a look at the hype around Ruby. A few bright people, like Dave Thomas, predicted it was the future and it took off. So what I have been doing is trying to predict what things will be like in our industry in 10 years. One thing I see as a future trend is Virtualization.

In the 80’s the desktop computing started a change with multi-tasking. Before that change a personal computer did only one thing, think MS-DOS. The hardware that drove this was the 286 but the software took awhile to catch up that truly took advantage of that in full. Back then I can remember people wondering why people would want to do more than one thing at a time with their PC, now that thought never comes up.

Today the cycle continues, this time with Virtualization. Today that is being utilized by developers and some forward thinking companies. We have the hardware, multi-core chips and are starting to get the software that really takes advantage of that, VMware, Solaris Containers, etc. But I predict that this technology will make into the mainstream and not just for the domain of developers and server consolidation. For example, I can see someday a family will have only has one “computer” in the family room that will take place of the cable box/DVD player/Game console/TV. Every where else people will use things that we call today “thin clients” that can use to connect your home anywhere you can get a cell signal.

But I need more ideas; this one I don’t think is future enough.

Sunday, April 09, 2006

 

Emacs as a Java IDE

A while back, I set out on an endeavor to replace my current Java IDE. The IDE I used certainly did the job but something just kept nagging at me that there had to be a better way. I felt as if the IDE was making me work the way the IDE designers felt I should work and not how I wanted too. After trying many IDE and editors built for programmers, I was a bit surprised with my final choice, Emacs. There are numerous Java IDEs to choose from so why would any self respecting Java developer want anything to do with an editor that is almost 30 years old? I found Emacs not as hard to learn as I expected and let me work the way I wanted to work. First, it is one of the most powerful text editors in existence and with a few add-ons it becomes a first class IDE. My requirements where simple, I wanted a tool that worked on a variety of platforms, be extensible, and would not require a tremendous investment in time to learn. I expected Emacs to meet the first two requirements but I was surprised to find it was quite easy to learn. Emacs has continued to evolve over the years. If you tried Emacs in the past and found it daunting, you will be surprised to find it a much friendlier place. Gone is the day where learning Emacs was a right of passage where only until you mastered the key combinations where you found worthy.

The choice a programmer makes for his/her tools is very personal. My intent is not to tell you that Emacs is the only true editor for all but to introduce you to something you may have not considered. If you view writing software as a craft then without a doubt your view of your editor is an important aspect in performing your craft. Just as a master painter would not use any old brush, a software craftsman shouldn't use any old editor. Surpassingly, with all the new and flashy development tools that have come about, Emacs is still a popular choice.

Emacs has been around for over a generation going all the way back to 1974 with Richard Stallman. Since then Emacs has been ported to many platforms and has been a popular choice amongst programmers of many types. Today there are two main versions of Emacs around today, GNU Emacs and XEmacs. The fork of GNU Emacs to XEmacs has somewhat become open source folk lore. The projects have different ideology and design philosophies but from a users perspective both are good implementations. In my opinion, XEmacs can be easier to setup but the latest version of GNU Emacs looks better. My suggestion is to give both a try and see which one you like better. Both versions will make excellent working environment for Java development. For practical purposes, in this article GNU Emacs and XEmacs can be interchanged.

Emacs has a few advantages over most modern IDEs. Probably the most profound is in resources used. The bloat has gotten out of hand with some Java tools. Typically, you have time to get a cup of coffee while your IDE starts up all the while gobs of memory are being sucked up. On my system, GNU Emacs takes up 10% of the memory of a popular Java IDE and starts in a matter of a few seconds. Likewise, something has to be said about the stability of a project that has been around for almost three decades. You can be assured that there is a stable code base and community. Emacs was not built with the sole purpose of being a Java IDE but the ultimate text editor. Since us programmers work with text as our raw material it has become a good fit. Chances are if you can think of a language, Emacs has a mode for it. This is a plus, after all, there is a life outside of Java right? Even if there is not for you, there are others things we work with. Emacs has some excellent tools for working with XML and HTML along with an interactive SQL. The biggest advantage Emacs has over modern Java IDE is the the flexibility of Emacs, but more on that later. However, one feature is noticeably missing. Since Emacs primary purpose is text it lacks a GUI Swing builder. However, I suspect that this will not be an issue for most front-end developers.

Emacs was the original do it all environment. Theoretically, you could spend your entire day in Emacs and never have to leave which was important before there were windowed environments. Besides just being an editor, it has a file manger, shell, version control client, web browser, email client, calendar, psychiatrist, games and the list goes on. Both GNU Emacs and XEmacs come with a plethora of tools. Not to mention the countless add-ons that have been developed, some even being commercial. The most significant add on for Java developers is the Java Development Environment for Emacs or JDEE. JDEE transforms Emacs from a good programmer's editor to a full-blown Java IDE. JDEE adds everything you expect in an IDE such as syntax highlighting, class browser, keyword completion, and debugger just to name a few.

There is a good chance that you already have Emacs on your system. It is component of almost every Unix system, including OS X. Nevertheless, you will probably want to get a fresh copy since the version on your system will likely be out of date. GNU Emacs especially has had some drastic improvements as of late. Go to either www.xemacs.org or www.gnu.org/software/emacs/ to download the latest source. Pretty much the standard ./configure and make install will do. Windows users have not been left out. There are precompiled native installs and those for Cygwin. Do not worry if you have problems with the installation, the Emacs communities have an plenty of people willing to help if a Google search doesn't solve your problem.

As I already mentioned, getting started with Emacs is much easier today. XEmacs was probably always a little easier but GNU Emacs has made great strides to catch up. It used to be you needed a cheat sheet of keyboard contortions to do anything in Emacs. Ultimately many people only bothered to memorize one sequence, C-x C-c to exit Emacs when they accidentally found themselves in it! It also did not help that out of the boxîthe "normal" keys did not work as one would expect. For example to scroll down one might expect that the down arrow would be used instead of C-n or if you press ìhomeî you expect to go to the beginning of the line. Today many of the key sequences, a newbie coming from a typical windowed application, will find today's Emacs work as they may expect. Additionally if you turn on CUA mode the familiar C-c to copy, C-z and such will work like most apps these days. Purists may balk at such "cheats" but if they can help you get used to Emacs quicker and less painfully then by all means use them. However, the whole idea of using a tool like Emacs is to become more efficient by using all of those key sequences. They might seem intimidating at first but it will not take long before your fingers get used to them. After a few hours you will start understanding that the key combinations are not just random selections but thought out patterns. It will not take long before you start realizing that once foreign key combinations actually make you more productive. There really is a method to the madness!

Emacs has tremendous customization capabilities. Just about anything you see or enter in Emacs can be customized. In the past you had to versed in Lisp or at least know how to copy and paste Lisp statements into your .emacs file, the startup file with your own customizations. Here is another area where GNU Emacs has made great progress in helping new users. A point and click environment called Custom has been added. Custom does not have every possible customization but it has plenty. The best part is that each option has a help paragraph along with the actual Lisp statement so you will learn as you go along. When you apply your changes, your customizations are appended to you .emacs file.

Do not get me wrong, even though Emacs is much easier today for the beginner, there still is some things the novice will have to adjust to. For users that are used to the common GUI environments like Windows, Gnome, KDE, or OS X some things in Emacs will seem quite strange. Remember that Emacs was built before there was any idea of GUI environments, heck the idea of seeing a page of the file you are working on was novel! So it is no surprise that Emacs has concepts that are unique. For example, you "kill" text and ìyankî it back or a window is a frame and frame is a window. It is not terribly hard to get used, just be prepared.

OK, so maybe you get the point that Emacs is a great text editor but what makes it so good as a Java development? Well that would be the Java Development Environment for Emacs or JDEE. If you are using GNU Emacs you will also need to visit jdee.sunsite.dk to get JDEE and its prerequisites. The installation is straightforward and just requires you to compile a couple of packages and put things in a place where Emacs can find them. A few changes to your .emacs file will also be needed. For XEmacs you can get the appropriate packages from the XEmacs site. Be forewarned that the XEmacs packages of JDEE might be behind what is current. The transformation that JDEE provides is really a wonder. The first thing you'll notice the first time you open a Java file in Emacs after JDEE is installed is that now your code is color coded and a new menu is available. Before you can start using the full power of JDEE, you will need to setup a few things up such as the location of your JDK and classpaths. JDEE uses an easy to use interface like Custom. Here again there are plenty of options, enough to make your scroll mouse finger tired.

Like any good IDE, Emacs with JDEE lets you do all of your development tasks from one place. With JDEE of course you can compile your classes right there and if you have an error in the compile it can take you right to the error. It goes one step further and will integrate with your builds in make or ant. There are also commands to execute your application or run it in a debugger. There is also a class browser. Arguably, the most important tool that has graced the development community recently is code completion. No longer do you have to memorize the contents of the thousands of classes we use on daily basis. It also saves us time and effort in typing. JDEE does a good job with this. Besides that, JDEE provides many convenient code generation utilities. It does more than just creating class stubs it has some great features once you are already editing a class. My favorite is the template to create get/set pairs but there are several such as auto Java doc creation or a create a "System.out.println" statement all with a single keystroke sequence. There are also has some neat shorts cuts like typing in ìifeî creates an if/else stub with parentheses and brackets in your preferred style.

Here is an example of tremendous value of Emacs, the community. Naturally, because most of the users of Emacs are programmers and like all programmers they are always finding better ways of improving things. One disappointment I initially had with Emacs/JDEE was there really wasn't much support for working with JSP's. The particular problem at the time was indenting for a particular nasty JSP. I did a quick Google search and I found Walter Higgins' site, www.xanadb.com/archive/emacs/20040622. Here he had similar frustrations as I did and provided some Lisp for insertion into my .emacs file. It was exactly what I needed. This type of thing I found is typical. Every time I ran into a problem or I tried to find a different way of doing things, it was easy to find the solution.

I found that it there was some initial culture shock when I first tried Emacs. However, it did not take long before my productivity matched what I had in my old IDE. What really sold me was when I encountered something I did not like it was easy to change and there were plenty of tools to make my work easier. I still consider myself a beginner and know that I still have plenty of room to grow with my new environment of choice. There is no possible way to do justice in short article about the power of Emacs. My suggestion to you is to give it a try. You may, as I did, find it as you tool of choice.

This page is powered by Blogger. Isn't yours?