Friday, December 19, 2008

New cool tool window features in IntelliJ IDEA 8


During last Devoxx, Jetbrains folks showed us a little trick, which I would like to share with everybody.
It turns out that every docking pane for IDEA tool windows (left, bottom and right) has actually two zones where tool window buttons can be dragged. If you have button occupying both zones in single tool window docking pane, you can have TWO tool windows displayed at the same time in given docking zone!
It makes IntelliJ IDEA UI layout much more flexible (almost like Eclipse) and useful for high resolution screens (does anybody nowadays use anything below FullHD? ;)).
Take a look at the screenshot.

Thursday, December 18, 2008

ArrayList is NOT a Vector replacement

I've been writing a class that needed a dynamically growing array with random access to store it's data. Exactly the stuff that java.util.Vector provided in the old days.

As the Vector is not trendy any more (and performs unnecessary synchronization), my first thought was to just switch to the ArrayList, as everybody advise.
ArrayList is not a direct substitution, though. It lacks the setSize() method that would create holes in the Array - elements filled with nulls up to the requested index.
I know I could overcome this problem with looped add(null), but I decided to go the easy way. I just created a plain old java array[] and provided my own private ensureCapacity equivalent to do the growing.

Lesson for me: don't blindly assume that what everybody (including Joshua Bloch) says is applicable in all situations. There are contexts where simple array is better then the newest Collections framework :-)
Why there is no direct substitution for Vector is another story.

Sunday, December 14, 2008

My take-aways from Devoxx 2008

JavaFX is probably not as dead as I thought

After witnessing official announcement from Sun about "JavaFX coming" at JavaOne in 2007, more than year and a half passed and I was anxious that the whole idea is dead.
To my astonishment, Sun seems to have changed its strategy with JavaFX. Now it's not to be just a simple Java-based alternative to Flash/Flex rich internet client applications (as for many months have been stated on JavaFX homesite), but something more: a new rich client for Desktop and Mobile. As I am recently quite heavily involved in rich client development with Java (mostly Swing), this is for me a very important shift.
Swing is often quite difficult to tame. Its controls look quite outdated. Definitely it's visible that the library is about 10 years old and is burdened by a lot of garbage.
Firstly JavaFX brings a lot of visually appealing effects which applied to your UI will make it more modern, but also more usable for your customers (like iPhone does, which is BTW referred to by Sun folks very often).
Secondly JavaFx guys promise that there will be a new library of UI controls available for JavaFX. This library is to be built on top of all the knowledge gathered by last 10 years from Swing developers (and not only) and should avoid most of its disadvantages while providing seriously refurbished look & feel. And this library will be accessible naturally also for Java developers. And it's said that ultimately it should become and new Swing 2.0 or rather an alternative to it.
Great! I am keeping my finger crossed.
Seeing how much energy Sun put into promoting JavaFX at Devoxx (which includes several very interesting presentations), a lot of interest of Devoxx attendess (see the table below about the plans for using JavaFX) and even strong belief in JavaFX from Java Posse guys, I tend to believe that developers forgave Sun its slip in delivering JavaFX and really count on this language.

Java is no longer about just Java, but dozens of languages running on JVM


I was on a few great session (e.g. by Brian Goetz or a folk from Azul Systems) about JVM internals and garbage collection. It's clear how much effort is now put into making from JVM a friendly platform to various languages (also dynamic).

Java SE 7 is LATE

Unfortunately we will probably wait about 2 years more for next major Java release.
And unfortunately there will be there apparently no such wanted language features like properties or closures.
Sun seems to play a role of a perfectionist here. They are obsessed with maintaining backward-compatibility and thus want to avoid putting into language some feature which then would be impossible to remove or change. So they want to analyze and polish everything and then add to the language only ultimately prepared feature. Unfortunately it's very difficult. And unfortunately both closures and properties are not in the shape of having ultimately prepared proposals. And probably they never will, as it's typically impossible to predict all the aspects of a language feature. I bet nobody in 1996 would dream what possibilities Java would offer to developers 10 years later - practically with the same language or JVM constructs which were available for a long time (e.g. web or application frameworks making heavy use of reflections, proxies, aspects, DI containers, dynamic languages). My opinion is: let's not wait forever with a new language feature. Let's add it, try it out for a few years and then only see how to improve it or not. Which leads us to the next conclusion:

Developers are fed up with Java backward compatibility

Java 1.6 is practically 100% compatible with Java 1.0. Which is not used by anybody.
The survey made on the whiteboards at Devoxx make me believe that about 95% of Java programs now use version 1.5 or 1.6, maybe maximum 4-5% uses Java 1.4 and only per mills still depend on the older versions (which anyway are not longer supported by Sun). Backward compatibility is one of the major problems with Java and the reason it gets bloated while retaining a lot of garbage: unused APIs, libraries and bad design (to name only a few: Cloneable, finally, old collection framework). It's time to give it up. And the applause for stopping being too obsessed on backward compatibility at live Java Posse session convinces that I am not the only one who thinks so.
If Java is paralysed and does not evolve, it will soon be challenged by other modern languages (like Scala for statically typed languages or Groovy or JRuby for dynamically typed languages) and it may just lose the market. Although a lot of effort is put on JVM itself which will not be directly affected by such possible shift, even more knowledge and effort invested in Java language itself (just take billions of lines of Java code of existing systems, hundreds of huge and powerful Java IDEs and tools) would be more or less wasted. I think it would be very bad. Sun, please don't let Java die now. It's too early. With proper gardening this language may be successful for at least another decade.

Agile development gets lots of attention

Although Devoxx is a technical conference for computer geeks (or nerds ;)), there were (contrary to JavaOne) many talks related to software development process. There was even a separate track called "Methodology".
AFAIK all talks in this category were more or less connected with agile development. Anything else nowadays (say a session about waterfall process) makes people laugh. I heard that even Ivar Jacobson (the father of bureaucracy in software process one could say) himself seems to change his mind (very good!) and now tries to preach on common sense approach to software engineering (and I heard that his talk was really good).
A little bit surprisingly, all these talks gathered a lot of audience (including our talk on code review). So geeks seemingly like to have a broader view on the computer science. That's good. Unfortunately some sessions were just disappointing (e.g. I did not like the way Dave Nicolette presented his observations. Such talks just looked like unprepared and many people got quickly bored).
I was carefully observing what people say about their agile practices. Although everybody seems to embrace "agile", relatively few people admit to practice pair programming. Also still few people do code reviews or collectively own the source code. In several presentations I saw significant flaws with applied unit testing strategy (which was not "unit" as a matter of fact). So, although the word is spread, there is still much work to do in order to really convert to agile.

Atlassian - respect of the community

Although I am working on software projects for Atlassian and thus I am somewhat biased, I could not resist to write about it.
Devoxx was the place where I realized how respected Atlassian is in Java community.

At almost every session I saw lots of people accessing JIRA or Confluence from their laptops or receiving their mails with familiar looking [JIRA] header.
Many speakers (unaffiliated) mentioned Atlassian products during their talks as example of awesome and productive tools.
After our talks revealing that we work on Atlassian tools, people were coming to chat and congratulate us.
Finally, during Thursday's live Java Posse session at Devoxx, Atlassian got a real applause from hundreds of geeks.
And it did not happen to Sun. It did not happen to companies like JBoss, Oracle or even Jetbrains or SpringSource.
People really seem to admire Atlassian. It it not due to free beer. Other companies also served it :)
It is not due to bullshit marketing, but rather because of being just cool and awesome. A huge thing. Very difficult to achieve.
I must admit I felt good then.

OSGi - a new sexy trend

OSGi seems to be everywhere or at least affect all bigger platforms. Spring now has it. Java 7 is more or less going in the same direction.
We will see what it will really bring to Java community. For time being it bears two connotation for me:
- the way to deal with jar hell (do you remember infamous DLL hell on Windows?)
- the way to decompose your system into independent and reusable subsystems (or components)

Spring gets heavier and heavier while Java EE with EJB strikes back

The history likes to loop. In the past the biggest advantage of Spring vs. traditional EJB-based stacks was simplicity (or lightweightness) and testability.
Now as Springs gets bigger and bigger (fortunately still provided in independent packages) and EJB 3.x builds on lessons taught by Spring, we may realize that the roles actually are changing.
EJB is claimed to be simple and lightweight, while Spring ... yeah, it depends on how far you go.
It's like in XML say 8 years ago. We started from simple XML, then people start abusing it with things like transformations (de facto programming languages), complicated schemas, descriptors, poms (I got you Maven!), xml protocols, firewalls, security, WS-* standards. Several years had to pass, in order to people could realize it and now back simplicity and conscience takes the lead. Everybody seems to hate now XML descriptors or XML configuration files (including Spring configuration). Everybody now loves simple (?) and terse annotations. I wonder when we witness just another shift. Probably when in a Java class definition you will have more lines with annotations that with the code itself - the case we are getting quite close with say EJB 3.1 :). But this is how human civilization works.
The lesson for me: it's important to know when to start, but it's equally as important to know when to stop.
BTW: everybody now uses Spring now or claims so.

Quickies competing with hunger

I presented with Marek a quickie on Atlassian IDE Connector. I think that with current Devoxx schedule and organization, quickies (at least the first slot every day) are unfortunately mistake.
Just imagine all these people who after c.a. 3 hours of listening to various sessions hurry downstairs to line up in a long queue (often for more than quarter) for lunch.
Then your quickie must compete with hunger. And your quickie will always lose. The outcome: even very intersting quickies presented in the first slot (at the very beginning of lunch break) gathered only a few dozens of participantes. The second slot was typically much better. So maybe both slots should be postponed by ca. 10 minutes next year (to have real 20 minutes break to let people grap their food and come back to the room if they are interested).

Conlusion

I think that generally Devoxx 2008 was a good conference (of course - we were talking there ;)).
There were wonderful sessions (as usually from stars like Josh Bloch or Brian Goetz or unexpectedly coming from less famous people like Simon Ritter - the session about self-made multitouch screen and Java and JavaFX programs around it) and very good sessions (e.g. from Richard Bair on JavaFX or two blokes - Jonas Jacobi and John Fallows from Kaazing on web sockets).

Unfortunately there were also quite poor talks due to either poor speakers (it really matters who and how presents), poor topics or just too simple content. Comparing to JavaOne 2007, I would say that sessions at Devoxx on average were less demanding - seemed to be targeted often for beginners. Maybe I got something wrong, but I had expected Devoxx to be a conference for intermediate to advanced developers.
The biggest technical problem of the conference itself was the lack of microphones at Q&A sessions. Something really cheap and simple to amend next year I hope.
Considering that Devoxx is really cheep (we can forgive then things like crappy food or nothing to eat on Friday) and anyway everyone can learn a lot there, I conclude that this is the conference I would like to go one more time next year.

So see you hopefully in 2009.

Assorted Devoxx Notes

  • it does not matter what your presentation is about, it is all in how well you are prepared and how you deliver it. The best presentations I have seen (admittedly, I haven't seen many, most of my time being busy in our booth) there were Joshua Bloch's and (unexpectedly) Ivar Jacobson's. Bloch gave a keynote on Java enums. Exciting keynote about enums! The mere mention of the subject should be enough to put you to sleep, yet the keynote had the right pace, engaged the audience and was pleasant to listen to. Ivar Jacobson's presentation about "being smart" - was just a bunch of semi-obvious observations on how to run and how not to run a software project. Semi-obvious yes, but delivered with class and style, without pretense and with much humor. Just splendid. On the other side of the spectrum were blokes that were able to butcher even the most interesting subjects. "Effective pairing" was one example - I had great hopes for this one (being agile and all), but the presenter was simply unprepared and was seemingly trying to improvise on the spot. I know many good improvisers, but this bloke was no Eddie van Halen. Sorry.
  • working as a booth-babe is a lot of HARD work. You meet many interesting people (and many quite scary ones too), but around 4pm you start to feel terminal exhaustion. Note to self: for the next event like this, invest in a pair of Chuck Taylor Converse All Stars. Or Doc Martens.
  • the simplest ideas for a booth that attract people work best. However, you have to be also active in the booth to take advantage of the idea. The most attractive booth on Devoxx was the one of the company called "Logica" - they didn't bother with setting up elaborately-looking booth (like Sun or Adobe did), their trick was simply hiring a beautiful girl who served awesome cappuccino. I was there at least four times a day (imagine caffeine levels in my organism), and so was everybody else. However, despite being at their booth numerous times, I have no idea what Logica is and what they do. Nor do I care. The guys at the booth did not even try to talk to me even once - they were busy sitting around their little table and chatting among themselves.
  • Amsterdam is a much cooler and visitor-friendly city than Antwerp. And no, I am not talking about pot and the red-light district. It is just that the whole place is organized towards making people feel relaxed and having a good time, while Antwerp is a bit stiff.
  • Antwerp's train station has four (four!) levels of platforms and is overall quite beautiful. I actually enjoyed spending time there. Amsterdam's train station on the other hand seems to be under construction since they started having trains there (or at least since I started visiting the place, which was quite a long time ago). It is the place you run out off immediately and don't ever want to come back to.
  • opportunity to meet fellow developers that work on tools that you use, is quite priceless. For me, drinking beer with JetBrains and ALMWorks folks was definitely the most fruitful and high-return moment of the whole Devoxx.
  • railway network in the Benelux is quite simply awesome and is the best way to move around there. I suppose the small size of the country is the key factor, but still, you can catch a train to anyplace you want pretty much every half an hour or so.
  • the part of Belgium with Antwerp in it is pretty much the integral part of the Netherlands. The people, the language, the attitude, it is very much Dutch. The part with Brussels on the other hand, is more French than regular French. Nobody speaks English to save their life, appliances in the hotel are only half functioning and the hotel crew is absolutely unable to issue a correct invoice. Just like in Paris. These two parts of the country are as different as day and night. The only glue that is keeping Belgium together seems to be beer. But believe me, if brewing beer is the only point of having Belgium, this for me is reason enough - their beer is simply the best in the world.

Tuesday, December 9, 2008

Devoxx - the crowd at our BOF


So today Slawek and I had our first talk at Devoxx 2008 about code review in agile teams.
We did it as a BOF, as we wanted to engage more people and hear how they cope with code reviews.
As it was rescheduled by Devoxx organizers at the very last moment from 19:00 to 20:00 and all printed-out materials including pocket guides were still pointing to the old time, I was expecting confusion and only several people to show up.

To my utter astonishment a crowd gathered in front of our BOF room just a few minutes before 20:00 and when we started, we was quickly run out of free seats and some people spend entire hour either standing or just laying down on the floor.
I am not sure what was the reason for such popularity of this topic (especially comparing to other BOFs, which definitely had fewer attendees). Maybe it's due to Atlassian name involved (as we work for Atlassian and I was sharing our lessons learnt there), which IMO has a very good reputation amongst developers. Maybe it was due to "agile" work used in the topic of the session (and "agile" has unfortunately become recently another popular buzzword, like SOA, although it definitely does not deserve it, as "agile" carries a lot of real value and sense). Maybe it was due to real interest in code reviews. Maybe it was due to IntelliJ IDEA involved (our IntelliJ Connector), which seems to be really popular among Devoxx participants (according to ad-hoc surveys done on whiteboards, about 30% of developers use it).

I will probably never know that.

Anyway, about 60 people showed up, they asked many interesting questions and we spend about an hour after the BOF outside the room, just exchanging our observations.

So although Demo God does not like me, as my Ubuntu spectacularly failed to properly detect projector and we we forced to use back-up Mac where we fortunately had established the exact copy ready for the presentation).
Alas, it did not help, as projector turned out to be supporting only crappy resolution of 800x600 pixels which is practically useless to demonstrate anything in IntelliJ IDEA with such resolution. Also Crucible web UI was hardly usable at such resolution.

So sorry folks, next time I will probably bring my own projector. :)

Anyway, a lot of people asked us to share our slides. Here it comes. Enjoy.



And thank you really for your coming and your participation. It was a great lesson for us.

See you on Thursday on our Quickie about Atlassian IDE Connector.

Monday, December 8, 2008

Things That Suck - "I Must What?"

I have been flying to Belgium on Ryanair this Saturday. As on every cheap airline flight, the seats are (probably on purpose) designed to make you suffer (or Ryanair designed them for midgets). To make myself a bit less miserable, I was listening to music on the iPod.

When the plane started descending, the steward approached me and asked me to "switch off all electronic devices". Sure, will do, but how? The iPod does not exactly have an "off" switch. The closest thing to it is the "hold" thingy that blocks the keyboard. So that was what I did - put the iPod on hold.

Now, the stock phones that come with iPod are somewhat on a crappy side and I have replaced them with the sort that is plugged inside your ear. They are great for canceling out external noise, but unfortunately, putting them on is a bit of a hassle. So had them on all the time.

Then I saw the steward approaching me again. This time, he seemed pissed off. "Sir, I asked you to switch off electronic equipment" - says he. "I did - as well as I could, man. This iPod is as 'off' as possible". "Sir please at least take the phones out of your ears?". "You ask me to do what?". "Take the phons off".

Ok, this left me speachless and stunned. Take them off why? So as to not do demoralize fellow passengers? Or maybe I am a mutant and my ears generate huge electromagnetic waves when touched by pieces of plastic? WTF?

Look airlines, this is just silly. The amount of electromagnetic field generated by FCC-approved electronic equipment is negligible. The iPhone's "EMP generators" are barely able to lift its hard disk's heads by 0.001 mm and spin its miniature motors. You have a huge-ass jet engine operating just 4 meters right of me - I am sure the amount of electricity generated by it could fulfill the needs of a modestly-sized village, why are you worried about my little piece of nothing here?

God, I hate flying. Mostly because the experience makes you cast a doubt on the sanity of mankind.

Friday, December 5, 2008

Devoxx 2008 - a few contributions from Atlassian

So, this year more than half of us from Poland go to Devoxx (former JavaPolis) in Antwerp, Belgium.
This is the first time I will be there. Till now I have only participated in very big events like JavaOne or smaller conferences like AtlasCamp or JUG gatherings.

I am presenting (with my colleagues) two things this year:
  • Quickie: Atlassian IDE Connector - developers for developers - Thursday December 11th, 13:10, Room 8

    We will tell you about the open source project Atlassian IDE Connector supported by Atlassian - its goals, challenges and future plans. The most significant part will be devoted to live demo of our IntelliJ Connector.

  • BOF: Effective code reviews in agile teams - Tuesday December 9th, 20:00, Room 2

    We will be talking about pros & cons of code reviews, the place of code review in agile teams (also geo-distributed), various findings and observations. We will tell you what hurts us in code reviews and how we are trying to cope with it, maximizing effectiveness of code reviews. And of course we want to hear what your experience in this regard is.


If you are interested in those topics, please come and we definitely have an interesting conversation.