2010-07-16

Java applications on the desktop

When it comes to discussions about programming languages on forums and newsgroups, one argument against Java is that there are quite no Java applications for the desktop.

This is definitely not true. I have looked what Java applications I am using (or used a lot in the past), and here is a list:
And of course, if you are a developer programming in Java, JavaFX, C++, PHP, Python or Scala for example, then you probably use NetBeans or Eclipse - both very popular IDEs (integrated development environments) are written in Java.


There are many, many Java desktop applications out there, look for example at javadesktop.org. You can see the wide area where Java is used on the desktop at geertjans blog here for example or at the NetBeans site here.

One advantage of using Java at the desktop is that you can choose between two core different ways: Swing or SWT. While SWT tries to use the OS specific widgets (to look more like the original OS and be faster), Swing does render everything itself. So SWT is a little bit faster and looks more like OS, but Swing is more flexible (more widgets available) and you can easily use different look and feel / themes (there is also an OS like). In both cases you can develop modern Java desktop applications that look nice and integrated with your OS.

The disadvantage of using Java on the desktop - I will be honest - is startup speed. Once started, SWT and Swing applications behave fast - probably not as a native Gnome application for instance but really - it's fast enough for the user. That startup time is still an issue you will notice mostly, if you write small tools as Java desktop applications. For larger ones it is less annoying because those you don't open and close all the time. If you open the application and tend to keep it open you will have no problem. If you open and close the app frequently then it may become an issue. Same applies for small commandline tools - writing those in Java is maybe not the best option. Anyway, really annoying is only the first start of the first Java application after reboot when the Java runtime is not in the cache yet. NetBeans for example (which is a big Java application) needs 12 seconds on my machine (a year old) when the Java runtime is already in the cache. Freemind is a smaller application and takes only 5 seconds to startup which is acceptable.

If you look also at server-side then ... what should I say .... the world is full of Java applications - too much to cover here (and of course for many websites or web applications you often can't really say from outside what is used behind the scenes).

Related post: Popular Java myths, The future of Java.

2010-07-15

Get reliable local IP address in Java 6

It is strange: I consider myself still being new to Java, but when I search for particular sample code, that should be written thousand times before, I sometimes find only samples that do only half the job or miss important details.
So happened for getting the local IP address(es) of the machine you are running on. I experienced for example performance issues retrieving the IPs when running with a mobile internet stick (point-to-point device).

My example code can be found here: http://pastebin.com/5X073pUc

If you want just one address, that is probably the best fitting then you probable want to use this example: http://pastebin.com/PLAcTXac

Related post: Dynamic method invocation in Java 6.

The small software vendors

Especially these days companies are very careful in choosing their vendors. This certainly also applies for software.

I do get some considerations from customers which I do not really consider being always relevant or true:
  • "We prefer to buy from large software vendors, because as an international company, we need the availability of support in different countries."
    Especially software support can be available all over the world because there is no need to actually sit there. With chat, voice- & video communication plus remote desktop tools support can be done all over the world from a single location.
    Further, a large company could have plenty of people sitting in plenty of countries, but this does not mean that all those people have (the same level of) good knowledge of the software. Honestly, those who really know the product, are always the developers and the people who communicate most with them.

  • "A small software vendor is more likely to fail and go bankrupt and then we have invested in a dead product."
    First, present time shows that even a large company can fail (maybe except banks ;-) ).
    Second, bankrupty is not the only case leading to a dead product! It happens more often that a product is simply discontinued and this happens for products of bigger vendors also. In bankrupty case, if a product is good there will be other companies taking over the product - especially if money can be made from supporting the product. But if nobody is interested any more in the product your situation is worse.
    Third, if you ensure that you have access to the source code (even if only in bankrupt case - which would be sufficient and cheaper in most cases), you always can hire people working on the product implementing the features YOU need (this is a big advantage of Open Source).

  • "At small software vendors the deep know-how is bound to a few people only which also means a higher risk for the customer."
    Nowadays companies do not invest in having a lot of backup resources. This also affects developers. And I have experienced dependency on a few people also at big companies. Just because the company is bigger does not necessarily mean they have more smart people there working on the same stuff. It is more important that the team is continuously motivated and people like to work for the company employing them. A stable and motivated team at the vendor is the key for lasting long-term support of your product.

And last but not least let's not forget about a few advantages of choosing smaller vendors:
  1. Usually more flexible organization.
  2. Better and more direct contact with tech people.
  3. Cheaper - big companies often have a big head of administration and more levels of managment - all those want to be paid.
  4. What a small customer is for a big vendor can be a big customer for a small vendor. So the small vendor is more likely to listen to your needs.
  5. If you are a big company and somehow get too dependent from a very small company, you could take over more easily.
And BTW: There are more smaller vendors than big ones, so the set of applications to choose from is significantly higher if you consider also the small vendors.

Related posts: Small Business Boom, Scope of IT projects, Paying for free and Open Source, IT Outsourcing, IT projects cost explosion, The Open Source idea.

      2010-07-01

      Small Business Boom

      If boosted by the economic crisis or not, in my neighbourhood I can observe more and more people becoming self-employed building their real own company or just getting freelancers.

      What this usually brings is more flexibility and a low budget - at least at the beginning.

      Classical style of IT then:
      • Internet ADSL connection to home office
      • E-Mail (along with spam filtering) hosted at the Internet provider
      • Single notebook or desktop PC with some backup strategy or a dedicated server + desktop pc + laptop (something like this). Newer Internet provider modems are even shipped with an option to plugin an external harddrive that is directly offered as a network storage service for connected (W)LAN-devices.
      • All-in-one printer-scanner-fax devices for doing those most important office operations dealing with paper where still necessary. Usually small and compact devices do not occupy too much space and can handle the small amount of paper in a modern office.
      • Contacts are saved in the address books of the used email-client, in some cases additional simple local XLS files or Access databases are used or also free online services (but only surprisingly seldom - I guess people do consider their business contacts as a company secret and do have privace concerns).
      • Office application package is intensively used for writing letters (where still needed), contracts, agreements, invoices and the like.
      • PDFs are created from the office documents written or scanned documents are saved in PDF format for (long-term).
      • Sector or branch specific software applications (e.g. banking or insurance agency tools) move more and more in the direction of being online services (web applications) rather than applications that need a local installation.
      • With a smartphone they can answer emails also while on the road which is crucial for a one- or two-man/women show.
      • Appointments are managed in the smartphone with the smart phone's own application, Google Calendar or in a classical pen & paper style (what is actually used is mostly depending on people in the company and branch).
      I can see such constructs from 1 to 3 or 4 people in my local area. Some of them are considering a move to Linux and I already helped a few building their home-office-desktop on Linux. And lately there are coming more and more asking for Linux...

      Related posts: Why Linux?, Going Linux, Why I switched to Ubuntu, The small software vendors.

      2010-06-24

      Popular Java myths

      After developing more than 10 years mostly in Visual Basic (classic), VB Script, VBA etc I started moving to Java after a long evaluation period of different languages about 2 years ago (see also "The programming language") .

      Since then when talking with customers, .NET people and even Java folks people come across again and again with the same arguments against Java that are simply wrong. After discussing and researching these arguments a lot of times I am really tired of explaining so this post will hopefully save me from that in the future.

      BTW: In discussions you have to distinguish between the Java as a platform (JVM) or the Java language. There are a lot of other languages like Scala, Groovy, JRuby (Ruby interpreter) or Jython (Python interpreter) and others. That the JVM is very popular and far from being dead is not taken into doubt by most people, not so for the Java language.

      But why don't these Java language myths finally die:
      1. Java is dead.
        The argument usually comes from the fact that a long time passed since the last major release (Java 6 Update 20 is current at this time) and that they don't see big new stuff coming. At this point have you ever considered C(++) dying? - Or Microsoft Windows? No big changes for many years there either!
        There are other languages that evolve very fast - but take into consideration that most of those languages are very new in relation to Java and there is still much work to be done. Of course with evolution of a language there is legacy generated and it gets more difficult to introduce major new stuff. The newer languages will see the same happening as these problems affects any software getting into age.
        But: It means, Java is proven and stable and I am happy that the language is not changed or enhanced by running after hypes. I really like the decision to think well before really changing a big thing (like introducing closures).
        Another reason why people told Java to death is citing the TIOBE or other indexes showing Java loosing popularity or market share. If you examine how these statistics are built you always find that they are not complete and just investigate a few parameters (like new items in Google search results for example). When I heard the last discussion about TIOBE, Java has fallen on position 2 behind C - now it is back on top again although - according to TIOBE - it still looses popularity (which is logical to me because a lot of new other languages are running on the JVM attracting especially Java developers). On the other hand tht C# is gaining, does not necessarily mean that it is better than Java. Windows developers didn't get major new stuff for about 10 years and basically Microsoft is telling them to move.
        And it remains the question if new is always better, a lot of companies heavily rely on the stability of Java and the long-term return on investment (ROI).
        Besides, although people say, Java is dying, there is so much daily news on Java that I simply can only follow the biggest news. Java land is soooo large and the community is so huge.
        Last but not least: Because there are more operating systems around than ever, platform independent development is getting more important (as developing separately for each platform is costly) - well this is a plus for all languages based on the JVM.
      2. Java is slow.
        There are 3 groups of people saying this. The first group is talking about the startup times and the second is comparing with C(++).

        Regarding the first group: These are mostly people on Windows using Java applications just occassionally. Yes, the JVM takes a while to load (which BTW should be addressed in Java 7) but this applies also for the .NET runtime or other big libraries used in other big applications. The point is, that Windows tends to load everything Windows-related already on Windows startup and if an application using the .NET runtime already then of course the next application will start faster. This issues is (at least partly) already addressed because some Java update comes with an autostarter that also loads the JVM at login time. And BTW: Java 6 is much faster than Java 5 and Java on Linux is much faster than on Windows.

        Regarding the second group: They usually refer to optimized C(++) code. First to say, most developers do not really performance optimize their code (only when necessary); second, in a lot of cases, performance of the language is not the bottleneck (usually network and HDD speed is - or inefficient algorithms/storage methods) and third, the optimization is done at compile time and at runtime. Runtime optimization is not available for C(++)-programs. So it can happen, that Java is even faster than C(++). But of course, in a lot of cases particular optimizations are written in C(++) and then called from Java to improve the overall performance. Of course, C(++) has the potential to be faster than Java. The write once, run everywhere idea introduces a level of abstraction that surely can affect performance - there is no gain that does not introduce a cost somewhere else. But: For most performance issues the performance of the language itself is irrelevant (I mentioned the real bottlenecks above)! Further, I only met once a C(++) developer who really considered performance on everything he did. Anyway, just because C(++) tends to be the fastest of all programming languages, Java is not slow - Java is faster than most other languages! - See e.g. benchmarks at alioth.debian.org.

        Regarding the third group: Those are usually comparing some simple PHP application with some Java EE application that makes use of a component stack that I just get sick when I see it - so no wonder if such a monster app is behaving a little lethargic. Although Java is widely used in the EE world in huge environments, a real lot of connections and a huge amount of data with a huge component stack and a lot of legacy code (and sometimes even still on Java 4 or 5), Java could be used in smaller environments too. Let's say, a typical PHP application contains a lot of DB queries, XML/JSON/HTML parsing and HTML generation. This could be easily done with plain Java also without introducing any particular framework. So most of those people are simply comparing apples with bananas. See also benchmark mentioned before where PHP rates really bad. - That said, according to earlier mentioned real bottlenecks, that does not really matter in most cases.
      3. Java applications need longer time to develop.
        Well, this is maybe not a myth, but a tendency. It is true that while a Ruby-Developer might already have finished the task, the Java developer might still be evaluating the right framework and library to use. But this is not due to the language itself. In many other languages you have not the choices you have in Java land. And for development on Windows, many people just rely on the recommendations given by Microsoft. My experience, after I got member of the local JUG and met some Java developers elsewhere at conferences is, that there are really smart people doing awesome stuff and working on big and critical projects and such with product lifetimes beond 10 or even 20 years. Of course this involves a big responsibility and therefore I can see Java developers investing more time into the evaluation of the architecture, used frameworks and libraries and algorithms.
        And this does not mean that you can't get a small project quickly up and running the "agile style" (using the libraries and frameworks you are already familiar with without starting to evaluate with Adam and Eve).
        Example: Lately I needed a little tool to count all PDF pages of all PDF documents in a certain tree structure (to evaluate needed license volume for OCR processing). In about an hour I had a small tool ready. I was sure, that there exists a tool already that I could use but searching the internet + testing would have been similar amount of work. And if I would have done it with VB on Windows only half an hour for just building a setup that installs the application at client side - but in Java I simply sent the built jar by email and finished. Just run it without the need to install. As another example it took me about 4 days for a prototype of a PDF archiving tool in Swing with embedded PDF viewer and fulltext indexing of the PDF content. Of course this would not have been possible without any experience in Java - any language must be learned first to get really productive. I have a friend who wondered about the long time I spent on evaluation when starting with Java. Yeah, I already can choose between at least 3 great free (see comparison at Wikipedia) Integrated Development Environments (IDE) while on Windows I only have 1 free for .NET in best case (because the most obvious choice here is the costly Visual Studio). Then for thick clients I can choose at least between SWT or Swing for GUI (not to talk about the plenty of choices for web applications). Then there are plenty of logging frameworks and so on. But once you have chosen your preferred toolset, you can use that also if it might not fit 100% best for the next project y after finished project x. And BTW: You could rely on the recommendation of others (if you want to rely on me use NetBeans and/with Swing for thick clients). I myself did not have the appropriate contacts so I went the rocky way.

      Related posts: Java applications on the desktop, The programming language, The IDE and the libraries, The dawn after sunset, Dynamic method invocation in Java 6, The future of Java.

      2010-05-26

      Ubuntu 10.04 Experiences

      More than a month passed since I posted the last time and the reason was that I collected a lot of experience participating with testing of the Ubuntu 10.04 Lucid Lynx Long Term Support version (and I also have been ill in the meantime). After the release at the end of April Ubuntu was a lot in the news. At that time I already had made about 4 or 5 test installations. Since the release I installed Ubuntu on several different hardware environments - older and very new. So just about a month after the release I already done plenty installations and tested the new versions of several applications.

      I am very well known for finding bugs - and this was one of the reasons why I started participating with testing. Other reasons were:
      • I get a lot of free (but priceless) support from the Linux/Ubuntu community in the forums and at Launchpad so wanted to give something back.

      • After upgrading from 9.04 to 9.10 I experienced several issues with mobile Internet USB sticks. This seems to be a difficult topic because there are many different versions and types of modems out there in the wild, providers and manufacturers only support Windows officially and there are local differences (it looks like different countries and phone/mobile providers sometimes have different variants of firmware). Therefore I found it important to help out. So I either invested in a second different modem model and different provider.

      • In former times on my home PC I switched to every new Fedora version (then stopped because simply too much work, upgrading every 6 months). When I switched for my work notebook to Ubuntu I also upgraded as soon as the next version was available - it worked quite flawless but again some work involved. Therefore I decided with Ubuntu 10.04 to stick to LTS versions only which means: Only update each 2 or 3 years according to Ubuntu release cycles. And so it became quite important for me to get a stable version.

      To give a short review:
      1. Already since Ubuntu 9.04 Jaunty Jackalope Ubuntu has everything on the desktop that I need for my daily work and for what I am doing at home even older versions did it. And basically, the OS itself was not the major component where I was waiting for new features, it was the applications. For example, the last thing I waited for, was the TeamViewer getting a Linux version. That is clearly out of Ubuntu scope because the TeamViewer isn't either in the repositories.

      2. The biggest and best new feature in my opinion: Ubuntu only comes with Open Source drivers (this is a need according to the licence under which Ubuntu is released) but after the first restart it immediately recognizes if there is a (better) but proprietary driver for some of your hardware components available out there and offers you a one-click download+installation of those. Awesome!
        Problem: I had one laptop where the WLAN built-in card wasn't working out-of-the-box. So I had to attach it to real network to download the alternate driver. Once installed it worked well. I had two machines with NVidia card where the one-click installation brought the better driver with all fancy desktop effects. I remember this was a little more work in the past (even if not so much). Another issue I had (until applying all recent updates) was cracking noise of the speaker when shutting down. The tipping point (or question) here is: Why are vendors using such shitty hardware that does not offer open source drivers or behave in a non-usual manner (the cracking noise)? For example HP is very good in printers but horrible in notebooks - especially when it comes to Linux support. The webcam on the other hand worked out-of-the-box on the HP while I had an issue with another external webcam although just not working in Skype (while that was the main application that needed it) which was fixable by simply changing the way skype is started.

      3. Current status with mobile internet: If you own one of the supported/tested/working versions of modems, it works flawless - less work to setup as on Windows and seamlessly integrated (no extra application running) and autoconnecting as soon as you plug in the stick. Current status: Some mobile modems might not work out-of-the-box in 10.04. In the best case (if it is not working immediately), a single one-time sudo apt-get install usb-modeswitch (or installing usb-modeswitch using the GUI) is sufficient to make it work. In more particular cases you might need to add some config rules. Regarding the mobile internet working out-of-the-box probably 9.04 was the best release so far - but some newer (and maybe more buggy) modems (or modem firmwares respectively) were not available in these times...

      4. On my about 5 year old home PC I had Fedora 7 or 9 installed and after it got Ubuntu 10.04 now it starts and runs a lot faster. Think twice about that: Older hardware and new Linux version starts and runs faster. I never ever experienced that on Windows. Basically I do not use Hibernate any more because writing the whole memory to disk is much more time consuming than shutting down and starting up.

      5. I don't like the colors of the new theme, I hate the buttons on the left and they removed a button in Nautilus I often used (where I now only have the menu or keyboard shortcut any more). So basically I find the new theme being bullshit. But this can be changed easily through System-Preferences-Appearance and chosing e.g. ClearLooks theme. However, I have added a repository which offers a lot of new cool themes - the Bisigi themes. And the balanzan is my favorite.

      6. Partner and extra repositories have been enhanced - a lot of applications - like Skype or Google Earth can now be installed with less hassle.

      7. I found a lot of bugs - which I wondered as it is an LTS release and should be reliable. One issue was with using the Alternate version to setup a software RAID. The positive: It took about two weeks to fix and it took so long not because of the developers but because I didn't have so much time for testing (basically only in the late evenings). That confirms my former experience with 9.04 and 9.10 that bugs are fixed quite fast. - I say "quite" because it depends on the project. Kernel developers by tendency respond faster than others. When I report bugs in Ubuntu I am directly at the bug tracker together with the developers. That way I really feel a community member in the meantime. Where on Windows you need to pass a selection process or know some people guiding you to the right place getting a contributor, in the Linux world it just happens. When a program crashes you can send an automated bug report by single click - similar to Windows - but then the bug tracker opens and you are right there in the middle of the community and have the developers at hand. Given that direct contact to developers and other contributors I want to ask you for one thing: Treat them well - they work for you!

      8. The first time for backing up I did not work with disk images (where I use CloneZilla usually). I only backed up the home folder (while not logged in as user but as root from a text console via CTRL+ALT+F1 to avoid locking of files) and saved the list of installed packages with dpkg --get-selections. And the restore worked flawless. So backing up data and list of installed packages is really an alternative to have a backup that is not tied to the hardware in any way (but even using disk images portability is better than for Windows machines). Well - this is nothing new with 10.04 and you can do it since ages, but I never tried it before.
      In one case I had the chance of trying to setup the same use cases on two machines with identical hardware while one kept on Windows 7 and the other with Ubuntu 10.04. Result: With both machines the desired workflows could be implemented (home user with home office - email, internet, watching videos, print, scan, writing documents basically). Setting up was a little easier on Windows 7 because of the proprietary drivers needed (for the HP laptop) on Ubuntu as well as several restricted extras for playing mp3 and videos. The next time I will prepare a shell script for installing all that stuff at once (on FreshUbuntu podcast I heard, that such a thing already exists). That said, on Windows 7 a lot of applications need to be installed afterwards (like a serious zipping tool or image viewer) to make life easier. And not to forget, that the Windows 7 installation (to save the user from paying extra money) Open Office was installed instead of the Microsoft product and Firefox+Thunderbird - all extra Open Source downloads. Under Ubuntu most software installations are just selecting them in the package manager and clicking "Apply". There you get a huge amount of applications quickly without paying any extra dime. So both systems fit the needs of the user but Ubuntu clearly offers more options without the need of paying extra money. One of my favorite features is to start a GUI application on a remote machine but getting the GUI delivered to my local client through secure ssh connection or using FreeNX you can use this technique for your complete desktop and make a Terminal Server out of your Ubuntu/Linux box that way.

      As a critical conclusion I can say that there are still issues that make it difficult for an end-user to get quickly up-and-running by self-installing the Ubuntu Operating System. That does not mean that there are no hardware problems on Windows (indeed I had a printer last week where the software shipped with the printer was not Windows 7 compatible + not 64-bit compatible), but Vendors simply test their stuff first of all with Windows. However, if there is an issue, tweaking Ubuntu/Linux is usually simpler than on Windows (although there are different levels of tweaking - in the worst case you need to compile something on your own, which is not so difficult as you might think). When I have a problem with Windows then the analysis takes longer and there is a lot of trial-and-error involved (although I have more than 15 years of experience with Windows) - and of course less community help. My advise:
      • Check first before you buy hardware, if it is compatible with Linux (e.g. prefer Intel graphic cards for example) - do this even if you are not considering to switch to Linux yet - you might change your mind sooner than you think!

      • If you have people with Linux knowledge around that could assist you and if you are interested in being flexible, you should try Linux/Ubuntu.

      Related posts: Why Linux?, Going Linux, Ubuntu 10.04 with docking station part 1, Ubuntu 10.04 with docking station part 2, Ubuntu compatible hardware.

        2010-04-12

        Software on speed

        Yesterday I tested Ubuntu 10.04 Lucid Lynx beta 2. Within half less than an hour testing I found 4 bugs that I do not consider to be minor (and I filed them accordingly) - not talking about the design change putting window buttons to the left (which is considered as a bug by the community). All those 5 points I do consider making a bad impression on new users considering a switch over to Linux. By writing this they have only 17 days left to fix. This is a very few time left I would say.

        The twice-a-year release schedule has been discussed already lately at a number of places and I would also say that such a schedule is too short for comprehensive tests and high quality software development.

        Time-to-market is an important parameter in business and especially in software business where there is such a huge amount vendors and sites. Other than the supermarket around the corner with limited reach, software can easily distributed around the world - nowadays (it has not always been that way, think to times before internet has been available to the vast majority of people). So from the competition point of view software is a hard field.

        As it is widely accepted that software has bugs, vendors do not worry much about the bugs and do not give much on quality - that is my impression.

        Although none of the bugs I found can be considered as a real show-stopper, it could be so annoying for people that they don't use it (or stop using it). I have experienced a lot of bugs and bad implemented software that alltogether made a lot of software unusable for me considering the software usage from the economical point of view and thinking of optimizing productivity.

        Software is there to improve productivity and make things easier - it is not just for geeks playing around.

        That said, Linux (and Ubuntu in this case) is driven a lot by the community and it is given away for free, so one should not complain. But this post applies to a lot of other software products too.

        Anyway, quality should be an important priority in software development and from that point of view I understand the debian guys, where an eternity can pass until a new version is released. I one thing why I don't use a debian stable release is because they are so far behind in features or new software releases respectively.

        Maybe the optimum is somewhere in the middle...

        Related posts: New Year's IT resolutions, Going Linux.