8 ms·
Ask YC: Best book for Java
I am working on a project that the client wants in Java, specifically using Struts. Any recommendations on a good book for learning Java for an existing programmer? time as always is a scarce quantity.
EDIT: Web Programming in Java
- coglethorpe 18y agoI'm developing a webapp in Java/Struts for a client now and have found the internet (a variety of sites, via search engines) to be my best resource. I don't think I've used a book in years now. Here's a few I've run across: http://www.theserverside.com/ http://www.theserverside.com/ http://www.developer.com/ http://www.developer.com/ http://www.javaworld.com/ http://www.javaworld.com/ There's a ton more. And the sources, of course: http://struts.apache.org/ http://struts.apache.org/ http://java.sun.com/ http://java.sun.com/ I use MyEclipse to develop and it's pretty helpful and has Struts support: http://www.myeclipseide.com/ http://www.myeclipseide.com/
- delano 18y agoThis also: http://www.infoq.com/books/starting-struts2 http://www.infoq.com/books/starting-struts2
- Tichy 18y agoI started with the Java tutorial. Back then I really liked it. Not sure if it is still as good (feature creep), but might be worth a look.
- huhtenberg 18y agoGo over "How to Win Friends and Influence People" by Dale Carnegie and then convince them to stay away from Java. You will benefit not only yourself, but the humanity as whole :)
- dgabriel 18y agoReplies like this are incredibly unhelpful. I suppose google uses Java because it's such a destructive force. I recommend starting here - http://en.wikibooks.org/wiki/Java_Programming/Struts http://en.wikibooks.org/wiki/Java_Programming/Struts
- gaika 18y agoGoogle has different cost structure, most companies pay a lot more for programmers' time than they would pay for hosting an app. Developing in web frameworks like rails and django is 5-10x more effective and is totally worth time switching. Also you can host rails app on java app servers today with jruby.
- ucdaz 18y agoCan't agree more with huhtenberg. Where have you been? Java is SO 20th century for web development!
- richesh 18y agoI'm assuming you are looking for Struts 2, if this is the case there are only few good books out there. I own all these books below and they are useful, but they are not as updated as the latest release. My suggestion to you is to keep an eye on the struts 2 wiki and join the mailing list to get the latest information. 1. Practical Apache Struts 2 Web 2.0 Projects (Practical Projects) by Ian Roughley - http://www.amazon.com/Practical-Apache-Struts-Web-Projects/dp/1590599039/ http://www.amazon.com/Practical-Apache-Struts-Web-Projects/d... 2. Starting Struts 2 by Ian Roughley - http://www.amazon.com/Starting-Struts-2-Ian-Roughley/dp/1430320338/ http://www.amazon.com/Starting-Struts-2-Ian-Roughley/dp/1430... 3. Struts 2 in Action (In Action) by Don Brown, Chad Davis, and Scott Stanlick - http://www.amazon.com/Struts-2-Action-Don-Brown/dp/193398807X http://www.amazon.com/Struts-2-Action-Don-Brown/dp/193398807...
- rcoder 18y agoIf you haven't done web development with Java/Struts before, you actually may want to reconsider whether taking this project on with a tight deadline is in your best interest. The tool ecosystem is very different for the Java web developer, and I'm afraid you may find yourself spending more time reading API docs and puzzling through XML configuration files than actually writing code. If the client wants Java/Struts code for a good reason (like they have in-house programmers who can maintain Java webapps) your first Java project may not be up to the standards they expect. If they want it for a bad reason (say, because the CIO read about it in an in-flight magazine) then you should be able to push back on the decision and choose a framework with which you're more comfortable.
- delano 18y agoYou will be able to pull it off if you learn well under pressure. Java is consistent so it's easy to learn the basics quickly. There are some things that are good to know upfront, like j2d2's comments. I'll also add: 6) It's easy to be verbose in Java and verbosity can quickly tie you into a certain design. Either plan for more learning/design time early or spend that time learning Eclipse (fwiw, I personally don't enjoy using Eclipse, but many people do and it does make refactoring a lot easier). 7) Choosing between similar datatypes can have unexpected impacts. This is re-wording of j2d2's #3. See also: http://www.google.com/search?q=java+vector+vs+arraylist http://www.google.com/search?q=java+vector+vs+arraylist re: Struts 2 specifically, I like it. It's a reasonable and well-designed Java framework. I've used WebWork (which became the codebase for Struts 2) and Struts 2 for several successful projects. (Success in terms of delivering on time and the hand-off to internal developers).
- rcoder 18y agoLearning the basics of the Java language is indeed pretty easy. The syntax is fairly consistent (assuming you ignore generics and annotations to start with) and the core class libraries are useful (if a bit eclectic). Regardless, the original poster didn't ask about learning "Hello, World!" He asked about ways to learn both the Java language and the Struts stack on a tight schedule in order to deliver a project to a paying client. That's a tall order, and one I don't think most people can pull off without expert mentoring. There's just too much material to absorb, and having so many unknowns going in to a project will make cost estimation very difficult indeed. The original poster might be able to reasonably offer a discounted billing rate and/or more relaxed delivery schedule in order to manage expectations, but I personally haven't encountered many people doing hired-gun J2EE consulting on the cheap.
- albertcardona 18y agoPlease save yourself from the limitations in java syntax and use clojure/jython/scala. Clojure is my favorite -native java speed but lisp syntax, and awesome lock-free multithreading. What your client really wants is the JVM and its libraries, not java the language.
- jm4 18y agoWhile slightly off topic, albertcardona may have a point here. This deserves some clarification. It may be that they specifically need Java if they're going to have some in house programmers maintain the application later, but if all they're really interested in is the JVM then you've got some options you may want to consider. I don't want to stray too far here, but one thing I've noticed about many Java people is that they have very narrow views of what's good. (Don't flame me. I'm a Java developer myself.) Maybe they're just playing it safe. It seems to be a common theme with Java. Basically, for several years now the prevailing attitude has been that Struts is the only game in town, but there is a world of other good options for the JVM. Anyway, back on topic... If you must go the Struts route do yourself a favor and use Struts 2. It's been a little while since I've been in the Java web development world, but when I was keeping up with it a lot of developers still hadn't moved on yet. It's light years ahead of Struts 1 and really not so bad to work with as far as Java web development is concerned. Some others have mentioned 'Thinking in Java'. It's a great book for those new to Java and especially object oriented programming. A seasoned programmer may find it a little verbose. Either way it's free to read online so it's probably worth checking out. If you're looking for something a little smaller to digest you might want to check out Sun's tutorials, and the Java API docs are invaluable. The language itself is simple; it's knowledge of the standard libraries that separates a good Java developer from a mediocre one. 'Effective Java' and 'Hardcore Java' (specifically the chapter on the Collections API) should be mandatory reading for Java developers as well so you may want to check those out once you get up to speed with the language. For learning Struts, I'd check out the online docs first. Last time I checked they were pretty good. If you still want a book, I've found the 'In Action' series from Manning Press to be good.
- icey 18y agoI don't know anything about Jython or Scala, but I do know that Clojure does NOT have native Java speed. Clojure objects are Java Objects, so they must be boxed & unboxed by the JVM. Clojure is decently fast, but well-written Java will continue to smoke it for some time to come.
- pbnaidu 18y agoI would also read Effective Java along with Struts related text book. Here's the link to the book http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/0321356683/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1213823747&sr=8-1 http://www.amazon.com/Effective-Java-2nd-Joshua-Bloch/dp/032...
- jsmcgd 18y agoIf you read this book you will know Java. http://www.deitel.com/Default.aspx?tabid=1191 http://www.deitel.com/Default.aspx?tabid=1191 Highly recommend.
- fuad 18y agoAgree, this book gives good understanding about Java (platform and language.
- rcoder 18y ago> If you read this book you will know Java. Correction: if you read, understand, and write code based on that book you may legitimately claim to know Java. Reading books about programming languages teaches you about as much about programming as reading sheet music does about composing. It's a key prerequisite, but not the same thing.
- jsmcgd 18y agoI agree. By read, I mean what you state in your correction.
- silencio 18y agoI had one introductory Java class that used that book and I didn't find it very helpful. I ended up using it literally as a doorstop after the prof suggested we do so as a joke, only kept it to do the assignments from the book, and went with Eckel's Thinking in Java instead. That was a few years ago and a couple editions back..but I think some of it was personal preference/frustration. It's been a while so I forgot what my particular gripes were..I thought the introductory stuff was okay but (iirc) what ended up happening was that the book didn't cover anything particularly advanced that I wanted to know more about, which at that point was probably things like JDBC and JavaServer...things...I guess back then it was JSP and servlets, it looks like they dropped that for JSF in the newer editions. Obviously I can't expect a book to cover everything, but I mean I was expecting at least a gloss-over of the more advanced topics. Plus, if I remember correctly, a new edition of Thinking in Java was less than half the price and an older edition is available online for free. Sooo...
- strlen 18y agoBruce Eckel's _Thinking in Java_ (available free online, just as are his C++, Design Patterns and .NET books) is excellent, combined with just API references.
- j2d2 18y agoA few things to remember when programming java: 1) It's not pass-by-reference. Java is pass-by-value, but it is passing pointer values, not variable values. This sometimes behaves like pass-by-reference but if pass a from foo() to bar() and call new on a inside bar, a will get it's old value once bar() returns to foo(). 2) Eclipse has a tremendously useful debugger and, as an emacs guy, I can vouch for Eclipse being well worth learning. You can change code in running programs, but beware it reruns whatever method you're in. Sometimes (possibly all times) without resetting values changed in that method. 3) Use interfaces when you can. Map instead of HashMap, etc. 4) Leverage the classpath for testing bugfixes easily. Create a jar with your fixed class, put it in front in the classpath. Keeps things simple and let's you build upon anything you shipped to a client. 5) If you have to use RMI, understand why readExternal() must reflect the order of things from writeExternal() and how this can break easily. This specific case may not be useful to you right now, but it will help you understand what RMI, and serialization in general, is actually doing. I'm sure there are other good lessons but it's been a while since I worked with someone new to java.
- xlnt 18y agoSICP
- RyanGWU82 18y agoThis is an absolutely terrible response. Did you even read his question? The original poster is already an experienced and proficient programmer. He just needs to understand the syntax and concepts of a new language. SICP uses Scheme, not Java. SICP does not teach Java's syntax, nor object-oriented fundamentals, nor web development with Struts. What possible rationale makes this a good suggestion?
- deleted 18y ago[deleted]
- comatose_kid 18y ago'This is an absolutely terrible response.' Totally off topic, but this reminded me of the scene in Office Space where Samir reacts to Tom's 'Jump To Conclusions Mat' product idea: 'Yes, this is horrible, this idea'.
- xlnt 18y agoWhy so harsh? I think he'd be better off reading SICP than a java book, despite the short term reasons to do otherwise. And so what if it's in scheme? if he can't understand scheme then he's not a proficient programmer.
- silencio 18y agoI'd have to disagree, because the short term reason is a pretty big one. Not saying SICP sucks, I think the original poster would benefit from reading it..but at this point if he/she/it is working on said project NOW and needs a good Java/Struts book NOW, SICP isn't going to be that helpful. Only in the long run.
- xlnt 18y agoI understand that some people will disagree. I might be wrong. That's no reason for him to be harsh. It's good for the poster to get a variety of advice.
- hello_moto 18y agoKashif: 1) Head First Java 5 1) Effective Java The strategy here is to study both interchange; once you learned a topic from HF Java 5, check the best practice in Effective Java. 2) Head First JSP/Servlet 2) Any Struts 2 book You can start with the basic few chapters from HF JSP/Servlet and move on to Struts 2. If you found alien concepts in Struts 2, check back HF JSP/Servlet.
- dedalus 18y agoJust Java by Peter Van der Linden is an exceptional introduction thats comprehensive and well thought out (may be not just for complete newbiee) http://www.amazon.com/exec/obidos/ASIN/0131482114 http://www.amazon.com/exec/obidos/ASIN/0131482114