Day 32: Calculator Project Planning

Started working on the calculator project. I have built a calculator before and the key problem was managing state at different stages of the user’s input. I want to really address this problem using a method that I can apply to other future projects as well. I am thinking of designing a diagram to represent the options available at each step of a calculation. I don’t know how this will look but writing it out first should help.

TLDR;

Okay, so here are the highlights of what I did:

  • Practice -> Started working on the calculator project provided in the “The Odin Project” Fundamentals course. I wrote the basic HTML outline for the UI and started working on the design of the calculator’s underlying code.

Rough Planning notes:

How can I ensure there are less bugs with:
  1. Chaining operations
  2. Adjusting operators

In most calculators one math operation is evaluated at a time.
The basic math operation involves 4 steps:
  1. Input the first number
  2. Input the operator
  3. Input the second number
  4. Press "=" to perform the math operation by applying the operand to the first and second number.

Although that is the generic process, there are a few extra options available at each step
that will impact the operation.

Options while inputting the first number:

  - Add a decimal place (only allow one)
  - Add leading zeros (bad)
  - Backspace (correct input - Bonus)
  - Clear (reset the calculator - global)

Options while inputting the operator:

  - Change the operator
  - Pressing the operator button multiple times (Should just change the operator)
  - 

Options while inputting the second number:

  - Add a decimal place (only allow one)
  - Add leading zeros (bad)
  - Backspace (correct input - Bonus)
  - Clear (reset the calculator - global)


Goal For Round 7 of the #100DaysofCode Challenge

This is my seventh round of the “#100daysofcode” challenge. I will be continuing my work from round five and round six into round seven. I am currently working through the book “Cracking the Coding Interview” by Gayle Laakmann McDowell. My goal is to become more familiar with algorithms and data structures. This goal was derived from my goal to better understand operating systems and key programs that I use in the terminal regularly e.g. Git. This goal was in turn derived from my desire to better understand the fundamental tools used for coding outside of popular GUIs. This in turn was derived from my desire to be a better back-end developer.

I have no idea if my path is correct but I am walking down this road anyways. Worst case scenario I learn a whole bunch of stuff that will help me out on my own personal projects.