New developers: “How do I know what to learn and when I’ve learned ‘enough’ ?”

A question frequently asked by new developers is what to learn, how much to learn, and how do you know when you’ve learned enough?

Learn what you need to solve the current problem and then repeat for the next problem.

Don’t think about his as a finite set of knowledge that you need to learn and then that’s it, that’s the end. That’s not how it works. There’s always something new to learn, and there’s always something you’ll find that you don’t know.

Adjust your mindset to keep this in mind and you’ll be ok.

My last 4 phones over the past 13 years (all still work)

For some reason I though I’d sold some of my last phones on ebay, but after clearing out some shelves and cupboards in our house, I’ve found my last 3 phones before my current phone, and they all still work fine. It’s interesting how large current phones are now compared to phones from over 10 years ago – we definitely had a period of phones getting smaller, and now we’re carrying around tablets in our pockets.

Here’s the oldest to last phone I replaced:

From left to right:

  • T-Mobile myTouch4g – this is from roughly 2010. I had it for a few years then reached that stage when it started to slow down so installed a custom Android ROM, Lineage. This always seems to be my sign where I need to upgrade, when I start messing with custom ROMs. Pretty sure I used this phone for at least 3 years. Given it’s small size, it’s noticeably heavy in the hand, maybe because of the solid metal back plate.
  • Samsung S3 – used this phone for 5 years, and only upgraded because the battery started to only just last for a whole day before needing a recharge. Still, 5 years for continual daily use is pretty good innings. I would have used it for longer if it wasn’t for the battery life decreasing
  • Samsung S8+ – probably my favorite phone so far. Even though I recently upgraded to an S21 ultra, I used this phone at home as a music player while working from home (before most recently getting replaced by an iPad)

As a comparison in size to my current S21 Ultra, here’s the myTouch and S3 to the left, S21 Ultra on the right:

It’s interesting seeing the increase in size. My S21 feels completely normal at this point, but the myTouch4g is small enough to fit within my hand.

JEP445 Instance main() methods coming for Java 21 LTS

Java 21 is only a few weeks away from release. One of the changes that I think is the most interesting and I’m surprised that it’s taken this long to be included is JEP445 “Unnamed Classes and Instance main methods”. The goals of this JEP explain precisely the benefit of this change:

“Offer a smooth on-ramp to Java so that educators can introduce programming concepts in a gradual manner.”

“Reduce the ceremony of writing simple programs such as scripts and command-line utilities.”

“Instance main methods” refers to a change to the language requirement that the single entry point to a Java application is the main() method with this exact signature:

public void main(String[] args) {
    ...
}

…which is a lot to unpack to understand how to get started even with the most basic “Hello World” app. To explain this signature to brand new developers learning Java, I usually see the required main signature explained away with “ignore why we need this for now, just accept that you need to define the main method exactly like this for it to work” which doesn’t exactly give much comfort.

JEP445 Instance main methods allows support for much simpler main methods without the required scope, return type and params:

void main() {
...
}

To make it even easier, since this new support now allows you to use an instance method instead of the previously required Class method (static), you can call other instance methods without instantiating the class, and without understanding why you can’t call instance methods from a static method. Prevously you need to instantiate your Class first, before calling instance methods like this:

public class PreJava21App {
    public String getGreeting() {
        return "Hello World!";
    }

    public static void main(String[] args) {
        System.out.println(new PreJava21App().getGreeting());
    }
}

With JEP445 now you can code a simpler main() like this:

public class Java21App {
    public String getGreeting() {
        return "Hello World from Java 21!";
    }

    void main(){
    	System.out.println(getGreeting());
    }
}

The next change on this JEP with Java 21 introduces Unnamed Classes, so now even the Class declaration can be implicit, like this:

    public String getGreeting() {
        return "Hello World from Java 21 with implicit Classes!";
    }

    void main(){
    	System.out.println(getGreeting());
    }

Under the covers there’s still a Class, it’s implicitly named the same as the filename, so if you save the above in a file classed Java21App, then you’d run it with ‘java Java21App’.

To enable these features currently (as of OpenJDK build 21-ea+28), you need to pass the ‘–enable-preview’ param. To pass this with gradle, add the following to your build.gradle:

//pass required JVM param for compile time
tasks.withType(JavaCompile) {
    options.compilerArgs += "--enable-preview"
}

//pass required JVM param for runtime
tasks.withType(JavaExec) {
    jvmArgs += '--enable-preview'
}

Programming Languages are tools. Learning a tool doesn’t make you a developer – more analogies

In Reddit programming subreddits there are never ending questions about how to learn a programming language to get rich, or how to learn language XYZ because ‘I need to get a job next month’. If the people posting these questions did only a few minutes of research by reading previous similar questions (you don’t have to scroll back too far before you’ll find another similar question) they’d realize how unrealistic their expectations are.

Learning a programming language doesn’t make you a developer. The analogy I like to use to answer these questions is that learning to use a hammer by itself does not mean you can build a timber framed house. I summarized this before in this post:

I have another analogy that maybe is more relatable given that some people are attracted to the Gold Rush of software development. Doctors make a lot of money. If you learn how to slice open someone’s chest to do open heart surgery then you’ll be able to get a job as a surgeon right? If course not, that’s not how it works. Similarly, learning a programming language by itself will not help you get a job as a software developer.