Re: Best way to begin learning java programming.

Posted 26 May 2012 - 03:26 PM

Like may other in this post have implied, people learn in different ways you need to find out what suits you best. As you may not have the drive/attention span to learn from a book but you may be able to learn if you are put under pressure e.g. coursework due.

Re: Best way to begin learning java programming.

Posted 26 May 2012 - 05:53 PM

It's the practice at writing programs that people need, preferably alone. Take the first concept your book or tutor gives you and write several programs with it. Play with it, see what you can change, see what things work and what doesn't work. When you can't make something work, try it different ways. Keep trying. Only ask for help as a last resort.

Now add in the next concept and write all the silly programs you can think of that involve it and the first. As you keep adding new concepts, increase the size and complexity of your programs. Go back and revisit previous ones to make them better too. Type every line of code out in full. This is an exercise in learning. Reserve copy and paste for when you are getting work done. (although if you need a lot of copy and paste, you are doing it wrong).

The more you practice, the better you will get. A lot of students fail to grasp programming. They make two mistakes. They think it's knowledge that can be learned. It's not. It's a skill that has to be practised. Then they think the exercises and coursework are enough. They aren't. They're not even close.

Two things help tremendously. The first is to finding programming compelling enough for it to be pleasurable to spend hours on end practising. The second is youth. A child will play in the way I've described for far longer than an adult. An adult will write a few test programs, see that they work and move on. A child will write inane program after inane program. He will be proud of his "achievements" and laugh at the silly things he has made the computer do or say.

I started to program at the age of nine with neither a book nor a tutor nor the internet. I had a 48K Spectrum, a programming pamphlet and a friend who knew some basics of the PRINT statement. But that was OK to play with. We wrote a program to PRINT "Policeman", BEEP three times (Pol-ice-man), BEEP a lot more to sound like a siren and then draw a semicircle because that was the only other thing we could work out how to do. We couldn't work the SAVE command so I wrote the program on a piece of paper for posterity.

From the pamphlet, I found out about for loops, variables, GOTO and drawing graphics. That was me for about a year. A whole year of programming with just that. Think of how limiting that was. But I did it because I could control what the computer did. GOTO was particularly useless. Without an if statement, the only practical thing I could do was infinite loops (which my nine year old self loved) and make spaghetti code. One kind of spaghetti code I found useful was if I wanted to insert some code but ran out of available line numbers. I could just add the code somewhere else, chuck in a couple of gotos and it worked. But was a mess.

I got so familiar with all this stuff that when I got my hands on a BASIC book and discovered the IF statement, I immediately understood how I could combine it with what I already knew. I remember thinking "now I can do anything" as if it gave me superpowers as well as Turing completeness.

I still didn't have a manual for my version of BASIC. But that didn't stop me playing. I set myself on a mission to find out what all the commands on the Spectrum did. I got most of them through trial end error. Eventually I got a manual and devoured it cover to cover. There wasn't much in it I hadn't gained through playing.

The point of my story is that as an adult I wouldn't play enough to become that familiar with something. I'll forget my Java far sooner that I'll forget my Spectrum BASIC. One of my friends was playing with an emulator at work recently and make a wee toy program but wasn't happy at how the Spectrum handled scrolling. A quick "5 POKE 23692, 0" fixed that. My adult self would never commit that line to memory. My child self loved how changing the scrolling behaviour made my infinite loops seem even more infinite.

Re: Best way to begin learning java programming.

Posted 30 May 2012 - 01:30 PM

As many stated before me "a good book will do", well that is the point isnt it? Finding the right book. Most books that I have run across for people learning are written by extremely educated professionals who forget that they are writing to beginners and tend to write as if the beginner is already a master at writing code.
No the best way to learn anything is by using a well written book, instructing professionals, and by doing. Simply saying that a book makes you a good programmer is false because what you learn from the book is how that perticularauthor writes code. Everyone has different ways of coding and no one one is write or wrong. Having the three methods of learning book, instructor, coding is probably the best bet. Remember, when a book is written and printed maybe over a year in duration and many new coding practices may exist.

Re: Best way to begin learning java programming.

Posted 30 May 2012 - 01:39 PM

I think that only applies to people who are new to programming as a whole and not just to a particular language. Yes, perhaps if you have zero coding experience then finding the right book that explains the basics in great detail is important. However for the majority who have some kind of experience in whatever language, they need the more complex details and the assumption that you have some experience and know roughly what you are talking about.

I remember my first Java book it took 2 thirds of the book to introduce inheritance. It's because it was a complete beginners book for people with zero experience. On the other my current Java reference book introduces it in the very first couple of pages. They are written for very different purposes. If a beginner was to read the current one, they would feel lost pretty quickly. On the other hand if someone who knows their Java was to read the old one, they would probably feel patronized when it takes a chapter to explain a while loop.

Quote

Remember, when a book is written and printed maybe over a year in duration and many new coding practices may exist.

This is also not always the case. I have an old beginners Java book that's around 7 years old now. Bar the addition of generics, most of the book relates directly to modern day Java.

Re: Best way to begin learning java programming.

Posted 01 June 2012 - 01:20 AM

I would say the most important concept of coding consists of what a language CAN and CANNOT do as well as naming convention standards. These CAN be learned from a book, but most books don't emphasize it.