Diving into Java for the first time

01/10/2017

I decided to branch out my knowledge and dive into learning another programming language. My background so far is C#/.NET, which was built upon Java's strengths and weaknesses. So I thought Java should be an easy language to learn from my experience with C#. It took me about 2 hours to get a simple in-memory CRUD API application up and running.

Before I could start writing code I know I would need a few items installed. I chose IntelliJ as my IDE, installed Tomcat for a server, the Java SDK, and Maven, a build tool.

I then started researching what frameworks were in the Java ecosystem. I thought there must be projects out there to simplify Dependency Injection, web request routing, authentication; just as there are in the .NET world.

I came across Spring, who have a large array of projects to help the developer get up and running. One of these projects is Spring Boot, which takes an opinionated view of how to build applications. As I am very green to Java, I didn't mind some opinions thrown at me right now.

Most of my time was spent navigating around the IntelliJ IDE, rather than writing code. Which is a good thing! I found the configuration by convention, which Spring Boot uses, a very understandable way to work out what the code was doing.

So here is is, my very basic Spring Boot CRUD application.

https://github.com/wjonesy/SpringBoot101

It isn't quite CRUD, it only reads and deletes.

My next steps is to understand if the way dependency injection is being used is the norm in the Java world. It doesn't feel like I can flip implementations of interfaces easily. At the moment it uses the @Qualifier syntax to chose an implementation. If this interface was used in many places, and I wanted to change the implementation, there would be a lot of code edits involved. So I will research what IoC Containers exist.

I also want to see how to implement the following:

  • Role based authentication
  • 'Containerise' the application, E.G. Docker Overall the new project experience was not a polished as Visual Studio's Create New Project dialog, you get a working website within 4 or 5 mouse clicks. But there is certainly enough documentation out there to get someone started.