Coding Process
Here is a paper I recently found. It’s on my coding process (after being a coder for about 2.5 months), and was written my freshman year of college…
What I do BEFORE I write any code?
Before actually coding any program, I have to make sure I understand it. Usually, I will understand what I have to do, but not what that means when it comes to writing the program. However, for the last 2 assignments we’ve had, I sat down, and wrote exactly what I had to do, and then what kind of methods I could use for writing that program. This took some time on my part. Just recently I’ve realized I should do this, and it makes writing the program so much easier. Since this course is my first experience with programming, It takes me a little longer to actually realize what I have to do and how to go about doing it. This is, I should also mention, the longest part of the process for me. For the current program, we actually had to write and hand in what we thought we had to do. We had to set up an array that took the inputted number and added 1 to t hat spot in the array. Ex. If 50 was the input, the a[50]= 1. Then the program had to print out the array with the number in that array. So this example would print 50: 1. After figuring out what I had to do, I thought of the best solution. Since I am new to programming, the best solution might not be the best, but I want to be sure that the program works. My solution was that I should set up an array, then use a for loop to make each value in that array 0. Then read in the Int. with a while loop, and made the loop terminate with a value less than 0. After each number was read in, I set up another for loop that, if the value in the array spot was greater than 0, it would print the array spot and its value.
What I do BEFORE I get my first clean compile?
Before my first clean compile, I go back to make sure that I didn’t miss anything. If I did, I would fix it. This is before any compile. I align everything to make sure it is all written correctly. Then if I compile, and it is not clean, I fix the errors the best I can. Sometimes, this would include asking a friend for some pointers on where I messed up. With this particular program, my error at compile time was that the file input class Prof. Plishka provided was not updated. So I went out to the website and got the updated one. I make sure everything makes sense, and then I proceed to my first clean compile.
What I do AFTER my first clean compile?
After my first clean compile, I first pray to God that the program works. Sometimes, it does. Usually, it doesn’t. So I go back to my code to check where the problem might be. After checking through the entire program- pretty much line by line, I assess where the problem might be and solve it accordingly.
Quite a bit has changed since then, and now coding is ‘like a second language’ to me. I don’t really need to put a lot of thought into how I will do something, just into how I can make it better, more efficient. I use a lot more print statements for error checking now than I did then, and they really do help pin point any problems. I don’t need to check line by line any more, since I am more familiar with whatever languages I use, so I usually can tell what is giving me trouble. As for asking friends for help, that is always good to do. Writing code is like writing a paper in the sense that you might over look errors because you wrote it. Later.
