-->

Common Coding Mistakes

When you start something new you’re inevitably going to make Common Coding Mistakes, this is purely down to inexperience and those mistakes are great teachers in themselves. However, even experts make the occasional mishap. Thing is, to learn from them as best you can.

X=MISTAKE, PRINT Y


There are many pitfalls for the programmer to be aware of, far too many to be listed here. Being able to recognise a mistake and fix it is when you start to move into more advanced territory.

Small Chunks


It would be wonderful to be able to work like Neo from The Matrix movies. Simply ask, your operator loads it into your memory and you instantly know everything about the subject. Sadly though, we can’t do that. The first major pitfall is someone trying to learn too much, too quickly. So take coding in small pieces and take your time.

//Comments



Use comments. It’s a simple concept but commenting on your code saves so many problems when you next come to look over it. Inserting comment lines helps you quickly sift through the sections of code that are causing problems; also useful if you need to review an older piece of code.


Easy Variables

Common Coding Mistakes Easy Variables
Common Coding Mistakes Easy Variables


Meaningful naming for variables is a must to eliminate common coding mistakes. Having letters of the alphabet is fine but what happens when the code states there’s a problem with x variable. It’s not too difficult to name variables lives, money, player1 and so on.

Plan Ahead

Common Coding Mistakes plan ahead
Common Coding Mistakes Plan Ahead


While it’s great to wake up one morning and decide to code a classic text adventure, it’s not always practical without a good plan. Small snippets of code can be written without too much thought and planning but longer and more indepth code requires a good working plan to stick to and help iron out the bugs.


User Error

Common Coding Mistakes User Error
Common Coding Mistakes User Error


User input is often a paralysing mistake in code. For example, when the user is supposed to enter a number for their age and instead they enter it in letters. Often a user can enter so much into an input that it overflows some internal buffer, thus sending the code crashing. Watch those user inputs and clearly state what’s needed from them.

Re-Inventing Wheels

Common Coding Mistakes Re-Inventing Wheels
Common Coding Mistakes Re-Inventing Wheels


You can easily spend days trying to fathom out a section of code to achieve a given result and it’s frustrating and often time-wasting. While it’s equally rewarding to solve the problem yourself, often the same code is out there on the Internet somewhere. Don’t try and re-invent the wheel, look to see if some else has done it first.

Help!

Common Coding Mistakes Help
Common Coding Mistakes Help


Asking for help is something most of us has struggled with in the past. Will the people we’re asking laugh at us? Am I wasting everyone’s time? It’s a common mistake for someone to suffer in silence. However, as long as you ask the in the correct manner, obey any forum rules and be polite, then your question isn’t silly.

Backups

Common Coding Mistakes backups
Common Coding Mistakes Backups


Always make a backup of your work, with a secondary backup for any changes you’ve made. Mistakes can be rectified if there’s a good backup in place to revert to for those times when something goes wrong. It’s much easier to start where you left off, rather than starting from the beginning again.

Secure Data

Common Coding Mistakes data
Common Coding Mistakes Data


If you’re writing code to deal with usernames and passwords, or other such sensitive data, then ensure that the data isn’t in cleartext. Learn how to create a function to encrypt sensitive data, prior to
feeding into a routine that can transmit or store it where someone may be able to get to view it.

Math

Common Coding Mistakes math
Common Coding Mistakes Math

If your code makes multiple calculations then you need to ensure that the maths behind it is sound. There are thousands of instances where programs have offered incorrect data based on poor Mathematical coding, which can have disastrous effects depending on what the code is set to do. In short, double check your code equations.

0 Response to "Common Coding Mistakes"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel