DEV Community

Cover image for Day 25-33: JS Calculator
Kemystra
Kemystra

Posted on

Day 25-33: JS Calculator

Procrastinated too much after the JS Calculator project, I should be more consistent.

The project

The aim is to build a calculator with Javascript, with the help of frameworks and libraries. I'd never actually build a calculator in any language before, so I'm not too familiar with its algorithm (and it certainly shows if you follow my Twitter lol).

This is the first project where I got to use Redux to manage states. There's too much boilerplate code to use it in small projects, but now I'm facing into this, might as well use it.

In total I used React, Redux, SASS, and FontAwesome. For math formulas evaluation, I use math.js library.

Result

Here it is:

What I learned from it

I'm still not good in programming

This project took me a week, and it revealed my weakness in problem solving in programming. It can be dark at times, but I have to understand that I still have a long way to go before being good enough in programming.

There's quite a lot that I didn't know. Algorithms and data structures, design patterns, programming paradigms, etc. These are tools that may help me in this project and other projects in the future.

In a nutshell, more learning is absolutely necessary to thrive in this field where competitions are fierce and people come and go.

Never underestimate a project's complexity

Upon seeing a problem, I pulled the keyboard, opened VSCodium, and started typing away. This is honestly a bad practice of mine. Getting stuck midway is a punch to the face that I deserve for my ignorance.

A good problem solver would approach a problem with caution and an eagle eye, so that they can spot weird edge cases or possible bugs ahead of time. And no, that's not me. I simply head-dive into the problem, only to be completely bugged later.

As such, I learned that a proper planning prior to actually writing code is necessary. You don't want to get bugged, do you?

React's logic separation is actually good

Yeah I understand now why React do this. The idea of isolating UI code and the logic really does come easy to me. There's not much to say about this LOL.

Pay attention on package version requirement

Although FreeCodeCamp doesn't enforce this, their unit tests only supports certain keywords (e.g: ReactDOM.render) that are not up-to-date to React 18. This one tied my development for a week, and a simple package version warning would have made this a lot easier.

Afterwords

Calculator JS was, and still, the biggest project that I have finished. It's hard but it's worth it. Now that I realize my weakness, I can work to improve myself to be a better developer.

Follow me on Github!
Also on Twitter!

Discussion (0)