Re:Learnings from 5 years of tech startup code audits
by lupire on Thursday May 26, 2022 @10:18AM
(#31518616)
> If you have hundreds of conditions, a tree of if's becomes impenetrable.
I mean, it worked for Amazon. I saw the code.
Re:Learnings from 5 years of tech startup code audits
by goto11 on Thursday May 26, 2022 @11:10AM
(#31519286)
Fair enough, but you probably wouldn't call is simple.
Re:Learnings from 5 years of tech startup code audits
by commandlinefan on Thursday May 26, 2022 @11:29AM
(#31519565)
> a tree of if's becomes impenetrable
Even in that case, a tree of if's isn't that bad (it's not great), but far worse is when you have the same set of if statements copied and pasted around dozens of places. Because you will forget to update one of them at some point.
If you have seven conditions driving a decision, a bunch if's might be the simplest implementation. If you have hundreds of conditions, a tree of if's becomes impenetrable. There is no one-size-fits-all when it comes to simplicity.
Some problems are inherently complex. You can't design a payroll system or tax calculation system which is simpler than the set of rules and regulations it has to implement.