I have always felt that computers have a reputation of being more difficult than they really are, and that professional computer scientists, in particular, are guilty of making the act of writing code into a black art. It seems like we are intentionally obfuscating what we do in a subliminal effort to sound intelligent, coupled with the well-founded fear that we will be met with "well if you're so smart, why won't my printer print?" if we make it sound too comprehensible.
When I was in college, I was known among a certain group of people as the person to go to if you had a computer question, not because I was all-knowledgable, but because they could depend on me to try to use the right metaphors for them. This love of metaphors, coupled with an overblown sense of hubris, drove me to start this guide.
Now I'm going to let you in on a big secret that could be bad for my job security: programming is easy! Yes, someone has to say it since currently there are far too many people out there making computers look like they are something otherworldly or excessively complicated. I am here to say to you, here and now, that coding isn't hard.
If you would like to learn to program for reasons of advancing your job, you've come to the wrong place. I admit to being a software engineer as my day job, but I can't stress enough that a bad coder who enjoys their job is much much more useful than a good coder who hates their job. You can fix bad habits but you can't fix hate. I'll try to teach you some things that might be applicable to getting a job, but, if you really want a job, you should follow all of the lessons, and then you should attach yourself to a free software project and help them out. The kind of coding I'll be showing you here is more of an immediate one. It should help you do things like program little useful utilities, but it won't be very useful for anything more large scale. And eveything you might get hired to do would be large scale. Trust me on this - professional software development involves a staggering amount of code. It's almost an information management problem instead of an algorithm problem. The only way to get good at developing large systems is through a combination of experience and education.
There are a few prerequisites to this:
- You should be comfortable around computers
- By this I mean that you are unafraid. Many people get skittish around computers and, in an effort to avoid spending time learning something they feel is too hard, end up afraid to move the mouse or touch the keyboard in an unfamiliar situation. If you are one of these people, then the below is not for you. Instead you should read about overcoming your fear of computers.
- You should have some sort of basic idea about how a computer works.
- You should know what a file is, what a directory (or folder) is, and be comfortable with creating and deleting both directories and files. Knowing the difference between your hard drive and your RAM would be excellent, too.
- Most important of all, you should be curious.
- Carl Sagan said something about a sense of wonder being imperative for all scientists. Well, there is a reason that the act of studying computers is Computer Science. If you are interested, you'll go far.
With these conditions met, the learning should come easily. Note that all of these
lessons constitute a constantly evolving
work in progress. If anyone has helpful hints or a question about something that I didn't explain clearly, please either node a better explanation and/or /msg me about it.
The language which I will be teaching you is a procedural language/object-oriented language called Python. The principles you learn using Python will apply to almost any other language, but you should be aware that Python is one of those languages that some love and others hate. I have used it to teach others, however, and I think it is a good first language, but if others should feel free to (and indeed, I would encourage them to) replicate all of my examples and explanations in the language of their choice.1
The very first thing you should do upon deciding to do the lessons below is to go to http://www.python.org and download and install the most recent version of Python for your operating system. Then come back and we can start going through them in the order below.
Lessons:
- Producing Output
- Math
- Variable and Function Calls
- Types and Objects
- If/Then
- Loops
- Defining your Own Functions
- Libraries and Modules
- Philosophies of Coding
- Conclusion and Further Reading
If you actually learn using this, please /msg me with questions or suggestions. I'm planning on becoming now a professor of Computer Science., so it'd be good for me to start getting better at teaching and explaining right now. This is, of course, (c) 2002 by me.
- Although you should ensure that you are explaining how to program, not how to program in X language.