terça-feira, 22 de maio de 2012

Unreacheable code, can be "unthinked" code

It´s just a tip, not related to DB administration, but valid for all areas where the development can reach (including database). When programming, and the compiler warns you about an unreacheable code (e.g. warning CS0162: unreacheable code detected), don't use the pragma compilation instruction which tells the compiler to not to do its job: warn you! It's a bad decision because this means, in major cases, you make a bad algorithm. And against bad programming there is no such hardware power or enough memory. It will be always a heavy weight, maybe a failure or a breach to the security or a bug. But if it's unreacheable, how can it be a problem? What if a hacker change some status which make this part of your code to be reacheable (by tampering, or else)? Treat you code. It will reduce the cyclomatic complexity, become more "dry", and, who knows, more secure. 


Well, we know there are exceptions for almost everything, so, if that's the case, look how to use it in C#:
Pragma warning link: http://msdn.microsoft.com/en-us/library/441722ys(v=vs.80).aspx


Think! That's your job!

Nenhum comentário:

Postar um comentário