How to master Java?

I think most programmers have about average college graduate intelligence, including myself. What we do have a lot of though is patience.

That said, there are efficient ways to learn and inefficient ways to learn.

  • If you’re stuck on one tutorial/book, try another book. Once you’re done with the basics, there really is no “correct” order to learn.
  • Skim through the standard Java library documentation. Don’t bother memorizing it, but be sure that you know the tools are there when you need them.
  • Make lots of test programs. If you’re ever curious about something, try it out and see what happens. Don’t know how big an int is? Write a program that prints out a sizeof. Don’t know what happens when you call a virtual function of an override instance? Write a program with two classes, one inheriting the other, and try it out.
  • Read other people’s code. Take note of style and structure. And I don’t mean silly things like whether the { should go on the same line as the statement, but how they recycle variables, how they organize their classes, how they use loops, where they bother to optimize and where they don’t etc. Emulate what you like.
  • Practice building “stub” programs — you can do this in your head once you get the hang of it. Find your favorite program, and write out all the classes/methods as you think would have been used to build it. That’ll help you with architecture.
  • Spend lots of time naming your classes. Don’t use fancy names, just descriptive ones. It’s a good mental exercise to think about names, even if you don’t expect to ever share your code.
  • Try Project Euler if you’re into that sort of nitty-gritty mathy stuff. I don’t believe that programming is all about math, but you might like it.
  • Learn C sometime. C++ probably isn’t worth it if you’re doing java, but C will teach you how your computer works. You don’t need to master it, but at least get to the point where you understand memory management and pointers. That’ll help you make decisions faster when you want your code to be really fast.
  • Learn functional programming someday. Haskell’s a good choice, because it’s a pure functional language. It’s extremely difficult at first, but the concepts you learn from it are valuable regardless of what language you program in. You’ll be making design decisions a lot faster, and your code will be a lot more robust.
  • Keep up to date. Trends come and go in this industry as fast as in the fashion industry. A lot of it is crap, but a lot of it is crucial both to employment and productivity. Always keep an eye out, or you’ll go the way of the dinosaurs.

Leave a Comment