It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
I'll begin by saying that I'm really terrible at programming, and it's been about a year since the last time I touched Java (or any other programming language). Now I've decided to learn some Java somewhat properly, and would like some suggestions for good Java tutorials/books/stuff that'd help me with it.

A year ago, I managed to make a Dr. Mario clone with Java, but the code was a mess. The idea behind object oriented programming has eluded me completely, and I mainly use objects because I'm told to do so, and then I use them as code block libraries that just make the code into more of a mess. My documentation is awful as well, since usually I don't know what I'm doing until I've done it, and then I can't remember what which part did anymore (I guess that's just my lack of planning).

In order to someday graduate, I "need" to pass this one Java course where I'm supposed to make a program that shows I understand object oriented programming, is properly documented and somewhat fully covered by JUnit testing. At this moment, I couldn't fulfill any of those requirements, since I'm not even quite sure how that JUnit testing works and what I'm supposed to do with it (the examples/explanations I've read haven't been very good at making me understand what use it has).

Also, I handled errors in a really general way, because the materials I had only had 2 very general examples and I only knew how to use those 2 (now I've forgotten even those, something about throwing and catching and everyone howling in horror).

I took 2 Java beginner courses in my University, but I was so swamped with other stuff that I couldn't attend the lectures, so I just read the course materials and spent a lot of time programming. Missing the classes is the probable cause to my inability to comprehend anything about Java, or maybe it's that my sister taught me to design webpages using HTML tables when I was a kid and I kept doing it until 2008.

I'm gonna be mega swamped again, so I don't have time to retake the classes.

So basically what I'd need is knowledge about:
-efficient Java programming
-object oriented programming
-Java documentation
-what is up with JUnit anyway (my guess is that I'd need to know Java better to get this)
-error handling

...which, I guess, can be summarized as "basic Java programming".

I've heard that there are some really awful programming books/materials that you're better off not touching, so I figured I'd ask here (and I'd prefer good quality anyway if I'm going to pay for it).
Years ago when I took classes from Java a friend of mine (who has a long experience in Java programming) reccomended to start from Thinking in Java by Bruce Eckel. I bought it and I was happy with it - althought I would say it's focused more on object programming in Java rather than programming itself (like showing you how to build your own application form with Java Swing)

It's free here http://www.mindviewinc.com/Books/downloads.html
Post edited December 31, 2011 by tburger
Sorry to add to your list, but if you're going to write an application with 100% coverage, you will find it a lot easier if you also learn about:

Dependency Injection such as Google's Guice framework
A Mocking Framework such as JMock

learn the other things first though, but these two make unit testing easier, and your code better. It depends how big your app is though, for a small application it might be easier to just write a load of stubs. Once you get to 50 or more classes then writing and maintaining these becomes tiresome.

Can't advise on java books though I'm afraid, I'm a C# programmer.
I've heard really good things about the Head First series - Kathy Sierra started it and she's an awesome writer & great programmer (don't often go together, sadly). I've read some things of hers and thought the explanations were very clear & applicable, so you might want to take a look at that. Here's a link to the book on Amazon:
http://www.amazon.com/Head-First-Java-Kathy-Sierra/dp/0596009208/ref=sr_1_3?ie=UTF8&qid=1325345222&sr=8-3
I'll mention the Amazon reviews. Programming book reviews are not nearly as skewed / biased as say . . game reviews. I credit that to the professionals and students that post the reviews. I have purchased several programming books from Amazon over the years and found the reviews were fairly helpful and more accurate than I expected.. The last programmers reference I purchased was rated at 4.5. I found it to be a very good reference book and would rate it the same.

Not saying there aren't some misleading reviews but . . . it is worth checking out the reviews on Amazon before making a purchase. If there are only two, over the top, positive reviews for a reference book . . you should do more research before buying those.

Half the battle is deciding exactly which books are worth your valuable time. Books on the very same subject can have very different perspectives and focus. Browse the books and find high rated candidates that best fit your current skill level and learning preferences. Often, many of the best can be found at the local bookstore or the uni / college bookstore for in-person browsing . . . =)

Edit: The reference book I paid $50 for six months ago is now $29. It is worth checking out the used books as well. New releases may not be available but books released 6 months ago usually have some used book options.
Post edited December 31, 2011 by Stuff
avatar
wpegg: Sorry to add to your list, but if you're going to write an application with 100% coverage, you will find it a lot easier if you also learn about:

Dependency Injection such as Google's Guice framework
A Mocking Framework such as JMock

learn the other things first though, but these two make unit testing easier, and your code better. It depends how big your app is though, for a small application it might be easier to just write a load of stubs. Once you get to 50 or more classes then writing and maintaining these becomes tiresome.

Can't advise on java books though I'm afraid, I'm a C# programmer.
Not that these aren't excellent titles and well recommended, but the OP is a novice Java coder and would do well not to clutter his mindset with dependency injection and frameworks before he has mastered class and interface syntax.

Eckel, Thinking in Java, is the best Java-specific learning guide out there. If you are serious enough about this to want a good grade in a Java class, you need to suck it up and master most of what it covers (frag the stuff on threads; nobody has any business working in threads without serious justification). But it does not cover JUnit.

Most of what is written about JUnit is offensively stupid crap written by non-writers. Sadly, this includes the original documents at junit.org. The least dismal of a really awful lot is: http://www.jaredrichardson.net/articles/junit-tutorial.html and this is enough to get you started even if you have no background at all in JUnit.
Thank you all for the suggestions/advice. I started reading Bruce Eckel's Thinking in Java and thus far it has been better for me than the materials I previously used. It'll take a while before I get far enough to even consider looking into Dependecy Injections and Mocking Frameworks, but knowledge that such things exist may prove handy.
avatar
wpegg: Sorry to add to your list, but if you're going to write an application with 100% coverage, you will find it a lot easier if you also learn about:

Dependency Injection such as Google's Guice framework
A Mocking Framework such as JMock

learn the other things first though, but these two make unit testing easier, and your code better. It depends how big your app is though, for a small application it might be easier to just write a load of stubs. Once you get to 50 or more classes then writing and maintaining these becomes tiresome.

Can't advise on java books though I'm afraid, I'm a C# programmer.
avatar
cjrgreen: Not that these aren't excellent titles and well recommended, but the OP is a novice Java coder and would do well not to clutter his mindset with dependency injection and frameworks before he has mastered class and interface syntax.
Very true, and I was wondering whether to post them for that reason. The thing is if he doesn't have those tools, he's going to have a hard time writing the unit tests. Personally I think it's an incredibly ambitious thing to ask a beginner to do, learning to write code that can be unit tested takes experience. Those tools help guide you to doing it.

However you're right, he needs the rest at a very good level first, as dependency injection can screw with your head when you first look at it.