One of the main processes in my field is computer programming or “coding.” For much of society, computer programming is foreign and seems challenging. However, following the process of coding, makes computer programming simpler and easier to understand.
The first step to producing a quality program is to identify and understand the problem at hand. The reason you are writing a program is to solve some type of problem, and make someone’s life easier. For example, a business owner may say that he/she needs to figure out a way to keep track of all their company’s sales. He/she might want to know what the average sales of each weekday is, which month they get the most sales in, and who is the top salesmen. The programmer will need to ask the owner specific questions to clarify details and understand exactly what the end goal of the program is.
If the programmer started writing the code immediately after understanding the problem, they wouldn’t be successful. Without a plan of action, the programmer would not know where to start and it would take him/her much longer to write. To solve this issue, the next step to writing a program is to create an outline. A main part of outlining the program includes breaking the solution into different classes and methods. For this example, you could have one class that calculates the average sales of each weekday, one class that figures out which month gets the most sales, and another class that determines who is the top salesman.
The next part of the second step is to write pseudo-code. Pseudo-code is informal writing of a program in English, to describe what each section of the code should accomplish. This is a helpful step, allowing the programmer to think logically, without letting the syntax of the programming language impede. Once the pseudo-code is complete, the programmer will begin to code in whatever computer language they choose.
Many new programmers will try to write a whole program at once, without setting up a tester class at the beginning. One way I think the process of writing code can be improved and made easier, is to test the program you are writing continuously, starting at the beginning. If you sit down and write code for four hours and don’t test it at all, many logical and syntax errors will likely exist in the program. You may have a logical error right at the beginning, but it will be hard to detect since it was so early in the process. After I write a section of my program, I test it immediately to ensure that it is functioning properly.
The next step is the combination of compiling and debugging the code. Compiling the code converts it into binary numbers (1’s and 0’s), so the computer can understand it. The compiler will print syntax errors if you don’t write “correct” code. Syntax errors are like grammar errors in English, you may have forgot to insert a colon or a parenthesis. When the compiler produces an error, you need to go back and “debug” your code. Most of the time the compiler will give you a specific line where the error is found, making the process of debugging much easier. The process of compiling and debugging the code repeats itself until the compiler comes back with no errors.
You may think the process is complete at this point, however, one more important step remains. You must ensure that the program is functioning the way you intended it to. The compiler can detect syntax errors, but it can’t detect logic errors. Logic errors are written with correct syntax in the programming language, but they result in an undesired output for your program. This means that the programmers thought process on writing the code was incorrect and needs to be changed to correctly solve the problem.