Archive for November, 2008

Enough!

I’ve refrained from using my blog to jump into politics, as I’ve wanted to keep it focused on the things I’m passionate about, i.e. technology and programming. But there comes a time when even the calm get pushed to the edge. I arrived there this morning on this news of the bailout of Citigroup.

We, the taxpayers, have already invested $25B dollars in Citigroup. As of friday, with a share price of $3.77, the market capitalization of Citigroup was $20.7B. That is less than we gave them a month ago, meaning the company is fundamentally worthless. Yet once again, with the “too big to fail” mantra, taxpayers are stepping in with another $20B in free money, buying $7B in stock and guaranteeing $300B in garbage loans.

At what point is it enough? We poured endless money into AIG and are now doing the same with Citigroup. We are rewarding incompentence to the tune of hundreds of billions of dollars. Democrats and Republicans share equal blame for these unceasing handouts, so this is not tied to a single political party.

And who’s next? Undoubtedly, General Motors will walk away with some cash at some point, rewarding their own long-running case of stupidity. Once the spigot is open, a long line of publicly traded companies will be lining up at the trough.

So what can we do? First, let them fail. Use the money to help individual taxpayers pick up the pieces and forget about helping the uber wealthy protect their stock portfolios.

Second, expand the war on terror to include economic terrorism. We then declare all the incompetent C-level executives at these companies that caused this mess as economic terrorists and ship them to Gitmo. Indefinitely. Start with Countrywide, Citigroup, Fannie, Freddie, AIG, Wamu and Bears Stearns, then go from there.

Our country is supposed to be about “we the people” and instead has become about “we, the too big to fail”. Something must be done.

IntelliJent Spring

One of the most impressive features of IntelliJ IDEA has been its support for the Spring Framework. IDEA 7 had great Spring support, and IDEA 8 expanded it to include Spring 2.5. What makes Spring a dream with IDEA is how well it understands the Spring grammer and configuration files. I’ll give some basic samples so you can see what I’m talking about.

Let’s start with some very basic beans implemented as interfaces and implementation classes. They are:

This gives us a very basic interface for a Car and simple implementation. Not quite HelloWorld, but close. The Driver interface and implementation look like this:

Again, a very simple implementation. As you have probably guessed, we’re going to define two beans and inject the Car implementation into Driver. Just to make things interesting, we’ll also use a properties file so we can do some token substitution. Our file, called driver.properties, looks like this:

Now lets get to work and implement the Spring XML configuration file. With the above classes implemented, one of the great features of IntelliJ is great support for the p: namespace. IntelliJ has auto-completion for the beans properies, as you can see in this image:

As you can see, since we gave the name of the implementation class, the parser picked up the names of the setters and made them available via the p: namespace. Of course, there is also full auto-completion of the class name, so no copy-paste is needed.

The same auto-completion is available for properties in the imported properties file. Here is the import statement and the auto-complete pop-up as we’re filling in the property for the Driver’s name:

As you can see it enumerated both the property names and their values from the properties file configured in the property-placeholder.

The Spring support also extends from the back source to the configuration. With the Spring XML configuration file in the project, IntelliJ will detect it and provide hints in the code for Spring beans, including quick navigation between the code and the configuration. Here is what the Car interface now looks like with the Spring configuration:

As you can see, IntelliJ puts a “bean” marker in the left margin next to classes or interfaces declared in the Spring configuration file. Clicking the marker will open the Spring configuration file, highlighting the configuration line for the bean. You’ll also notice the little “I” in a circle. This is a basic IntelliJ feature which means a class has implemented the method and can navigate directly to the implementation. If multiple classes implement the interface, you can choose which one to navigate to, like this:

Clicking the little “I” next to the line declaring the Car interface brings up a dropdown allowing you to pick which implementing class you want to navigate to. The same applies for the method declarations.

Spring also has quick navigation of bean properties. For example, in my Spring configuration file, I have declared my car bean like this:

If we take a look at the class file for CarImpl, you’ll see that IntelliJ has placed a marker next to the setter methods to indicate they are Spring properties being set in the configuration file:

Clicking the property marker takes you directly to the definition of the property in the configuration file. The reverse is also true. Using CTRL + click on a property in the configuration file takes you to the implementation in the class file.

It is all this goodness that makes working with Spring such a pleasure in IntelliJ IDEA 8, and this only scratches the surface of how powerful a code editor it really is. Give it a try and enjoy!

Catching the 8

The latest version of my favorite Java IDE, IntelliJ IDEA 8, was released today. I’ve been using IDEA since version 2.0 and have consistenly upgraded my personal license every new release. This time is no different. IDEA has been my favorite IDE for the simple fact it is the ultimate coders tool. No other IDE I have ever used has been so good at helping me with the things I need while staying out the of way the rest of the time. There is not a better Java development environment on the planet.

Yes, I’m sure I’ve offended the Eclipse mafia. I have used Eclipse, on serveral occassions. But I go back to IDEA every time. It is hard to describe the difference in feel between the two. Eclipse is like a swiss army knife — it does a little bit of everything, but none of it particularly well. IntelliJ IDEA is like a Spyderco knife, the perfect cutting instrument. Eclipse is the Visual Basic to IntelliJ IDEA’s emacs.

So what’s new with IntelliJ IDEA 8? The coolest thing I’ve used so far is the built-in JavaScript debugger. You no longer have to depend on Firebug to debug JavaScript files in a project, you can simply set breakpoints in the JavaScript and run the page. For the full list of the new features, check out this page. I’ll be doing a more in-depth review of IDEA 8, using it with a Spring MVC web project.

If you haven’t tried IntelliJ IDEA, and you’re a Java developer, I strongly encourage you to check it out. Personal licenses are only $249 and they are well worth it. Eclipse may be free, but you get what you pay for.