SeachMall wrote:Bad analogy, not even comparable. How do you learn to add without doing a sum?
Even worse analogy. You can't, of course you can't. What I'm saying is that you cannot work out the area of a circle and learn to add while you're at it.
There is more to programming than a load of syntax. There are parts to programming that are pure theory - for example, AND/OR/NOT logic gates as only one example. There is also a lot about technique. If you learn this on the fly you will learn only the minimum to complete the project, you will not get maximum code efficiency and basically - you will never be a good programmer.
This is how I will learn a programming language:
+ Read about displaying text and how to assign variables, including variable naming.
+ Try a simple hello world program, try assigning "hello" to one variable and "world" to another.
+ Read about more complex string manipulation and certain string functions.
+ Test things such as len("aaa"). Have a little mess around.
+ Read about loops and IF statements.
+ As I'm going along trying little exercises.
+ Complete a few exercises that incorporate all the techniques I've learnt so I have to think for myself.
+ Set myself a project (eg. Paper, Scissor, Stone). Research the modules etc I might need to do this.
+ Read about them.
etc etc, you get the picture. Eventually when I am confident enough I'll start looking over other people's code and improving it or bumming it down if possible.
And talking about that, bumming down code is a great way to become a better programmer. Set yourself targets. Write a program of say 100-300 lines and then say I'll remove 50-100 lines from this, but let it do the same thing.
I also like timed exercises such as make a script that shows the Fibonacci numbers up to n, which is a custom value - and do that in 2 minutes.
However, back to my original point - if you don't learn well like that then you're in a sticky situation. Learning from just doing projects right from day one is leading towards you becoming a bad programmer. But then again, if you learn from the textbook and never try a thing out, you won't be much better either (though your knowledge of the syntax will be better, your code will be inefficient and poorly thought out, most likely).
Take a look at this - something that is more likely to be written by a 100% project learnt coder:
- Code: Select all
Now take someone who is balanced:
- Code: Select all
a = 1;
while a < 6:
a = a + 1;
See what I mean?
Now if you don't program like that you are most likely not 100% project learnt. After you have learnt the basics, your learning should almost totally be project based. But for the first few days to a week, it should be learning and doing the "hello world" type examples.