Settings

Theme

Ask HN: Is there a fun way to learn Java?

12 points by khurram 15 years ago · 14 comments · 1 min read


I'm a CS student and my Java skills aren't nearly as solid as they should be. Even at a top University it was a class that wasn't very well taught.

Learning web languages (Ruby in particular) is very easy to get into due to the fun tutorials available. I'm tempted to learn Ruby and hope it also enhances my Java/general programming knowledge.

Before I learn yet another language, is there a fun way to learn Java better (OOP concepts in particular)? I saw the Play! framework and thought that might be quite fun to try out, but doubt it will enhance my actual Java knowledge.

apl 15 years ago

Given that the language itself is so very mundane, I'd recommend implementing a fun and challenging project of your own choice -- in Java, of course. Preferably one that won't consist of plugging framework A into framework B.

Language-centric tutorials won't get you far in Java because there's not much to discover. Python or Scheme or Haskell elicit a "Wow!" every now and then. Java is all about libraries, tools and ecosystem. It's a language that very much disappears behind its immediate surroundings -- counteract that by extensively using the language.

So go and grab that Play!-thing, and build something reasonably awesome.

aiurtourist 15 years ago

I was in the same boat as you when leaving college — I knew the Java _language_, but I didn't really know _Java._ Prior to my first job I always thought of Java as "that big ugly language," but after a few years there I really started to get it.

A few things that made me enjoy Java more:

• Use an IDE Eclipse, IntelliJ IDEA or NetBeans. Vim can't handle things like automatic imports and serious refactorings like "extract method."

• Use packages liberally. Start your project inside `com.mistrq.myproject` and make a good, semantic hierarchy.

• Write applications with Guice. Program to interfaces and bind concrete classes at runtime. Dependency injection lets you easily turn a giant, hard-to-comprehend project into manageable chunks.

• Be liberal with interfaces. Sure, we had a lot of single implementations for interfaces, but using Guice made it trivial to swap out implementations for experimentation.

• Write tests. Use whatever's popular for unit tests right now, and check out EasyMock for amazingly-easy creation of mock objects.

HeyLaughingBoy 15 years ago

The only Java program of any consequence I wrote was a multiagent autonomous robot simulator (sounds more complicated than it actually was :-) for an experiment in independent agents. It was fun, but after I was done, there was absolutely no motivation left to continue and I soon got into Python instead.

Java is simply not a "fun" language! If you're a student and looking for a job, knowing the language basics is enough, no one hiring out of school will expect you to be an expert. Much more important to know the OO principles it's supposedly based on.

nano81 15 years ago

One of my first encounters with Java was in writing silly IRC bots with some friends. Easy and fun.

http://www.jibble.org/pircbot.php

mistrQ 15 years ago

Will learning Ruby better give me a new perspective and reinforce my Java knowledge or will it just distract me?

I'll already need to learn extended ML for my functional programming class this semester (previously done haskell). I use php at work when doing front-end web dev. I wouldn't mind increasing my javascript skills also. So I'm afraid of being jack of all trades, master of none.

I know Java better than I think I do. It's all the libraries and frameworks that I need to become familiar with.

veb 15 years ago

Make an application for Android, that logs your GPS position and sends it to your personal website for your friends to check.

(trust me, it's fun and you can steadily see your progress)

  • mistrQ 15 years ago

    I developed an Android app for one of my Uni classes.

    I didn't really feel I learnt better Java though, alot of the programming is quite Android-specific.

shortlived 15 years ago

I was learning Java at work but also picked up Ruby on the side to do some scripting work at the same job. Through Ruby I learned truly about first class functions, closures, etc and then took that knowledge over to Java. I also highly recommend the first edition of the Ruby "pick axe" book. It is a great OOP book.

vkris 15 years ago

I'd recommend reading "Head First Java" for fun-filled learning.

kachilous 15 years ago

codingbat.com offers online programming exercises in java. Since you already know the basics, it would be a good way to reinforce the skills you've learned.

evo_9 15 years ago

Yeah it's called c#.

  • mahmud 15 years ago

    It's good to see C# is able to create its very own snobs; a first for a language without an original idea behind it.

    Welcome aboard, hope you are able to increase your sense of self-importance and foster a more exclusive body-politic.

    Please flesh out your profile: http://c2.com/cgi/wiki?SmugCeeSharpWeenie

    • evo_9 15 years ago

      Yeah, funny thing is I'm a jquery snob if you really want to peg me into a neat comfy corner.

      C# is the least annoying plumbing code I do, that's the only love I have for it. That and VS2010 is really nice to work in, and it's probably got the least painful jquery support out there right now (though I am VERY open to hearing about an IDE that is better/more excellent for pure jQuery use - sorry no vi, I prefer something with a mouse these days).

      HN is chalked full of snobs on all sides; just because I dare to post a comment counter to the norm doesn't make me a snob (well not a c# snob that's for damn sure). It makes me crazy probably (knowing the inevitable results of sharing an alternative viewpoint - esp. one that gasp indirectly praises the Evil Empire).

      Plus what's all that karma for if you can't have some fun with it?

  • evo_9 15 years ago

    Yeah not joking, hate away.

    It's easy to pick up either once you learn either languages. C# is easier because visual studio is way easier to setup and configure. The language is often more susinct as well.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection