I think all computer programming can be divided up into two categories. One, code that is short but very tricky and two, code that is long and monotonous. Tricky code includes such things as sorting algorithms, where any small mistake in logic is a total disaster. SQL statements are notoriously tricky, sometimes you need a semicolon at the end and sometimes you don’t. One time I was helping a fellow programmer debug some networking code. He had mistakenly misread a variable read a lower case variable name “L” as a 1. It wasn’t a big mistake, but it still broke the functionality. Tricky code is harder to test because it was to work 100% correctly all of the time. For simple programs monotonous code tends to either run or not run, and that is all the error testing that it needed.
Monotonous code happens when you want to save a file to the hard drive. You know what you want to do, but there is a lot of error checking to be done. Is the hard drive full? Is the file name valid? How do you validate the file when you read it? Monotonous code wants to be lean and mean, but is bloated because of error checking or other requirements. Even though I say error checking “bloats” the code, error checking is very important. Another type of monotonous code is anything visual, like the user interface. Any decent visual interface (GUI) is at least 10,000 lines of code. I know all of those lines are needed, but the intent is just an interface, the product is tons of code that may or may not be manageable.
Hi
ReplyDeleteWhere are you learning these things? I always wonder about error checking for writing files, etc... but I can rarely find resources that are straight forward enough. The one CS class I took was too basic to cover real exception throwing and file handling.
If you have any links to useful online resources you love, please post them some time and I'll do the same!
z.