How should I learn Java Web Development?
Java is much heavier weight [1] than languages like PHP and Python, and that’s not at all a bad thing - it just changes what the language is used for [2] and what’s normal within it. As such the threshold for overengineering is significantly higher than in most other languages. Dependency injection for example is something that in the small looks like needless complexity but when used well [3] makes things that would be realistically impossible without it easy and routine.<p>Java is a very dumb language, and that’s also not at all a bad thing. What we get from this dumbness is best-in-class tooling. I don&#x27;t think I have to say it but pick one of the 3 major IDE’s: IntelliJ, Eclipse, or NetBeans. If you have no preference IJ tends to be the modern (and my) favorite. I frankly switched from years of emacs to PyCharm for even my dynalang stuff due to the quality. Java lacks [4][5] many of the powerful and dynamic features of other languages like eval, code execution during class definition, the ability to flat lie to the type checker, et cetera. In return we have an ecosystem of tools that can nearly perfectly understand the intent of code statically - things beyond simple templated code generation like &#x27;go to definition’ and &#x27;find all references’ work so well that automatic refactoring can usually be done fearlessly. The downside of this is that I’ve yet to see a code review system that can gracefully handle the giant diffs these tend to create, but the end result has a vastly higher chance of success than for more expressive languages, and it’s better than the alternative of accumulating technical debt (and hey, nothing’s perfect :). Similarly get used to using the debugger. You basically never have to resort to &#x27;printf debugging’ in Java due to the high quality tooling. To learn a codebase set breakpoints and poke around.<p>To your 80%&#x2F;20% question: in my opinion Java’s killer feature is its unbeaten ease at handling vast codebases, which unfortunately presents a barrier to short-term entry. I think I’d say look for a Java-only library that interests you and put a web interface on it. Due in part to Hadoop there are lots of Java-only (or effectively so as a result of shoddy ports) systems that deserve an HTTP wrapper so other languages can access them (a colleague of mine wrote one for Kafka a while back as an example, and frankly things like Elasticsearch and Solr are basically this for Lucene). This will get you into exploring and getting familiar with not only the library you wrap but the webserver (like Jetty) or framework you choose. Due to its tooling I find learning large Java codebases easier than those of any other language [6] and as above to me that’s what Java is &#x27;for’.<p>[1] HotSpot more or less expects to be able to use all of its host’s cores, which somewhat clashes with modern container-centric ecosystem. Containers have always meant less to Java though as it’s had things like jar shading, internal access control, and classloader isolation for many years. OSGi for example has been capable of similar multitenancy through these features. That&#x27;s not to say docker isn&#x27;t still remarkably useful to Java development, it just tends to be less ‘amazing’ in the context.<p>[2] The amount time it takes to build a simple CRUD site will likely be higher than in, say, Rails (although it’s getting better all the time), but many of the things a growing site winds up talking to (Elasticsearch, Cassandra, ZooKeeper, et cetera) are implemented in Java. Different tools and all that. I’m not discouraging its use for even smaller projects but it does tend to be more of an up-front investment than a lighter language all else equal.<p>[3] As a Guice fan I recommend checking out the Presto codebase ( <a href="https:&#x2F;&#x2F;github.com&#x2F;prestodb&#x2F;presto" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;prestodb&#x2F;presto</a> ) - lovely and extensive (perhaps a tad too much :) use of Guice, and extraordinarily high quality codebase in general. I’ve never used much of Spring[Boot] myself but as with Java in general many of the criticisms aimed at it are many years out of date and irrelevant.<p>[4] All of these things are ~possible~, just (as usual :) more involved and verbose than in many other languages, and more importantly extremely non-idiomatic (or at least considered &#x27;big guns’). As an example in lieu of eval many systems leverage runtime bytecode generation to do things like building object proxies and computation pipelines at boot or on user input. HotSpot dutifully jits, optimizes, profiles, and inlines this with &#x27;normal’ code resulting in usually impressive performance, but it also involves jumping through a lot of hoops to make it work right as the vm spec mandates fairly strict requirements.<p>[5] Notable though is Java’s extensive use of annotations - they’re used to communicate to both tools and people (though primarily the former), and you can stick them nearly anywhere. Annotations themselves do absolutely nothing - they exist purely as introspectable markers (not to be confused with similar looking Python decorators). Tools like serialization libraries, web frameworks, dependency injection systems, and thread safety analyzers scan for these and do things with them as they please. A lot tends to happen at boot and during warmup in Java systems both in the app code and in the vm, and much of it is powered by these otherwise-do-nothing purely-for-reflection annotations.<p>[6] The only other equal to me is C#, which is basically Microsoft Java. There are numerous differences (mostly more advanced static language features at the expense of a dumber runtime - .NET has F# but Java has Nashorn and Graal) but they share the spirit of dumb but extremely toolable &#x27;heavy’ languages. I haven&#x27;t touched Mono in quite a while though so I can’t comment on its modern usability.