Java mentorship materials

This post is meant to gather some (mostly free) learning materials that I use as a Java mentor. The list will likely get continuously updated.

Knowledge of English is an invaluable asset for someone that wants to become a software engineer since it gives access to so many resources.

This goes without saying, but when you learn something related to software engineering, you don’t just read programming books or technical articles like novels or social media posts. You have to work through those materials by at least running all code examples on your machine. Often you also need to play with those examples by slightly modifying them to make sure you deeply understand the described ideas. In practice this means that you typically spend hours or days “reading” a 3-page article. There’s an excellent post by Brian Knapp that reiterates the above (don’t be discouraged by the word “Python” in its title).

One may ask what “deep understanding” is. It obviously depends on the subject but my personal rule of thumb is that I don’t fully understand something if I cannot do it in command line.

General

Core Java

Web Java

Spring Framework

People starting to learn Spring Framework may be overwhelmed by its sheer size and certain amount of magic. This is even more true for Spring Boot which gives you so much out of the box.

But it may do more harm than good to a newbie, especially if they are also new to Java. Hence, I’m all for a more gradual approach where people start from the very beginning. And by “very beginning” I mean the good-old XML descriptor.

Below I rely on demo-loganalyzer based on a learning project created by Viktor Kurchenko for ZoolaAcademy. It is a simple application that reads a log and analyzes it by filtering lines.

Many tutorials below are taken from CodeJava by Nam Ha Minh.

Spring Core (XML)

Practice:

  • Introduce an XML descriptor in demo-loganalyzer. At this point there is a bunch of classes that contain all the necessary logic, but they are not wired together. Fix that by defining beans (reader, printer, analyzer, etc.) in the XML descriptor. Read the descriptor in LoganalyzerApplication.main: fetch a bean of type LogAnalyzer and call startAnalysis to do the job
  • Implement another kind of reader, LogFileReader that reads content from an actual file. Change the app to use the new reader instead of StubReader without removing the latter (by only updating the XML descriptor)
  • (Bonus, not directly related to Spring Framework) Make sure that LogFileReader also works with files that have non-latin names

Spring Core (Java Config)

Practice:

  • Use @Configuration/@Bean in demo-loganalyzer instead of the XML descriptor. Learn how to switch between StubReader and LogFileReader

Spring MVC

  • 📋 Understanding Spring MVC introduces Front Controller and MVC, the two design patterns that Spring MVC architecture is based upon. It builds a firm bridge between Java Servlets and Spring. A bit long and involved but definitely worthwhile

Practice:

  • Introduce a controller in demo-loganalyzer that invokes LogAnalyzer and prints the output to an HTML page rather than to the console.
    • Here you might need to go back to using XML descriptors instead of annotations for seamless integration. Or maybe not, if you figure out how WebApplicationInitializer works

Spring Boot

Practice:

  • Convert demo-loganalyzer to Spring Boot. Hints:
    • Generate a new Spring Web Gradle project at https://start.spring.io/. Save it, you’ll use it as a template
    • Take a careful look at build.gradle from the template and introduce the necessary dependencies in your own build script
    • In the template look at the class annotated with @SpringBootApplication and create a similar one in log analyzer. Try to understand how to “instantiate” the context and get to your business-logic-related beans like reader, logAnalyzer and so on. Most likely, you’ll need to get rid of XML descriptors again. But no @Component, instead stick to the familiar @Configuration
    • Play around with embedded Tomcat, see if you need to define any MVC-related beans like viewResolver, controller, handler mapping and so on
    • Define your controller as @Controller for easy endpoint mapping
    • Define reader.type into application.properties to instantiate a proper Reader

AWS S3

AWS S3 is a widely-used cloud storage solution. The idea behind this service is quite simple: basically it’s an unlimited cloud drive. Hence, it’s an excellent starting point even if you want to learn about other AWS services, because AWS SDK for Java works similarly for most (if not all) of them.

Practice:

  • Implement S3Reader in demo-loganalyzer that reads an existing object in an existing bucket

Linux and Bash

Getting comfortable with Linux and Bash is a very good investment for any developer (just like touch-typing). You probably can get by without it, but it’s a huge productivity boost if you know your way around the command line.

The below books are a bit dated, but still very relevant:

In Ukrainian (Українською)

comments powered by Disqus