Why Build a 4 Function Calculator?

One of the things I tell all the kids who work with me to do is to create a 4 function calculator. Only a small handful of kids have ever followed my advise. Even after hearing why, they don’t want to put the work into it. This is a concerning trait for a fledgling programmer but that is a different post.

Why would anyone bother with a 4 function calculator? Just use the one that comes with the computer or phone.

This kind of thinking is the core problem. Ever single kid thinks that the purpose of the project is to make a calculator. It is not. The main purpose is to blood the developer in the new language or concept. So many kids come out of school with only a procedural understanding of how to write code. For the life of me, I don’t know why but they teach object oriented programming as a series of definitions and not the central tenet of your professional career. Talk about a disservice.

Ok, so you want the kid to get a tiny bit of experience. They will get that on their first program.

That is how many young programmers get exposed to coding for the first time. The issue with such a plan is that you don’t intuitively understand the problem domain. Every single developer can operate the four functions of a calculator. Not only that but they fundamentally understand what needs to be done. Using your first project and the business owner as the practice group is not ideal. You want to separate the learning of the technology and the learning about the problem. If you don’t then you can easily get overwhelmed because you have no foundation and are battling on both fronts.

Fine, make a practice program. Why not a music catalog or a recipe organizer?

Again, it comes down to already knowing how the program should go together. You want to not struggle with one portion of it. For instance, if you want to learn Unit Testing then focus on the concept of unit testing and program it in a language you already know by heart. That way as you debug you know where the problem is and where it is not. If you are learning PHP, then you can focus on the language and not the design. You already have a template after the first time.

Now as for why not a music catalog or a recipe organizer? You want the program as small as possible. Small enough that it is just an afternoon’s work. You want to create and work with objects, receive and send data to the GUI and build a GUI. You get all that in a tiny package.

Additionally, if you need a bigger project because the concept requires it, you can do a fractional calculator or Reverse Polish one. Alternatively switch it to binary or hexadecimal. The options are truly limitless.

Finally, it gives you a domain that you can share with younger developers when the time comes to pass down your knowledge. At last, we have a topic that could bring boomers and the post millennials together.

Leave a Reply

Your email address will not be published.