Open ElectricRCAircraftGuy opened 4 years ago
Well, believe me, I feel you, but this code was basically written in one day for POC, the one who wrote it just had to add more features as the time went by and he did not keep in mind code readability, flexibility, etc.
The idea of open source is for you guys to not just use this project as is, but to also improving it. So you are more than welcome to suggest PR which we will review and push to this project (just like #14) :).
I will keep this issue open so more ppl will understand that this code is far from perfect and maybe even help improve this code.
you are correct. maorfr re-arranged the code beautifully and it is now the latest ver after his fix - I am closing this issue thanks for commenting
Now that I know you're willing to accept feedback and merge PRs from others, I'll see if I can find some time one of these evenings to go through it myself and keep on improving things.
Thanks all.
@giorakor, please re-open this issue. @maorfr made a great contribution, but I still see a ton to fix. I volunteer. You can assign me to this issue.
I consider this issue an "epic", which is larger than a "story", which is larger than a "task". Many PRs could be attached to it until it is complete.
PR #46 resolves a tiny portion of this issue
I was just skimming your Arduino source code here, for instance: https://github.com/AmboVent/AmboVent/blob/master/.Software/Arduino%20Code/ventilation_machine/ventilation_machine.ino#L208
and I notice your formatting doesn't follow best practices to maximize for readability, maintainability, and safety. I recommend you change the code now and follow best practices as you write new code to minimize changes in the future. Here's a few examples:
if
statement or any type of loop.Instead of:
Do:
But instead of that, even better, replace numbers and do this. Notice there's not a single "magic number" anymore. Everything is now named.
Instead of this:
Do this:
Those are just a few of dozens and dozens of examples. This is really important to avoid safety pitfalls in the software, accidental mistakes and bugs. Additionally, it makes the code easier for outsiders to contribute and learn.
Note also that as you code and learn, many many many MANY things will be preferences, and there are multiple good ways to do things. However, many things have established "best practices" which avoid bad patterns and unsafe code. Frequently, multiple best practices exist. The things I point out above are best practices and produce safer code. Some of the formatting regarding putting the opening curly brace on a new line or on the same line, and how many spaces to use when indenting, are personal preferences but should be standardized in a code base. Whatever you do, please follow best practices.