(Mirrored from my site)
Typescript adds static, compile-time type checking to the picture with a neatly engineered type system but it ultimately has no effect during run-time (apart from juggling with source maps).
I think that if as a developer you specialize in one or two languages, it’s still important to learn other languages , too, to widen your views and better understand general programming principles.
I believe general understanding turns you into a better engineer even if you don’t have a CS degree , plus it helps you pick up other tools of the trade (languages, frameworks) easier during your career.
During the Programming Languages A-B-C MOOC, I also tried several other languages with different flavors:
Standard ML has nice type checking, type pattern matching and a cool functional approach.
Racket is a dynamically typed, functional LISP-like language, which looks like a total mess but once you learn how to twist your brain inside out, it starts to make sense. Nevertheless code written in languages like this looks like a pain to reason about and maintain. (Hopefully I’m wrong here!)
And there was Ruby in part C of this course, as an example of a dynamically typed but extremely object-oriented language. At least Ruby is still widely used, thanks to modern frameworks like Ruby on Rails.
After all these, I ventured into Python – learning it was a very pleasant experience, as simple as reading the official tutorial and printing a cheat sheet.
That’s a lot of languages, some more exotic, some more widespread, but where’s Java?!
Java is statically typed with a robust type system, extremely popular and widespread, used everywhere in backend and desktop apps, and also frequently being picked up by newbies as a first programming language.
It’s stable, runs on a lot of devices thanks to the JVM system and it’s still being actively developed and improved with new versions nearly each year. It’s also comparably fast.
If you search for ‘Java tutorial’ on the internet, you’ll find countless sites, videos, plus of course the official documentation. I tried this approach, diving straight into coding after some minimal documentation browsing.
It worked so nice for Python and JS, why not?
I was so wrong… I couldn’t even make a proper Array… what is the difference between
ArrayList<Integer>? Why so many Array and Map, Set etc. implementations? Where is my
And more importantly, how can I think and reason properly in an object-oriented way, to create scalable and maintainable code?
Oh, heavens. The takeaway was that Java as a language is not nearly as beginner-friendly as, say, Python. Maybe if I were just doing some Spring tutorial then it would have worked better, but I wanted to understand the basics of the language enough to implement a simple algorithm like a binary search or a quicksort.
Most ‘Java tutorials’ on the web were essentially beefed up versions of the ‘official’ Oracle documentation. Don’t get me wrong, there’s a ton of material out there promising you to teach all the basics.
After looking around on /r/java, I found a highly recommended online course by the University of Helsinki. Here are the links to access Part I and Part II. Each are supposed to be 6 weeks long and use an excellent NetBeans plugin called TMC (TestMyCode) to upload exercises.
And jeesh, there are a lot of exercises in the course! I highly recommend it for beginners, although they get pretty repetitive if you are a more experienced developer. Nevertheless, it pays to stay humble and go through most of them since they address lots of pain points of the Java language and offer a frustration-free way to go through these hoops.
Doing several ‘books in containers in a library’ and ‘animals in farms’ types of exercises also helps you get the basics of thinking in and object-oriented fashion. The exercises are designed in a way so that you’ll naturally follow rules such as the single responsibility principle.
Most tie your hand and you’ll just have to implement a class following some specification, but at the end of each week you’ll have the chance to write more complex programs in any way you wish – the excellent testing algorithms of the TMC plugin will make sure to test each corner case.
(Edit: the bundled NetBeans offered on the mooc.fi website is a bit outdated, you can use the TMC plugin with the latest NetBeans by following the instructions described here.)
The course, having been launched in 2013 is a bit outdated. Java 8 is not even enabled when you upload so you won’t be able to use streams for example. Exactly because of this, the authors are creating an updated version – currently only available in Finnish.
(Edit: the English version of the updated course is scheduled for Q1 2020. I’ll definitely take a look at it once it’s updated! In the meantime you can try the original one or use Google Translate!
Also I only skimmed the last two weeks – fortunately I won’t need to build UIs in Swing in the foreseeable future.
So yes, the Java you would use today in practice looks a bit different from the one you use in this course. Nearly zero
for cycles, a bit more annotations and less boilerplate of course. But after doing the course, you’ll be knowledgeable enough to easily look up the missing stuff and any kind of API in essence.
The mooc.fi course is of very high quality, with carefully built exercises and the unbeatable price of free, with zero ads – something that’s pretty valuable by itself in the modern web. Heck, the whole material is Creative Commons licensed.
I’ll definitely keep on learning Java. Now that I’m confident with language basics (not messing up basic data structures), I’ll be more than happy to take more backend tickets at work.
Also I’ll keep on learning about new Java features: streams, lambdas, futures, plus widely-used tools such as JUnit, Mockito or Lombok. Learning the basics of Spring is a must (I’d like to study multiple full-stack frameworks in 2020).
All in all, it’s almost impossible to walk past Java in today’s programming world. Even if I find the language a bit too verbose for my taste, learning a bit about it was an important experience. Learning some OOP basics is also nice, plus it opens the door to other similar languages such as C#.
Another tool in the toolbox to solve more problems in new and more efficient ways.
Update 2020 May: I made some more progress, now fixing some basic bugs and whatever in production code. This guide on streams turned out to be really useful! Now I'm learning some Spring framework basics on Pluralsight.