BusinessContinuity_0.jpg

NetConnect Blog - Your Resource For IT Tips, Tricks and News

Three Principles of Computer Programming and Life

Posted by Paul Staszko on Oct 23, 2015 2:19:04 PM

Programming ABCI think most people would agree that outside of the group of people that write software, many people do not have a clear idea of what is involved in the creation of software. As much as I’d like to teach the world to code, I am going to settle for sharing some of the guiding principles of programming. I also aim to find parallels with more relatable aspects of life, as these can be powerful concepts to harness.

Before I dive in, I will refer to code a few times. Simply put, software is a bunch of instructions for the computer to carry out. When programmers write these instructions, or code, we prepare documents with special languages and grammars that ultimately tell the computer what to do.  Now that you are a programming specialist, let’s review Three Principles of Computer Programming and how they apply to life in general.

  1. Don’t Repeat Yourself

For as simple as this point is, it is surprisingly relevant. Many, many times a programmer will need to instruct the computer to do the same thing in different parts of a program. It could be as simple as “If the value is blank, print out a 0” or as complicated as posting a batch of invoices. Since all of this code is just text in documents, it’s entirely possible to copy and paste the code wherever you need it. This principal warns us not to. If the code needs to change to fix a bug or add an enhancement, it has to be changed everywhere. Aside from being extra work to fix it in multiple places, you can miss one and end up with inconsistent behavior. Fortunately, pretty much every programming language allows us to code things in one place and refer to that as needed.

An everyday example of this would be a shopping list. In that case, the list is the program and you are the computer. It tells you what to do. You wouldn’t want to maintain multiple copies of the same shopping list. That would be a nightmare to keep synchronized and updated on all versions of the same list.

  1. Everything should be made as Simple as possible, but not Simpler

The above is a quote. Its origin is unclear, but the message isn’t. There is a minimum level of complexity involved in any task or description, be it programming or something else. If you make it simpler, it will be incomplete. The quote itself is a perfect example of this. It simply says what is broadly true while also acknowledging the exceptions.

If you want an example, observe the next conversation about where to go to lunch with your friends or colleagues. If they are anything like mine, it may be overly complicated. The simplest answer would be to have one person pick, but an obvious wrinkle would be the dietary restrictions of someone in the party. It would be nice for it to be ultimately simple, but it’s not. The best antidote for this issue is a solid understanding of the factors involved. This is true for lunch and software.

  1. The Principle of Least Astonishment

When designing a user interface or some code to be shared with other programmers, it is vital to present things in such a way that the user or programmer will be able to anticipate the behavior. Many times, this is as simple as using a clear naming convention or following common standards. This can be a tricky one, however, as we all see the world differently; some more differently than others. Your best bet is a good understanding of your audience.

This is a pretty broad one, but a simple example would be the gas and brake pedals in a car. It would be quite a surprise to find yourself driving a car with the two flip flopped.  The same confusion can occur if your software programming style does not conform to the common style of the programming language being used.

I hope this has given you a better idea of the types of things that rattle around in a programmer’s brain. Perhaps more interestingly, you might find that giving names to some of these ideas might help you notice and take advantage of them in your work and life.  If you’d like to know more about interactive services or how custom programming can help your business, contact Network Center, Inc.

NCI Contact Us Button

Subscribe to Email Updates

Recent Posts

Posts by Topic

see all