Programming is an art. Anyone who needs proof of this fact should look at how coders view their mistakes. New or inexperienced programmers often fail to recognize the mistakes they make while coding. What they notice is the time it takes to code and debug their algorithms. If you have programming homework or need to know about the essential programming mistakes to warn students about, this article will give you some helpful tips and information.
Just as people have different opinions about poetry, writing, painting, and other forms of art, the world of coders tends to disagree about most things, except for the need for code to run without crashing. Some programmers, however, are okay with crashing code as long as it recovers quickly before users notice. Experienced programmers would disagree with this point of view.
Students need to learn about the common coding pitfalls to transform their skills into an art. Some of the most important mistakes to warn students about include:
1. Overlooking the Basics
Playing it fast and loose is one of the easiest ways to weaken your code. Every programming student needs to understand that random user behavior can affect a program. They need to determine whether the input of a zero, for example, will lead to a division operation. Essentially, they need to understand that the smallest mistake can cause a program to fail.
Some inexperienced coders use the error-catching element of their code to hide their mistakes. They deposit errors to a log file, generate an error code, and leave others to deal with the problem. Students should learn about and avoid this serious coding mistake.
2. Focusing too Much on Detail
On the other hand, code that focuses too much on detail will slow to a crawl. Your code should not behave like a person with OCD who must check all windows and doors multiple times before going to bed. Sometimes, excessive dedication to detail will lock up your program if it goes to the point where it requires frequent communication with a remote site over the network.
3. Complicating Control
Often, inexperienced coders make the mistake of complicating control over certain tasks in their program. OtherInBox.com co-founder, Mike Subelsky, insists that there should be only one place in the program for each task. If you assign two places, someone will probably change one and leave the other one untouched.
If more than two places exist for a particular job, the chances of them working in the same way are even worse. Students need to learn the importance of the single responsibility principle and stick to it in their code.
4. Trusting the Client Device too Much
Many of the most dangerous bugs appear when programmers trust the client device to do the right thing. If you write your code to run in a browser, for example, the browser can rewrite it to execute random actions. If you fail to double-check all the incoming data, things can go wrong quite fast.
Some security attacks happen because the coder simply transferred client information to the database, which is fine until the client sends SQL instead of a suitable answer. Hackers can easily abuse the trust given to the server to gain unauthorized access and/or corrupt software.
5. Failing to Trust the Client Enough
Sometimes, being obsessive in terms of security can actually create gaping holes. It can slow down programs to a crawl, forcing programmers to loosen some of the strict security features to speed up processes. Trust can save you when it comes to web forms. Long personal data forms, bank-level security, and email address confirmations discourage users from taking part. However, protecting such data after culling and storing it can prove to be more trouble than it is worth.
6. Trying to Reinvent the Wheel
Some programmers try to write their own libraries simply because they believe they know a simpler or better way to do it, which often comes back to bite them. This is the same as making your own yoghurt. When trying to prevent others from exploiting or finding weaknesses in their programs, even expert coders make mistakes. The libraries you use while coding do not need to be perfect. The solution to this problem is risk management.
7. Closing the Code
It is difficult to determine how much of your code to share with the people using your program. Closing the code/source can work against its integrity. It is the easiest way to discourage the discovery and fixing of bugs, in addition to preventing innovation. If you open it, however, people you do not even know will contribute to its improvement, add features, find bugs, and try to fix them.
When a programmer insists that doing something is a mistake, his/her opinion usually stems from experience. Maybe someone around the office did that specific thing and things went terribly wrong. At the time, it probably seemed like a good idea, but it was a mistake and now the programmer wants to warn others about it.
Become a more social person