4 ms·
Unless I really need the performance, I avoid being "clever" when coding. The simple non-2 star example is going to be a lot faster for someone to understand, m
by chrisbennet 14y ago
Unless I really need the performance, I avoid being "clever" when coding. The simple non-2 star example is going to be a lot faster for someone to understand, maintain and debug in the future.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." --Brian Kernighan
- nicholassmith 14y agoBeing clever when coding is one of the biggest headaches for long term maintenance unless you really really need that extra performance. I've had to do a bug hunt on a piece of code recently that was very, very clever but used all sorts language features that are marked 'use with caution' when a longer function with more simplicity would have worked as well. Readability and maintainability trump developers showing how clever they are by far.
- deleted 14y ago[deleted]
- damian2000 14y agoCame here to say the same thing. It would also result in more work for the original programmer, since they would be asked questions about how it works from other (non-2 star) programmers.
- capisce 14y agoWhether it's faster or slower to understand depends on how well the reader is able to grasp abstraction and pointers. For some the latter code might be more readable since it has less special cases.