4 ms·
Most of them are awesome, but some are questionable. > don't add flags/Boolean parameters to your functions. Many languages have strongly-typed enums for them
by Const-me 7y ago
Most of them are awesome, but some are questionable.
> don't add flags/Boolean parameters to your functions.
Many languages have strongly-typed enums for them, makes calling code readable, e.g. getUserMessages( user, eMessageFlags.Full ). Especially useful for more than 1 flags.
> ALWAYS use timezones with your dates
UTC usually does the trick?
> UTF8 won the encoding wars
UTF8 used on the web a lot, but OP seems to be generalizing their experience over all programming, not just web development.
> when your code is in production, you can't run your favorite debugger.
No but I can run my second favorite, WinDBG. A crash dump .dmp file is often more useful for fixing the bug than any reasonable amount of logging.
> Optimization is for compilers
Compilers are not that smart. They never change RAM layout. I've recently improved C++ project performance by an order of magnitude replacing std::vector everywhere with std::array (the size was fixed, and known at compile time). Before I did, profiler showed 35% time used in malloc/free, but the cost of vectors was much more because RAM latency.