Hi @sitek94, great project.
also I implemented some additional functionality like
Maybe I’m wrong but I think this is a case of feature creep
[0].
If you look at this graph[1]
You can see that the tests doesn’t cover everything, so, I think in this case, is probably better to (write more tests or) test more, than add more features.
but the file itself is rather long and I’m not sure if it would make sense to other developer reading the code.
By reading your code I think that you are following an event-driven approach[2], so, I don’t know if it possible to really change the structure of the code:
1.- In an event-driven approach you need the if-else (I think, I not sure)
2.- The calculator project has many parts and some of them are interconnected
3.- If you look at the graph above, I had to identify one by one all the cases that I wanted to cover (just like your project)[3]
4.- What exactly do you want to change? or this is more of an aesthetic problem?
Any ideas on how to keep the code better organized? I feel like I’m creating a little frankenstein at the moment, one new thing added breaks something somewhere else…
I think that the customary answer is “write more tests, test more and refactor(iterate)”
Cheers and happy coding
Notes:
[0] Feature creep - Wikipedia
Feature creep is the excessive ongoing expansion or addition of new features in a product … These extra features go beyond the basic function of the product and can result in software bloat and over-complication
[1] This graph is part of my JavaScript calculator
project, and I also wrote the “glue” that generate the graph (I am not a professional programmer), so take this with a pinch of salt.
[2] I wrote a blog post about this:
Problem Solving: Bottom-up approach
[3] I uploaded some videos of my process writing the project:
https://www.youtube.com/playlist?list=PLEJxzxnNnYoXwxC_aug3aY6sCTEbQxwPW