How I switched from Java to JavaScript

A year ago, I was using Java for everything. Although I had previously used languages such as C/C++, Haskell, JavaScript, Pascal, and PHP for several school, hobby, and contract projects, I was not really good at any single one of them. At that time, the only language I felt pretty confident writing code in was Java. I had already been using this language for almost five years and knew both the ecosystem and the language quite well so it seemed like a good idea to dive deeper into it and become an expert in this area. But then something changed.

I graduated university and realized that although working for a corporation during my studies was a good experience as well as an easy source of moderate income, it was not something I would like to do in the near future. At the same time, I was asked to join a team forming a new company as a co-founder and technical lead and since I had always wanted to start my own company I could not have said no to that offer.

They had already been developing Lumeer, a modern data definition and processing platform, for a few months when I joined the team. The back-end of this application was written purely in Java so I was able to start contributing almost immediately. However, the application was intended to be used by non-technical end-users which meant that the vast majority of the work would need to be done on the front-end side. A simple user interface based on the latest version of Angular was already being developed. Since I was supposed to be the technical lead responsible for the whole development process but did not have much experience with front-end, I knew I had to become pretty good at it in order to do my job well.

As I was quite familiar with the Java ecosystem, I could remember what huge amount of technical problems I had already solved in this area and was still far from being an expert. When I though of going through similar problems in the JavaScript world once again and imagined how much time it would take just to get to the point where I was with Java at that moment, I was a little bit worried if that was the best investment of my time. But I said to myself if a lawyer was able to become a front-end developer, I could do it as well and it would probably be a lot easier for me since I had already been familiar with many principles which can be reused across different programming languages.

So I started reading a lot. I somehow found JavaScript Weekly, a weekly digest of the JavaScript news and articles, which was and still is for me a great way how to keep up to date with all the changes in the JavaScript ecosystem. I was always looking forward to the next week so I would be able to further broaden my knowledge of this whole new world. I read many articles about the language and new useful JavaScript libraries. At the same time, I started reading Angular documentation and took a course at Udemy in order to develop better understanding of the framework we were using. However, I think the best investment of my time was reading two great books, Speaking JavaScript and Exploring ES6, which are available online for free and go really into the depth on various language features. Had I not read them, I would have probably wasted a lot of time debugging problems caused by unexpected language behavior.

Fast forward nine months and (luckily I am not a father but) I feel quite confident with my JavaScript skills so much that I can even fix a bug in a popular library. Last year, I read much more about the JavaScript ecosystem than I had ever read about Java and related technologies before. Although I am still learning and dealing with new problems, I can say that the worst part is over and there is a bright future ahead of me. But more on that next time.

Installing Java 8 on Raspberry Pi 3

Just recently, I’ve got a new Raspberry Pi 3 Model B and started experimenting with it. I’ve installed the latest Raspbian (Jessie Lite) on it because it’s the officially supported operating system and more importantly, it works out-of-the-box.

I was thinking of writing some applications for it so I decided to install Java since it’s the programming language I’m most familiar with.

There are basically two options available for Raspbian — you can either use OpenJDK or Oracle JDK. There are some limitations of OpenJDK for ARM systems which make it slower so I’ve decided to stick with Oracle JDK.

You can install oracle-java8-jdk package from the official Raspbian repositories but it only provides an old version of Java (8u65). If you want to use the latest version, you need to download the JDK directly from the Oracle’s website. Since Raspberry Pi is powered by ARM processor and Raspbian is a 32-bit OS, choose the Linux ARM 32 Hard Float ABI version.

When you download the right package, unpack it into /usr/java directory:

sudo mkdir /usr/java
cd /usr/java
sudo tar xf ~/jdk-8u111-linux-arm32-vfp-hflt.tar.gz

You can then create symbolic links in /usr/bin folder (so you’ll be able to use java command anywhere) by adding the following alternatives:

sudo update-alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_111/bin/java 1000

sudo update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_111/bin/javac 1000

At this point, you should be able to verify that your Java installation works by running the following command:

java -version

It should print something like this:

java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) Client VM (build 25.111-b14, mixed mode)

If you see similar output, you have successfully installed Java 8 on Raspberry Pi.