Head First Java
The Good
Of course, you can't learn Java without a good understanding of object-oriented languages. I made fairly heavy going with 'Learning Java' until I decided to dive in head first. Head First Java, that is -- a new book from O'Reilly that has a totally different attitude to teaching than I've seen before in computer books. It also looks like this might be the start of a series from O'Reilly, the website an introduction seem to assume that there will be more 'Head First' titles and I hope so. The style is humorous, full of graphics, cartoons, puzzles, quizzes and crosswords. It reminds me of the textbooks that used to try and teach me geometry and algebra in high school or my daughter's elementary books on Roman and Greek history I purchased for her at the British Museum. The style didn't work to teach me much algebra and geometry, but I wasn't anywhere near as motivated. This time, it worked. In a couple of weeks I worked through the book and finally have Java skills where I can branch off and start coding the projects I had in mind (though something more advanced will be required soon.)
In the introduction the authors examine learning and explain why they designed the book as they did. To quote from one section: "Some of the Head First learning principles. Make it visual. Put the words within or near the graphics. Use a conversational and personalized style. Get the learner to think more deeply. Get -- and keep -- the reader's attention. Touch their emotions." They argue that our brain is tuned to novelty, and that their style provides the novelty to keep your brain turned on. They also provide ten tips for good learning. That's one thing that seems to set this book apart from most other computer books, they say they think of their reader as a learner and indeed that's the way you are treated by the book. You can start to get a feel for their ideas by visiting headfirst.oreilly.com, a site devoted to the series. You can also grab a couple of example chapters from the books web page, which also has the usual marketing info, table of contents and errata.
The BadWhen compared to Learning Java the coverage is not as good. Head First really only covers the basics, up to and including creating a GUI with SWING and then touches a number of others; Learning Java goes on to explore, with a fair depth, network programming, web programming, servlets, applets, Java Beans, XML and other topics that are only touched on briefly in Head First. If the style of learning does not suit you then this will be an incredibly irritating and useless book, I'd give it a try first, though. If it isn't for you then the style of Learning Java might be better.
ConclusionWhen you get down to it, though, the only way to really decide on the worth of a tutorial is to decide how well it teaches. Head First Java excels at teaching. OK, I thought it was silly, I had a hard time making myself do the exercises, fill out the crosswords and solve the puzzles. Then I realized that I was thoroughly learning the topics as I went through the book. Learning Java was doing the same job, but the dry traditional method wasn't doing as well. Both books are well written, designed and constructed -- the style of Headfirst Java just made learning, well, easier.
It would seem to me that the 'Head First' approach is going to work wonderfully for the more 'beginner' topics, books for introducing you to a new style of programming, a new language or a radically different operating system or application. So if you're looking for a book to introduce you to Java then I can recommend Head First Java. Now if I could only find a book as good to introduce me to Common Lisp.
You can purchase Head First Java from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Has got to be the Core Java Series. Between the fundamentals and the advanced books, I haven't found anything as complete and as clear as this.
Another misconception he seems to have is that JavaScript isn't object oriented. It actually uses an interesting object system that uses "prototypes" rather than classes. This system, while somewhat strange, is actually more flexible than a lot of class-based systems. (IIRC, one of the more extreme examples of a prototype-based language is "self". It's worth checking out if just to help you understand by counterexample exactly what's going on when you use classes in a normal OO langague.)
Java is just an OO-Language so I don't see how you can say it is "bad" for the industry. And personally, I get tired of seeing the same negative criticism being leveled time and time again as if the thing has never progressed in the last 5 years. I work with Java everyday and have watched it improved dramatically with each new release. But I'm meandering..back to the original point. Java is just a language. Your effectiveness with Java is only as good as your understaning of the OO principles that it is built upon, and THAT is where I see problems. It sounds like what you're really biting at is that you've seen a lot of people, rushed into the market, who *surprise surprise* can't code their way out if a paper bag. How is that Java's fault? Are you suggesting they would have been better programmers had they been rushed through C++ instead? Dot com boom/bust had nothing to do with Java. If you want to blame anyone, blame the VCs. They're the ones who spoon fed money into dumb projects creating the market for overpaid poorly trained programmers in the first place. The fact many of them may have learned Java is beside the point.
As far as good or bad for the industry... well.. you don't really define what your industry is. Software house for the most part don't use Java. I personally feel it's an "IT" language, and the IT shops/people that I've been involved with LOVE Java for its productivity and cross-platform compatibility.
Transforming the buzzwords of "encapsulation", "reusability", "modularity" into workable and efficient solutions requires way more work than strictly learning the language.
Also, a common pitfall is to believe that you can do whatever because some garbage collector is taking care of memory management.
Before even reading whatever about java, I'd strongly recommend
- of course, Design Patterns, by Erich Gamma et al;
- Principles of Object-Oriented Software Design, by Anton Eliëns (online version here).
On the J2EE side, they also make extensive use of object pooling (for servlets, DB connections, etc etc). This makes Java on the server-side much faster than naive implementations written in native languages (for the record, ASP is a naive implementation, whereas ASP.NET is not....ASP.NET is able to handle similar loads to JSP/Servlet solutions, whereas ASP is about 5x-10x slower).
Throw in dynamic runtime optimizations offered by HotSpot-type JITs and you end up with a server-side solution that bests most other solutions in terms of speed. Server-side Java is quite nice.
Take a look at the Resin web server/servlet engine, if you're interested in seeing how good server-side Java can be. This thing can serve static content faster than Apache!
--Be human.
You can do a static compile of java into machine dependant bytecode using gcj if you are into that.
I do a lot of server side Java and I have never had a speed issue. Its much more likely to be a database issue that slows up the app than the execution of actual byte code. Remember that web/app servers ALWAYS top out on io before cpu anyway, so the fact that the Java server is running at, say, 40% cpu instead of 20% doesn't mean a heck of a lot.
After that read Java Development With Ant by Hatcher and Loughran for good info about how to set up real java development environments. Ant is a tool that fits a similar ecological niche as make, but has tons of extra features particularly useful to Java developers.
Oh, and don't bother with an ide. Real men use vim.
Hi, I'm Pat Niemeyer, the author of Learning Java. As I sat down this morning to begin work on the fifth edition of the book for Java 1.5 I was
;);)
pleasantly surprised to see this item on Slashdot (my first stop of the day). So I thought I'd chime in with a little bit about what it's been like working on this book over the years and ask for you help in making it better.
The short story is that trying to authoritatively cover a topic as broad as the Java language and libraries and to do so without simply producing a giant shelf-filling reference tome or dry as toast text book is a very difficult challenge. I think there are parts of the book that have met this challenge and parts that can be better in the future.
Now, I consider myself to be a relatively funny and creative person (also sexy, and other adjectives as well) and I think if someone had asked me back in 1995 what my first book would have been like I might have imagined something a bit lighter and breezier than an 800 page book about a programming language. But I think that the Slashdot audience in particular will appreciate that despite its size and some obligatory coverage, this is a book written by someone who has a passion for software and architecture and that I have tried to pour my creativity and time into crafting elegant, insightful, and *minimalist* examples. I wrote this book for people who think and learn the way that I do and that may not appeal to everyone.
I think the strongest parts of the book are in the most exciting and difficult areas of Java - topics such as advanced networking, multi-threaded
programming, and XML. IMHO Learning Java's coverage of these topics is deeper than some single topic books in their entirety.
The Java language is a moving target and one that gets more moving parts every day. The greatest challenge in writing about it now is not what to cover, but what to leave out. I have spent many many hours on the phone with my editor (Mike Loukides) over the years debating about what we need to include and what we need to cut. In recent editions which have included a CD in the jacket (yah, I know... book CDs are normally useless) I have started moving the old, less relevant material (such as some of the original AWT API stuff) to the CD.
I have also experimented with the introductory tutorial chapter - trying to give a broad overview of the whole language in one chapter before diving into details. Some people may see that and be turned off. I hope they'll dig a little deeper.
I am very interested in what Slashdot readers have to say about how to make the book better. Your comments would be very well timed right now as I am updating the book for Java 1.5 as we speak.
I hope you'll check out my book if you need to learn (or learn more about) Java. If you have already mastered Java then I hope you'll buy a copy of my book and give it to a homeless person
Thanks,
Pat Niemeyer
Author of Learning Java, O'Reilly & Associates and the BeanShell Java scripting language (www.beanshell.org).
Or the girl in the bathtub, or, well, about 98% of what's in a Head First book. And this was deliberate. I'm the co-perpetrator, and creator of the Head First series.
Personally, and as smart as he is...Dijkstra is just not someone I would have ever wanted to date, or even sit next to at a dinner party.
And wasn't he also the author of something to the effect of, "Anthropomorphizing is the sign of an immature mind?"
Well, we blew that one Big Time. I think half the book is anthropomorphized *things* -- objects, variables, threads, you name it, we've turned it into a living breathing (sometimes swearing) thinking *feeling* creature.
We'd like to counter Dijkstra with someone we feel certain would kick his ass in a celebrity boxing match. Roger Schank. He was chairman of the computer science dept at Yale (and director of the artificial intelligence project). Last I heard he was Distinguished Professor of Computer Science at Carnegie Mellon University. (OK, as far as the boxing thing goes, Schank does have the advantage of being alive...)
And since we know some people will be misled by the pictures into thinking that it must be a "for the lesser mind" , or that, "if it's that fun, it must not be serious." we can point to some heavy hitters who have endorsed the book (on the cover) . One is a former PARC guru and now the Director of User Sciences and Experience Research at IBM Almaden Research Center. He also teaches advanced studies in artificial intelligence at Stanford.
Another is Ken Arnold, co-author with James Gosling of "The Java Programming Language", and a co-developer of the Jini specification.
Then again, another quote inside the book is from Rick Rockwell, the original groom from "Who Wants To Marry A Millionaire" (now Darva Conger's ex.).
PARC and FOX in the same endorsement page...
That alone will stop some folks from getting it.
And if you don't like the style, it won't even be tolerable -- at best, an acquired taste, whereas a more traditional format is usually acceptable even if you don't LOVE it.
So a lot of folks (me especially) are wondering how many people out there will actually *want* to learn this way. This is a brand new concept, so we'll have to see. If you want to know how it's being received, check on Amazon from time to time, and search on Java, and sort on bestsellers, or check the O'Reilly bestseller list. The book has been out for only a few weeks; it will be up to learners/readers to decide.
I can tell you our proudest moment came when we got an email from a guy whose wife doesn't fully approve of him reading the book.
cheers,
Kathy Sierra, co-author Head First Java