This page contains general tips and information which are intended to help students through the course.
Probably the most important contributor to your success in the course is your degree of participation: you must be active in your own education. This process is simple; it does not require excruciating effort. Here are some steps you can take to make sure you are engaged in the course.
- Attend class.
Lecture serves as a primary introduction to the course material and supplements the textbook. The lecture will emphasize important content and can help to improve your understanding of the material. Furthermore, lecture is interactive; by being in class, you will hear the questions that your classmates ask and the answers to them, even if they are not questions you would think to ask yourself. By the way,…
- Ask questions.
Don’t hesitate to ask if you don’t understand something. Even if you understand it partially, feel free to ask for clarification. The instructor and the ninjas are here because they want to teach, so you’re not imposing. In fact, you help your classmates by asking questions (see above). It’s also especially important that you…
- Ask questions quickly.
The material in this course is very linear: each lecture builds upon the previous lecture. Unlike some courses, there is no point at which you can effectively ignore something you haven’t learned: if something is a problem this week, it will continue to be a problem next week unless you resolve it. Even if you are falling far behind in the course, we can often help you catch up and salvage the semester. I can’t emphasize this enough: ask questions as soon as you are unsure of something!
- Attend labs.
Lab attendance is required, but it’s worth more than the time to complete your assignment and the impact on your participation grade. Lab attendance has many of the same benefits as class attendance, with the added bonus of programming practice (see below).
- Read the book.
Reading the book before class is a very good idea. The lecture will largely follow the book but, if you’ve read the book beforehand, you’re far less likely to miss an important detail during class.
- Start your homework early.
This is a recommendation you’ve surely received countless times, but it’s hard to appreciate just how good an idea it is until you’ve started seeing the results. You should start your labs as soon as possible. This is not only to help you manage your time well; by starting the lab as soon as possible, you give yourself plenty of time to identify any trouble you might have in understanding the material as well as time to ask questions and receive answers. Starting your lab on Saturday morning is a very bad idea; you will have far fewer resources to help you if something goes wrong.
Programming must be practiced to become natural. Try inventing your own tasks or problems to solve and then writing a program to do it. We’ll answer questions about that program too! Perhaps you want to keep track of your grades in different courses. Maybe you want to keep an eye on a website and know when it has changed. Maybe you’d like to generate black and white renditions of hundreds of photos you’ve taken. The value of a computer is that it can be taught to automate tasks like these for you and you’ll get better at programming each time you teach it something new. Use your imagination and keep coding until you feel comfortable.
There is an art to programming. Many different programs can solve the same task. For any interesting program, there is no unique right answer (but there are a great many wrong ones). Good programming style helps your grade, but it can do much more: well-written programs are easier to read, debug, and improve. Here are some tips for developing programs in good style.
- Document your program.
Put a comment at the top of the file giving your name, the dates that you worked on it, and a brief description of what your program is expected to do. If you don’t know what you want the program to do, step away from the keyboard: you can’t teach the computer to do something for you unless you know what it is you want!
- Write comments frequently.
You should write comments explaining your reasoning behind anything complex or that you had to think about carefully before writing. It’s usually a good idea to write the comment before the code: this helps you collect your thoughts. For functions, you should write a comment describing what the function does and giving information about its arguments and return values; functions are, in a sense, like little mini-programs, so they should have the same sort of documentation as above.
- Pick variable and function names with care.
Make your code readable by picking long, descriptive variable names. Variable names can describe their contents; function names can describe their behavior. Rather than
x, for instance, use names like
- Stick to a single variable naming convention.
In Python, either “snake case” (e.g.
variable_name) or “camel case” (e.g.
variableName) is acceptable (although snake case is preferred). Whichever one you use, only use one. Visual consistency makes your code more readable.
- Indent your code consistently.
The blank space in your source code is important, too! Use the same number (two or four) of spaces whenever you need to indent. Code with jagged indentation is harder to read.
This is only an introduction to good programming style, but it’s a start. Andrew Danner has several more suggestions for beginners’ coding style.
This might seem like a lot, but it’s a matter of developing good habits. After you practice the same conventions for a while, they become second nature. As always, please ask if you have any questions!