16 ms·
I'd make the following addition, which I was surprised not to see: 24: Avoid the 'inner-platform effect' [0] Make proper use of the machinery of the standard
by MaxBarraclough 8y ago
I'd make the following addition, which I was surprised not to see:
24: Avoid the 'inner-platform effect' [0]
Make proper use of the machinery of the standard library.
This makes your code more readable, more portable, shorter, faster, and less error-prone, and it doesn't even take any real effort - indeed, it makes writing things easier!
The standard-library was probably written by someone smarter than you, almost certainly someone more familiar with the language than you, and it's definitely better tested, better documented, and, importantly, better known, than whatever you were about to write. This is a pretty basic point, perhaps, but most of them are.
Special case: use standard-library data-structures. If you're implementing your own hashset over a raw array, rather than using the standard HashSet class/template, you'd better have a very good reason.
[0] https://en.wikipedia.org/wiki/Inner-platform_effect https://en.wikipedia.org/wiki/Inner-platform_effect
- kaltherX 8y agoIsn't this #9 Prefer internal functions over custom solutions?
- MaxBarraclough 8y agoOops, I missed that! Yes, it's pretty close. I don't like the look of #10. I'm a believer in single-point-of-return.