How to write code

How to write code

In this class, you will be asked to write programs. For most programs, you will be given small example programs that you will expand and add functionality. There is a right way and a wrong way to go about this process. Read the following carefully and follow the process closely to avoid unneccesary weeping and gnashing of teeth.

1. First, verify that the sample code you are given actually works. If it does not, then immediatly get some help so that you can run it successfully.

2. Carefully study the code. Most of the code you will be given will be small and do only a limited number of things.

3. Make a guess on what each line does, and see if you can make a change to the code to test to see if you understand. See if you get the expected results when you run the changed program. If you do not, then try to make sense of the output and try another change. Always go back to the original code until you find a change that gives you predictable results.

4. Save this new program. Call it, say, formLetter1. Now try to make one more change, working towards the goal for the assignment. If your change works and you think you understand why, then save this program as formLetter2 (and so on for each change). If your program does not perform as anticipated, then return to the formLetter1 program and try something different. If you are out of ideas, or want further elaboration on what is going on, try to form a student study group, check with the tutoring center, ask a question on the javascript forum, email or IM a fellow student, try to catch me online, or email me.

5. Try not to make more than one change without running the program and saving an updated version. There is nothing more frustrating than having a working program that now, after 5 changes, does not work and you have no idea which change was the culprit. Keep It Simple!

6. In general, you are trying to Evolve your software. Always be in a position of strength, with a working program saved that is close to what you want, and work to make it better. It is much more fun and less frustrating to try to make a working program better than to try to get a non-working program to work!

7. Most importantly, if you do get stumped, ask a question, but see if you can predict where in your code the problem lies, and try to formulate a good question.

8. Remember, programming is teaching the computer. It can be fun (REALLY!), but it is the best way to really understand what a computer is doing and what it can and (perhaps) cannot do.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>