May 19, 2013

Why I switched from Eclipse to IntelliJ IDEA

I’m an old Eclipse user. It has served me well for several years, and in many ways it's a fantastic application. But in the last few years, there has been very little progress for the Eclipse project. The new Eclipse versions, shipped once a year in June, hasn't really brought anything really new or interesting. Eclipse is also lagging behind in many areas, such as Maven support.

It is only logical that many Java developers have started to look around to see if there's anything better out there. And guess what? There is. It's called IntelliJ IDEA (henceforth called “IntelliJ”) and it's a free and open source IDE from a company called Jetbrains. But you probably knew that already.

As it turned out, I was the lucky winner of a IntelliJ Ultimate Edition license at the Jetbrains booth at ├średev developer conference in 2012 (the Community Edition is completely free though). At that time I still used Eclipse; I had tried IntelliJ a few times, but I wasn't convinced. I mean, it was fast and beautiful and all that, but it just felt strange and backwards to me. It was simply not for me, I thought.

Fast forward a few months. I had quit working for a consultant company that couldn’t give me exciting enough projects to work on, and started working at a company developing a backup service for the cloud, developing in a much more modern environment. I kept on using Eclipse at first, but got increasingly frustrated with the weak Maven support (hint: it's unusable).

IntelliJ, on the other hand, had great Maven support, and that’s why I decided to force myself to use it for 30 days to see if it would stick. It turned out, I did not need to force myself, after just a few days I was falling in love.

What’s so great about IntelliJ then?

It’s fast, really fast. Since it’s not compiling all the time, like Eclipse does, it has a lot more resources to spend on the UI. And yes, it will still show warnings and errors as you type.

It’s beautiful. Well, the standard theme is no better than Eclipse's, but the new dark theme called Darcula is gorgeous (looks a little like sublime text).

No more saving. Files are saved automatically, no more ctrl+s’ing or cmd+s’ing. That of course means that you need to press something else if you want IntelliJ to compile (e.g. for hot-swapping), and that keystroke is cmd+F9 (and probably ctrl+F9 on Linux/Windows). It turns out you don't need to compile every time you save. Who knew!

Easy variable inspection. At first I was annoyed that inspecting variables during debug was a little more complicated in IntelliJ than selecting and pressing cmd+shift+i in Eclipse. But then I accidentally discovered that all you need to do is Alt-click on the variable that you want to inspect. Awesome!

Cmd+Alt+click opens the implementation of an interface or an interface method (or brings up a list if there are more than one).

Alt+Enter helps you almost always! It can quickly insert code to:
- Iterate over a collection
- Add missing imports
- Introduce a new variable from a method call
- Much, much more...

Easily generate constructors, getters, setters etc., just by pressing Ctrl+Enter (not Cmd!).

Lots of plugins which are very easy to install, no more update sites - all in one place. Eclipse has always been a little clunky when it comes to plugin management.

Great Maven support (adds and removes modules automatically etc). I no longer have synchronization issues between the terminal and Eclipse. No more F5, baby!

Warns if public methods are unused. Eclipse only does private.

Console scroll lock works. Scroll locking in the Eclipse Console almost works, which means it's unusable. When the lock is on, there's still scrolling, just not as much.  In IntelliJ you just click in the console where you want it locked - and it actually works!

Visible changes - IntelliJ shows a green bar in the gutter where changes have been made to a source file - it's easy to undo right in the editor, would otherwise be done with git (or similar).

As with any IDE, you need to do a little tweaking to get it just right, but that’s expected. The first thing to do is obviously to change to the Darcula theme. The settings window is completely searchable, so it’s very easy to find what you’re looking for. If you still struggle, turn to Google. If you still can't make it work, file a feature request in the bug tracker. Jetbrains people are very helpful and responds quickly.

These are some of the things I love about IntelliJ. What are your reasons for using it? Or even more interesting, what are your reasons for not using it?

(You can imagine how thrilled I am over Google basing their new Android Studio IDE off of IntelliJ!)

May 14, 2013

Why Windows is doomed


You might think that an operating system that is on more than 90% of all desktop computers right now is in a pretty safe place. They can do pretty much whatever they want, and they will be fine. Or can they?


If you know me, you probably know that I’m not a Windows user. I have not been using Windows for many minutes in the last 6-7 years. I started using Linux 15 years ago, and right now I am a hybrid Linux and OSX user. That means I can’t really say if I think the latest versions of Windows (past Windows XP) are any good or not, I only know what I read and hear about it.

What I wanted to share with you in this blog post is the small (and big) things I’ve been noticing lately, all pointing to the same direction - this is the beginning of the end of Windows. It is probably going to take several years, at least 10, for Windows to become irrelevant, but it all started just a few years ago, and we can see it happening all around us.

1. Windows 8 is failing, big time. It’s numbers are even worse that Vista’s, which is publicly regarded as a big failure for MS. The new Windows 8 UI (whatever it is called this week) is a design disaster. Microsoft clearly has no idea of what they’re doing. They know they need to do something, they just don’t know what the customers want.

2. Valve is moving to Linux, and getting a lot more performance from Ubuntu than from Windows (with less effort and in much less time). The important thing here is that someone is doing gaming on Linux, and since it has been quite successful, many others will follow. In a few years time Ubuntu will be the No 1 PC gaming platform, not Windows.

3. Microsoft has lost the mobile war. Google and Apple is eating the market, and several alternative platforms like Ubuntu and Firefox OS is much more interesting than Windows. Microsoft is clearly lost in the mobile space.

4. There is no compelling reason to upgrade from Windows 7 to 8 on the desktop. Most companies will continue running Windows XP and 7, and moving to Linux is in many cases easier (=cheaper) than upgrading Windows.

5. I am totally clueless about developing in .NET and Windows, but from what I’ve read developers hate the new Windows 8 platform. In this appstore age, you need developers.

6. With cloud and web based services the operating system is getting more and more irrelevant. You are not depending on a particular OS or Web browser anymore. Open standards won. A kernel and a browser is enough for most people, but we just haven’t realized it yet.

7. More and more OEM’s are offering Linux (primarily Ubuntu) as an alternative to Windows. Mac sales are very strong, and Chromebooks may very well become huge.

8. Microsoft is too slow. When there’s a new market opportunity, Apple and Google is a lot faster, and so is grandma turtle. Microsoft needs to make big changes before they can even begin to compete, or they will continue to lose.
Just look at the raspberry pie for example - it's a huge hit, and there are a lot of devices like it. Do they run Windows? No. Do they run Linux? Heck yeah they do!

9. MIcrosoft is not competitive anymore, and although there's a lot that they could do, most of it they can't or won't do. To be competitive, Microsoft would need to:
* Drop the price for Windows to free or next to nothing (like Linux and OSX). The price tag of Ubuntu (free), and the fact that it’s freely distributable to anyone by anyone, is one of it’s biggest advantages. That makes it a very friendly OS that is perfect for quickly getting that new production server up and running, or just playing around with new stuff. The world has moved on from license keys and product activations, but Microsoft has not.
* Drop backwards compatibility with Windows 3.1-Windows 98 at least. This legacy is one big reason for Windows’ problems with security, stability and speed. If you need that compatibility, you can go with Windows 7. Most companies do not, and the consumers certainly don’t give a rat’s ass. Microsoft needs to throw out the old junk and completely rewrite the kernel once and for all.
* Fully embrace and support open standards, improving interoperability with other systems. Shut down development of Internet Explorer (at least use WebKit or similar). Proprietary standards only generates a lot of hate for the platform, and Windows has got enough of that.
* Make more frequent releases. Ubuntu is releasing a new version every 6 months. That keeps the OS fresh and interesting. Upgrades cost nothing. Apple releases new versions of OSX once every 1-2 years, and there’s often enough new stuff to make it worth the few dollars that it costs. And more importantly, the changes to the user interface are not overwhelming from one release to another.
Of course, making more frequent releases means that the reason to upgrade to a new Windows version are even smaller, and that’s why they can’t do it.

That’s some of the things that Microsoft needs to do, but they won’t. Because they can’t (or they would have a long time ago). Their business model has long since expired, and when they failed to adapt to the new reality, the market was lost. Everyone may not see it yet, but it is the reality.

So what about the future? In the future that I see, Windows has become a marginalized legacy operating system (much like traditional UNIX today), only used in the biggest companies with the oldest systems. I mean, companies are still running Windows NT, it’s not like Windows will disappear within 20 years, but it will become irrelevant to consumers and new systems will be built primarily using open standards on Linux in the cloud (where Google, Canonical and Amazon will be the big players - and maybe even Facebook?).

Consumers who want a full operating system that can be used for anything from gaming, watching movies, working, development etc. (i.e. Power Users) - they will go for OSX (on macs) or Ubuntu (on PCs and macs). A normal user will eventually see the huge benefit of a slimmed and hassle-free OS like Chrome OS. When Google releases an easy to use Windows based installer for Chrome OS (like wubi for Ubuntu), there’s really nothing stopping anyone from migrating.

In a few years time, nobody wants Windows on their new computer. It’s dead on mobile, and mobile is increasingly becoming the norm. Apple and Google are the new masters, like it or not, and they will eventually take over a big part of the desktop market as well.

Most of us know that open source has already won, it just takes time for everyone to realize it. Some will never.

March 11, 2013

Forget the Chromebook - here's the Openbook!

Google have recently gotten a fair share of criticism for the price of the Chromebook Pixel - the high-end laptop that comes preinstalled with Google’s Chrome OS. It starts at $1299, and that’s several times more than the previous Chromebooks made by Samsung ($249), Acer ($199) and HP ($329).

The mistake that people make is comparing the Pixel with the other Chromebooks, when it instead should be compared with the Apple MacBook Retina 13”, which until the Pixel was released was a unique product with the high-end components and beautiful design that make up the device. The Pixel is right now the only device comparable to the Apple laptop, and at a lower price - the MacBook Pro Retina 13” starts at $1499.

But can you really compare OSX with Chrome OS and get away with it? Of course not, but the Pixel is not about Chrome OS. Yes, that’s right. It’s not about the OS at all. It’s about the difference between Apple and Google.

If you look at the products coming out from the Googleplex, you see that the Pixel fits perfectly into the pattern. Android came to life because Google wanted an alternative to the closed ecosystem of Apple’s IPhone. They saw, as did I, an emerging problem where one player could rule the market and make the rules all by itself. And if that player is Apple, it’s a very bad thing. Google provided the open alternative that apparently many people needed.

The same goes for WebM, ChromeOS, Google Apps, Data Liberation, Nexus product line, and the list goes on. Google is all about making great products that you’ll want to use. Not because you have to, but because you really want to. Google is not making any choices for you.

And when it comes to the Pixel, Chrome OS is not the only OS that can be run on it. Google is working hard on contributing patches to the Linux kernel to make it compatible with the hardware of the Pixel. You’ll likely be able to run Windows on it eventually, if that’s your game. And heck, why not throw some Android goodness on it? The only thing you’ll be having trouble running is OSX. Not because of Google, but because of Apple.

It’s really a shame that the Pixel is called a “Chromebook”. It just happens to come preinstalled with Chrome OS, that’s all. What you choose to run is up to you, not Google or anyone else. In the light of the recent jerk move by Microsoft called Secure Boot, which essentially is a way to make it harder to run anything else but Windows on PC’s (using security as an excuse), the openness that the Pixel provides is what we as consumers desperately need.

As PC’s are getting more and more tied to the operating system with which they come preinstalled (if it’s Windows), and Apple is already working hard to keep you from replacing OSX, I see the Pixel as the first of a brand new range of devices that are open to anything you want to do with them. The hardware is truly yours.

I call it “Openbook”.

February 23, 2013

I want the Chromebook Pixel - just not with ChromeOS

So the rumors were true. There is actually going to be a +Chromebook Pixel. That makes me very happy, since it's the first time someone who's not Apple saying "Hey, laptops are in desperate need of a facelift".

I love the Macbook Pro. I am writing this on my 15" Retina Macbook Pro. I got this laptop despite the fact that I don't like Apple, and despite the fact that I knew I wasn't going to run Linux on it, at least not in 1 or 2 years. I got it because there's nothing else like it. And by that, I don't mean just the retina display. I can live without retina (in fact, I mostly use this computer with an external screen that's really, really blurry in comparison). It's the beauty and the simplicity that I love. The keyboard is a joy to type on, and the thing is just thin and light and simply beautiful. And it's really fast and quiet too. There's nothing like it in the PC world. Yet.

Seems like the Chromebook Pixel is here to bring that beauty to the PC world. But wait.. It runs ChromeOS, does that really make it a PC? Or is it something else? The hardware is wonderful, but can it really be compared to a Windows laptop in terms of software features? Well, it depends on who you are.

For most people using a laptop at home, ChromeOS is the perfect fit. It's fast and it's extremely easy to use. No more antivirus, no more upgrades, no more reinstalls. No more nothing, except just surfing the web. In that regard, you get a lot more from a Chromebook than from a Windows laptop.

But it's certainly not enough for developers like me (though for some developers it is). I need to run a full Java IDE like Eclipse or IntelliJ IDEA, and those do not come in web/cloud versions. I wish they did, but they don't.

So, why am I excited about the Chromebook Pixel? Because, unlike the Macbook, you are probably going to be able to install whatever you want on it, and that's what makes it a real PC. You would probably be able to run Windows 8 on it, but obviously that's not for me. I would install Ubuntu on it right away, and I would have the laptop of my dreams. A thin, light and beautiful device with a free operating system that I love. With a touch screen. That would be, as the americans say, truly awesome.

And all this for the price of $1299 - I am excited!


June 29, 2012

Why having two Google OS's makes perfect sense

Many people have asked why Google develops two different operating systems - Android and Chrome OS. They are both based on Linux, but the approach and purpose is very different. One common perception seems to be that the two systems are in conflict with one another - especially should Android eventually be released for desktops. Releasing Honeycomb (Android 3.0) for tablets sure was a step in that direction.

I have also asked myself (and others) why on Larry Page's green earth Google spend money developing two different OS's when Android obviously is such a big hit, and the ChromeBook certainly is not. Earlier today, I finally got it. Let me explain.

Remember Canonical's Ubuntu+Android experiment? If not, the short story is that you can boot Ubuntu from your phone (or tablet, I suppose, but they only say "phone") when connected to a monitor with a mouse and keyboard. From the Ubuntu desktop, you then have access to all the data on your Android device. It's a crazy and genius idea that may challenge Microsoft's view on software licenses in the future.

Today I discovered Airdroid, an Android app that has a 4.8 star rating with over 33 000 votes and 1 000 000+ downloads. That alone, is remarkable.
What the app does is that it lets you access your Android device from a browser window. It also integrates nicely with your desktop OS, making it possible to drag&drop files into the Android device.

Now, putting these two brilliant ideas together, imagine having an Android device (not necessarily a phone), which boots up Chrome OS when placed in a dock connected to a screen, mouse and keyboard. Chrome OS will be nicely integrated with the Android Device, including, but not limited to, a browser tab where you can manage all the data and settings on your Android device. This is what I think we will see from Google in 6-12 months.

Just the other day, Google announced the Nexus 7 tablet. A quad core tablet with Android 4.1 that comes with a very compelling price tag (matching even the cheap Kindle Fire). This device, with it's 4 cores, makes for the perfect device for running a minimalistic OS like Chrome OS alongside Android. Soon these processors will be very common in phones as well.

Most people seem to think that most people will not be content with an OS that is "just a browser". I strongly disagree - I do think most people would be fine with just a browser, and I don't see Chrome OS as "just a browser".

I am a professional software developer - clearly Chrome OS would not be enough for me? No, not today. But seeing the many interesting web based IDE projects like Cloud9, Light TableKoding and Eclipse Orion, we are getting there. Web developers clearly have a lot of options already today.


(actually, thinking about the ways I could break free from the traditional desktop OS gives me kind of the same feeling when I had trying to break free from Windows almost ten years ago - fascinating)


I believe that the phone (or tablet) is becoming the perfect computer. Traditional desktop computers may soon become obsolete, and people will just have a screen, keyboard and mouse on their desks, with a dock for connecting to any device you can imagine (actually, when you think about it, a mouse may not even be necessary given that you can use the phone screen as a trackpad). Wherever you are, if there's a computer - it's your computer.
And when you think about laptops - think about how thin and light (and cheap!) they would be if they were not actually computers, but only devices for interacting with your Android device in "desktop mode".

Given that the most recent phones, like the Samsung Galaxy SIII, have powerful quad core processors, computing power will not be an issue.

You also will not need any other data connection than what's available through your phone - a permanent internet connection in your home will not be necessary, and given the high speed of 4G, it may even become redundant.


These are some of my thoughts on the future of computing, a subject that I think is very interesting. It could go anywhere, really. The possibilities truly are endless. (and it really helps having a free operating system like Linux when you're innovating. Think about that, Apple and Microsoft)

February 20, 2012

How to use Google Music outside the US

Google Music is an awesome service where you can upload up to 20 000 songs to the cloud and play them all from any computer using a web browser (or from any Android phone, of course). For now, the service is free, but I suppose they will eventually charge you a few bucks for it once the service is out of beta.

Living in Sweden, I could not log in and activate Google Music. After a little googling I came across a very simple way of using Google Music outside the US. You need to make the Google Music web site think that you are in the US, and the awesome thing is that you only need to do this once when you activate the service.

To activate Google Music outside the US, follow these simple steps:
2. On that page, in the address text field, enter https://music.google.com
3. Log in and accept the agreement
4. Download the Google Music uploader tool and start uploading your music!

If you have an Android phone, you might want to downoad the Google Music app. Google, the search engine, can help you find it ;) (it may be as simple as installing it from Android Market)
However, the Google Music app was already installed on my phone, which is a Samsung Galaxy Nexus.

January 11, 2012

Eclipse tip: Handling static imports

Sometimes Eclipse just drives me mad. But most of the time there is a setting hidden deep in the interface somewhere that can cure the frustrating behavior. Unfortunately, it's not always easy to find (or understand) these settings.

On that note, I would like to give you a quick Eclipse tip if you're using static imports. By default, when organizing imports, Eclipse transforms your static imports ending with ".*" into just the ones that you actually use.
For example:

import static org.easymock.EasyMock.*;
import static org.junit.Assert.*;

becomes:
import static org.easymock.EasyMock.createMockBuilder;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.notNull;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;

This is very frustrating, because Eclipse removes the imports that you are going to use, but have not yet written, forcing you to import each one as you go along. It would be easier if Eclipse just let them be, and didn't touch the ".*" imports.

There is actually no setting that tells Eclipse to keep it's dirty hands off just the static imports, but it turns out there is something similar that can be just as useful.

Go to the Eclipse preferences and navigate to Java->Code Style->Organize Imports. Close to the bottom of this screen (at least in Eclipse Indigo) you will see a setting called "Number of static imports needed for .* (e.g. java.lang.Math):". The default value for this is "99", which practically means unlimited. Changing this value to something lower, e.g. "2", has the effect that Eclipse will let you keep your ".*" imports, as long as you actually use at least 2 different methods from that import.

Changing this setting to "1" would always leave your ".*" as they are, and additionally turn this:
import static org.easymock.EasyMock.expect;
into this:
import static org.easymock.EasyMock.*;
which may or may not be desirable. You should choose a value that suits your needs.

Importing statically with .* would of course mean that you probably import some stuff that you don't use, but I wouldn't worry about that. I would be surprised if that would make any measurable performance difference, and I don't consider it ugly.