views:

161

answers:

4

I have learned that the best way to learn a language is by finding a good project to start on, and working out how you would create it. I've been programming for 4 years as a hobby, and it's only been in PHP, so I decided that I should learn a "real" programming language. I have tried C++ in the past, however I was never able to find a project that I could apply it to, and therefore I never really learned much.

Now, though, I'm checking out Java, and so far I really like it. My question for you is: What would be a good project or projects for a beginner to learn the main features of Java? I understand basic OOP practices and such. What I really want to learn is all the little libraries and functions inside of it. For example, in PHP you learn to use many array manipulations and other functions built-in to do work for you. I would like to learn what these are in Java.

As I said, I don't really want just documentation, I'd like a project that I can apply Java to.

+3  A: 

Whenever I learn a new language I start with a Mandelbrot. Just to get the hang of loops, variables and drawing.

Many other simple learning progs are possible. For basic screen/key/mouse i/o and timers, try a Tetris, Breakout, or Clock/alarm clock. To learn audio interface make an Electric piano/synth. To learn maths/recursion/string manipulation i often write a quick expression parser + graphing prog. To learn sockets, you could try a simple p2p chat.

Java is a good choice, good luck!

Sanjay Manohar
+2  A: 

My advice, take a project based course some university puts up. Something past COMP 101, but not too theory heavy.

This one's how my university breaks sophomores. Its fun, and requires you to think about design and (a little) about data structures. Good "salt of the earth" programming: consoles, file IO, parsing, collections, etc. No GUI, though there's another project for that and threading.

Kevin Montrose
A: 

while general, I would say find a web application that interests you. If you are familiar with PHP, you are probably familiar with many web technologies. Java on the server is a nice alternative to PHP, and deploying a Java web application is pretty simple.

darren
i disagree, the deployment is one of the disadvantages of java (but the necessary evil). PHP or Python are much more straightforward and offer quicker feedback (a simple file-save will make the app change instantly).
manuel aldana
+1  A: 

dont rush urself, get a good java book and study from the chapter 1st and make sure you solve all the exercises of each chapter. First get ur basic / foundation strong, then u can think about how to apply that knowledge in project. And make sure u also get a good book about algorithm. If you had an experiences in php for 4 years, you must developed something with php i can assume, so try to develop same application with Java now, it will give you good insight about Java. And one thing... try to focus on how you can write good quality code! Anybody can write code but good quality code is rare, focus there.

Zakir Sajib
Yeah, it took me until last year to start trying to write quality code in PHP, but I will definitely start Java with that in mind. As for rewriting a PHP application in Java, it wouldn't really make sense to do so. All of my PHP applications are web applications (mostly games.) Perhaps I'll look into creating a PHP bot though, as I have done this in PHP before.
John