Defensive programming is the best !
I always liked defensive programming, it is very easy to do and it can solve major crashes that you're probably never expecting to happen...
It is very basic to set up, but it is very powerful in terms of anticipating crashes.
Here are a few examples :
if ( pointer != NULL )
{
do stuff;
}
void function(parameter*)
{
if ( parameter==null) return ;
now we can process the function because our pointer is probably valid.
}
these are 2 simple examples but you'll find them very useful in everyday's life of a code. And they work in every language !
Written by Patrice Krysztofiak
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Protection
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#