Ask YC: Best book for Java
EDIT: Web Programming in Java
EDIT: Web Programming in Java
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.
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
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).
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.
1. Practical Apache Struts 2 Web 2.0 Projects (Practical Projects) by Ian Roughley - 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/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/193398807...
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.
Here's a few I've run across:
There's a ton more.
And the sources, of course:
I use MyEclipse to develop and it's pretty helpful and has Struts support:
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.
You will benefit not only yourself, but the humanity as whole :)
I recommend starting here - http://en.wikibooks.org/wiki/Java_Programming/Struts
http://www.deitel.com/Default.aspx?tabid=1191
Highly recommend.
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.
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...
True it didn't cover the advanced stuff which is why I bought 'Advanced Java How to Program' as well.
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?
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'.
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.
What your client really wants is the JVM and its libraries, not java the language.
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.
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.
I presume you meant Clojure numbers, because there is no notion of 'boxing' for reference types. For all non-numeric objects, the Clojure representation is the same as the Java representation. Type-hinted calls to methods of said objects generate the same bytecode as Java, with the same performance.
As far as numbers, recent enhancements ( http://clojure.org/java_interop#primitives ) allow Clojure to produce primitive arithmetic with the same speed as Java, but with a more-powerful, macro-amenable syntax.
While Clojure offers higher-order constructs with an attendant, but not prohibitive, cost, performance-oriented Clojure code can match the speed of Java.
This:
As far as numbers, recent enhancements allow Clojure to
produce primitive arithmetic with the same speed as Java,
but with a more-powerful, macro-amenable syntax."
Just blows me away.