Looking back at times when Java blew my mind
I was thinking earlier today about my experiences with Java (which I no longer consider to be “God’s own programming language” as I once did!) and I remembered three experiences throughout my career when my mind was blown when seeing a new aspect of Java. I record them here just to note that not all of the practices we follow now were always so obvious.
My very first Java project was a university project using Swing. I had a huge book (Swing in Action) which described all the available Swing components with examples of how they could be used. The mind-blowing moment was when I realised I could put a main method in each of my custom component classes and run them; I wasn’t restricted to a single entry-point for my application! It made the feedback loop quite quick and suited me well, even if it wouldn’t be a recommended pattern today.
My next experience was in my first real development job. I had created a few small Java projects here but the company weren’t really Java experts and I’d never used JUnit. Then I joined a project which had been started by a more senior Java developer. It had multiple source folders! Furthermore, the source folders contained the same packages! I don’t believe this had ever been suggested by The Java Tutorials, or even my favourite book, Effective Java. Obviously this unlocked unit testing, Maven module structure and made sense of package-private access.
Finally I remember, having previously written a SAX parser for a system, being introduced to JAXB. I had been given a task to parse an XML file into an object and I thought “OK I’ll need to write a parser again, this will take some time”. My colleague pointed me towards JAXB and with a few annotations (which were new at the time) and about 4 lines of code, it was done. Amazing!
From these experiences I developed my understanding of Java a great deal and continued applying this into other languages, but the great thing is that each language is different, with its own nuggets to discover. What were your breakthrough moments?