3 ms·
I found that when software programming, one of the best practices was to work hard to avoid writing code (and this isn't about cleverly writing 3 line functions
by toss1 4y ago
I found that when software programming, one of the best practices was to work hard to avoid writing code (and this isn't about cleverly writing 3 line functions in one line or such).
The goal was to really think about what code is really necessary, and how the thing can be designed, structured, or architected to require the least writing of code.
Of course, in the end code must be written, but I always keep in mind two thing:
Where do bugs live? In code - every statement is more habitat for bugs.
What is the fastest optimization of any process (software or physical)? Eliminating steps. An unnecessary step eliminated is a 100% optimization.
This thinking approach is valuable in other areas too. As I was learning about club sportscar racing, a coach asked me "what are the things you do that slow you down?". I thought and started an answer about brake & shifter footwork while entering a turn... and he said "No, no, the really big basic things"... "like braking and turning?"..."Right; braking and turning. What does that mean? That you should avoid braking and turning at all times".
Obviously, the point is not to be taken literally as you'll run out of road at the end of the first straight and have a very slow lap time. The point is to really think about how every little bit of applying the brake and steering inputs will slow you down, and if you can eliminate or minimize even a few, you'll be ahead.
And in a completely different field, I remember an interview of a famous film director (I don't remember who) who said that in a great film, every syllable had a specific purpose. If it didn't serve a purpose to the plot or character development, it should be cut.
Obviously, we must in the end write code to get the machines to do anything; but do we really have to write that next few statements, or can that goal, feature, or function be met otherwise with some extra planning and thought?