Tuesday, February 13, 2024

Writing Your First Computer Program

I have someone that I am working with and we need to write a complex computer program. We have settled on Python as the computer language and we get together frequently to work on the code together. While I have done some programming using Python, I am by no means an expert. Basically I know enough to be dangerous.

If I had 30 years slashed from my age and just started writing software, I would start with Python as it is such a good language to do a lot with using a minimal amount of code. That makes the programs easy to write and easy to understand. The only problem is that there are quite a few libraries to learn. Without the help of the Internet to help you look up possible solutions, doing anything useful in Python might not be so simple.

My coworker and I have a rather complex problem we are trying to solve but have broken it down into very simple pieces. The first thing we want to do is take an e-mail address and modify it. It didn't take that long to write the code. Next we expanded our problem so that we passed in multiple e-mail addresses and did the same modification to all of them. Then we worked on saving the results into a database. We have continued adding pieces to our code to ultimately get the program we need.

Our code writing is an iterative approach. We focus on one task and make sure the task is completed as designed before moving onto the next item. When we got the code modifying e-mail addresses and writing them into the database, my coworker felt a huge sense of accomplishment and thought we could be done. Today I reminded him that there are still a few more steps we need to do before we can say we have completed everything.

Should you decide to give coding a try. Here are these simple steps put into an easy-to-follow outline:

  1. Write down what you want your program to do. This is often called a specification or spec.
  2. Break the task down into very small steps.
  3. Write the code for each step in the process and test it to make sure it works before moving to the next step.
  4. When you think you are done, go back to your specification to make sure you have completed what you said you would.
Interestingly enough, these are the same steps to follow in trying to accomplish any goal you have. They work for more than just writing computer software.

No comments:

Post a Comment