7 ms·
Does anyone know a good starting point for learning not just Java, but how to install everything I need? I consider myself the Neo of OOP and a master devops, b
by jafaku 12y ago
Does anyone know a good starting point for learning not just Java, but how to install everything I need? I consider myself the Neo of OOP and a master devops, but every time I tried to use Java I hit a wall of unreadable manuals/guides , software impossible to install/maintain, and mixed opinions among Java devs. Like it can't be used without a dedicated sysadmin.
- mike_hearn 12y agoWell. What do you need? For me I've found I only need a few things to get started. One is the JDK, obviously. Another is Maven. It downloads dependencies for you and is pretty standard (there's also Gradle which some projects use). Finally there is IntelliJ for development. That's about it. Pretty much everything else can be downloaded and installed automatically be Maven or your IDE. For web development, I've found Ninja Framework to be quite nice. The documentation is very good. The biggest problem is that it tends to delegate to lots of other libraries for functionality, and often those libraries have been around a long time and in some semi-standardised state that can be horrifically confusing (e.g. Hibernate). The Java world REALLY likes to take good open source libraries and then copy their interfaces into standards that other products can then implement. This sounds great in theory, and I'm sure some people do benefit from that, but it makes learning this stuff a giant PITA because the documentation for everything always has five versions, four implementations and every annotation or API has two identical versions in different namespaces, only one of which will actually work. Argghhhhh. However if you do make it past this swamp, then the tools themselves are actually rather powerful and performant.
- allengeorge 12y agoThat...sounds surprising. Basically you need: 1. An IDE (I highly recommend IntelliJ IDEA) 2. A build and dependency management tool (I prefer Gradle, but Maven is a reasonable choice - though way more verbose) Beyond that point, a lot depends on what you want to do. Some of my preferences (YMMV): * logging: slf4j over logback * json serialization/deserialization: jackson * db access (if you don't need or want ORM): jdbi * db migrations: flyway * REST services: jersey * networking: netty * embeddable http server: jersey * http client: apache-commons http client * metrics: codahale's metrics If you're building a backend webservice I highly recommend looking at Dropwizard, which handles a lot of the boiler plate for you.
- paulddraper 12y agoGreat suggestions. Do you have a web framework suggestion, e.g. something with templating? I like Play, but that's 'cause I use Scala. It has a Java version, but IDK how good it is.
- allengeorge 12y agoI've heard mixed things about Play's Java version. YMMV, but the last I heard it was a "second-class citizen". Unfortunately I don't work with any templating myself, but I note that Dropwizard supports both Mustache and Freemarker. Would those work for you?
- allengeorge 12y agoOoops. For embeddable http server I meant jetty.
- jazzyk 12y agoThere is also Spring Boot, which is very similar to Dropwizard. Both wonderful frameworks.
- squar1sm 12y agoGreat list. I wish this list and ones like it had a name other than "modern java" to distinguish tools/projects/people/interest/books. Because it's hard to name something that's a synonym for "new". Eventually "more modern java" is needed. And then "most modern".
- twic 12y agoYou need a compiler and an editor. That's it. Your package manager will get you the compiler (probably as part of a package for the whole JDK). You can use whatever editor you already like. It'll help if it has some support for Java's syntax, like highlighting or whatever. If you want to add one non-essential tool, it should probably be a build tool that knows how to download libraries and compile your code against them. Gradle is the only sensible choice right now - it's far from perfect, but it should be tolerable. Again, your package manager will probably have Gradle. You only need it on the development (and CI) machine, not on the target. At some point, you should probably give an IDE a go, to see how useful automatic refactoring is. Eclipse and IntelliJ are both free and pretty good (IntelliJ has free and paid versions, but the free version has everything you'll need to begin with). People love to argue over which is better, but the truth is that there's not a massive gap between them. Any IDE takes some getting used to, so it's probably better to start with a straightforward editor rather than an IDE. If you want to use IntelliJ on the Mac, you might need to edit its Info.plist file to allow it to use a current version of Java. For some reason it's pinned to 1.6 by default. Gets me every time. I can't think of anything you need to do to use Java that is remotely sysadminish, unless you count installing packages. It's been years since i've read a Java book. Back when i did, by far the best was Just Java. Thinking In Java was also great. However, those were last revised 10 and 8 years ago respectively, so possibly not worth picking up today. They certainly won't tell you anything about the rather crucial new stuff in Java 8.
- lmm 12y agoMy opinionated viewpoint, if you want to learn this stuff for a job: Install eclipse. Get a non-JavaEE version - probably "eclipse for java developers". It's flaky software and you will have to babysit it sometimes, but it's still the best choice. Use maven, then you don't need a sysadmin to maintain your libraries. You just add libraries as dependencies (you can even use a search wizard in Eclipse) and it Just Works. Start by using the new maven project wizard; I would skip archetype selection entirely, but if you want to use a particular framework you can choose one of those and get a "hello world". Add libraries one at a time. If you're writing a web application I love Wicket which is literally the best-designed library ever. Aside from that you're facing things that, like eclipse, are a bit clunky; sooner or later you will have to learn Spring and Hibernate. Everyone loves to hate them and with good reason, but people will expect you to know them, and they do have good parts. Try to do as much as possible in pure java. Use embedded jetty and write a normal application rather than messing with war packaging. Use annotation-based Spring configuration rather than XML, and the same for Hibernate. The whole ecosystem is old and crufty. You will have to get used to random crappy workarounds for all sorts of problems, and you will probably have to cargo-cult some things to get stuff working. This is unfortunate, but I guess it's the price of stability. There are good sides to the ecosystem too. Sorry to be such a downer.
- paulddraper 12y agoI'm confused. Is there something else in another language with better solutions for IDE, dependency management, dependency injection, etc.? Honestly, you just listed some of the best reasons to use Java.
- lmm 12y ago> I'm confused. Is there something else in another language with better solutions for IDE, dependency management, dependency injection, etc.? Other languages are less dependent on a heavy IDE; I can write Python or even Scala in vim (+ repl in another tab) reasonably comfortably, and while vim has its warts it's a lot less fragile than eclipse. Spring is IMO not worth the complexity compared to explicitly constructing things, but if you really want to do that there are ways to do it in Scala (e.g. just using implicits, reader monad) that don't require annotations or XML and don't have anything like the number of quirks (e.g. autoproxying, about 10 magic lifecycle methods, configuration-dependent behaviour on duplicate beans) that Spring does. Likewise Hibernate is nice but it has some irritating misbehaviour (e.g. passing empty lists can cause it to make SQL syntax errors) that isn't present in ActiveRecord or even modern JVM alternatives. I didn't expect my comment to be so negative when I started writing it, but as I started to try and explain the basics I realized how many arbitrary workarounds a very basic Java app needs. A lot of this is 10 years of accumulated cruft rather than fundamental problems, but at the sharp end new users still have to deal with it.