With programming, the devil really is in the details! This applies to all languages, spoken or programming. Also, as programmers we’re an impatient lot; keen to get started designing and coding solutions. However, the wider your knowledge is of a given language, the more likely it is you’ll produce better code.
This article focused on three areas that typically produce a lot of coding errors and bugs: casts, call-by-reference, and inheritance. Numerical casts possibly remind us of endless math classes! However, correct numerical casts can help avoid some very difficult-to-find errors. Such errors may arise only as data sets grow beyond the level used during programming. However, if the correct numerical casting is done, the associated code is far less brittle.
Call-by-reference is another area that often causes problems. To succeed, just remember where to place your ampersand (&) character!
Finally, inheritance provides an excellent technique for creating very sophisticated and solid code. Although inheritance is an area that requires a good deal of upfront design in advance of coding, this upfront work is an investment that can pay dividends later when you see that your code is far more reusable.