The Aristotelian Approach to Writing Good Programs: Logic as the Foundation of Code
6 points by l0b0
6 points by l0b0
I think this runs into a common trap I see with a lot of “math for programmers” writing: math may have inspired the writer, but you don’t need math to get the same ideas, and you don’t need math to apply them either.
These are the article’s logic takeaways:
A = A
–> use precise names!(A && !A)
–> make sure data is validNone of the takeaways, though, need math to motivate them! Everything (except maybe (4)) are all considered good programming practice, and we came to that through regular experience, not reasoning from math.
I think about this a lot because [plug] I’m writing my own book on logic in programming, and one of my key goals is to maintain a very strong connection between the math and the practical applications. For example, instead of !(A && !A)
being “about” data validation, it’s about conditionals simplification and elimination. I think this is a better approach for motivating the value of logic, though it takes a lot more effort.
(Funnily enough data validation does come up, but instead it’s in the context of functional specification.)