Introduction to programming
1 Human vs. machine
Human | Machine | |
---|---|---|
Language | Natural | Logical |
Expressions | Can be vague | Cannot be vague |
Syntax | Allows syntactic errors | No syntactic errors |
Number system | Decimal | Binary |
Learn how to talk to the machine!
2 Learning programming
What is programming? Talking to the machine. Machine languages share many common aspects of human languages, but they can only understand exact syntax and don’t like ambiguity. You’ll have to learn to exact be in your expressions. Because you if say something in an unnatural way or order in a natural language, people will still able understand you, but not the machine. You see? In my previous two sentences, there were errors, but you still got them. Programming languages won’t tolerate any syntactic errors.
You’ll need to learn two things mainly: (1) programming syntax and (2) logical thinking. Let’s say I said something you want to eat tonight, then you’ll get an A in this class. Is it grammatical? Yes, but does it make sense? No. (1) YES, but (2) NO. Only being syntactically correct doesn’t mean your program will do what you want it to do. It just won’t complain about your syntax, but it will do something very not useful. That’s why I want to spend two weeks for logical thinking. Without logical thinking, you won’t be able to write any code at all just by knowing the syntax.
3 What is programming about?
“Programming isn’t about what you know; it’s about what you can figure out” – Chris Pine, Learn to Program.
4 Python is supposed to be easy?
People say Python is easy to learn, but that’s the syntax part, not the logical part. Logical thinking is universal no matter what language you want to learn.