Learning Java and Spring/Spring Boot
Introduction
I am about to start a new job where the main programming language is Java, a language I had not touched since my university days more than a decade ago. I am competent programmer in Python and Typescript with 4 years of professional experience. Those two languages are quite different than the static and strongly typed Java. Below are the resources I have used to learn Java as a non-beginner.
Resources
My resources for learning Java as a non-beginner programmer are in order of attempt:
- Tried Hyperskill but found that it was too basic, probably could be used as something like flash cards but I felt everything was too slow and a bit too disconnected for me.
- Core Java for the Impatient by Cay S.
Horstmann
- Read through most of the beginning chapters, rehashed core programming concepts. Stopped around chapter 6 Generic Programming and decided to start learning about the Spring framework before moving on the other concepts as it was getting a bit dry. Will come back to complete the book later including rereading the part about reflection.
- What is Spring Framework? An Unorthodox Guide - A high level guide to what the core spring framework is, dependency injection and why you might want to use it.
- Spring Starts Here by Laurentiu
Spilca
- More detailed beginner’s guide to the Spring framework, good explanations and examples
- I tried to reimplement one of my previous projects in Java Spring, but it was a bit slow and a bit of a slog. I decided based on time reasons that it would be best for me to follow a structured project tutorial.
- Spring in Action 6th edition by Craig
Walls
- A book that is a more detailed than the previous book, but has a single project that you work on as you go through the book. Have worked though most of the first half of the book and skimmed read parts and skipped the reactive programming chapter.
- Effective Java by Joshua Bloch by - haven’t read but have seen it recommended for developing better practices with Java
IDE
For Java I am learning to use IntelliJ IDEA Ultimate as it looks like the most powerful and popular IDE for Java. I am used to VSCode with vim keybindings. Luckily IntelliJ also has an extension for vim keybindings and also can set the keymap profile to VSCode.
Looks like no clear code formatter is defined for Java, but most popular one seems to the google-java-format which can be set it up with IntelliJ.
I have installed the plugin Key Promoter X to help me learn keyboard shortcuts for IntelliJ. It prompts me when I do an action that could have been a keyboard shortcut.
What I have learned
- The Spring framework is the most popular IoC container framework for Java
- But also has lots of other libraries that use the Spring framework
- Aspect Oriented Programming (AOP) - first time I have heard of this, but have definitely used it before in Python and Typescript, I have always used the term “decorator” for this
- Naming conventions for the spring framework, similar to nestjs, but not django
- Controller
- Service
- Proxy, for communication outside the codebase, e.g. http requests, emails, push notifications
- Repository
- Model
- Reactive programming is a paradigm that exists, but I will hold off learning unless the job calls for it (more important things to learn first) and it also looks like virtual threads might supplant it in new versions of Java anyway
- Multiple ways to persist data in Java, more typical are:
- JDBC - More raw, low level
- Spring Data JDBC, lightweight ORM, perfomant but less boilerplate than JDBC
- Spring Data JPA/Hibernate, heavyweight ORM like the Django ORM, lazy loading, relationships
Other things
- JOOQ - a SQL query builder for Java, looks kinda like Drizzle
- Marco Behler’s blog
- Baeldung
Conclusion
I think I have done a good enough primer on Java and Spring/Spring Boot. I will learn more once I start working with it, but I think I will focus my efforts more on Kafka and Kotlin for the time being. I plan to revisit my attempt to reimplement my previous project in Java and Spring Boot again when I have time.