We all have gone through tough times as a beginner and if you are starting your coding journey then you can relate easily. Coding is not easy and beginners are prone to make mistakes, which are not obvious to them in the first glance. That’s why today we will list 10 mistakes beginner programmer makes. Knowing the mistakes can really improve you are a programmer and transit yourself from beginner to the intermediate stage much faster.
I have also tried to resolve some of the mistakes by providing solutions.
During my experience as a beginner(I still consider myself as a beginner), I saw some patterns and regular frustration that creeped me from time to time.
For helping my readers, I have decided to list the 10 mistakes beginner programmers makes. After reading the list, you can easily decide for yourself on which mistakes that need the most attention.
1. The Know All Attitude
We are humans and we are fragile. And, that’s why we try to over-estimate our ability and knowledge.
All of us have gone through this period of time. Coding is fun at the start, you will get tons of resources to fiddle with and there would be less frustration.
The internet is friendly to the beginner and hence the first few sessions with coding with be extremely pleasurable and less frustrating, leading to “The Know All Attitude”.
The only way to get over the attitude that only makes you learn less, in the long run. Another way to comprehend the reality is to see complex projects on GitHub and understand how much knowledge and effort it takes to build a decent project.
Taking to peers about their experiences can also lead to understanding the learning curve programmers go when they start out.
I am not against feeling good when starting off your journey, but keeping feet on the ground is the best way to approach learning anything including programming.
2. Doubt — Can I do it?
With “The Know All Attitude” out of the way, there is another reason why beginners slow their learn or reach their full potential.
The killer this time is “Doubt“. Programming is never easy and when coupled with doubt can cause disaster. The journey can be short lived or the learner can easily come to a conclusion of incompetency.
Doubt never works the way we intend to, only courage can solve problems. Computer Science is the field of solving problems and if you start doubting yourself, then how can you solve problems for a computer(Analogous to helping others, to love or help others we first need to help and love ourselves).
The best way to overcome the doubt syndrome is to get community help, seek friends that are at same level as yours. Watch inspirational movies and take a leap of faith.Failure is the first step to success.
Failure is the first step to success.
3. Non-Consistent Code Writing Style — A to 3 and Bingo
Writing Non-Consistent code is natural for beginners. . From the word consistency, I mean to say, the code must be well-structured, have proper indentation, have CamelCase notation for variable names, have proper commenting and much more.
Beginners are always prone to using the small case and large case variable names randomly, all over the code. The notion of consistent code writing style is important and always makes the life of others, who will read the code in near future, a little easier.
We always write code for humans and not the machine. Every code that you will write in your lifetime will be read by maintenance engineers or coders and they will find consistency helpful.
4. Bigger Functions are Better — Not!
Complexity makes us believe that we are intelligent, crazy and different from others. Though, complexity can be quite rewarding for many. But, According to Einstien, it is always better to find a simple approach.
This leads to bigger functions that include hundreds of lines. The biggers functions are hard to debug and maintain and there could be many instances, where a whole night could be spent on the code without finding any solution to the bugs.
The solution? Break it into multiple functions. No one hates readability and you will also find it easier to debug the damn whole code(which for mysterious reasons, doesn’t compile without error on the first try).
A great analogy that I can provide is “Writing in natural languages”. In this case, English. If I start writing the whole article and do not split the content into the paragraphs, it will be tough to read and understand.
Simplicity easily wins over complexity and its always better to write a code that is easy to debug and maintain in the near future.(Don’t even let the aliens think that we are stupid.)
5. Bad Function and Variable Names — InShort — Write for Humans
With functions into the discussion, it is quite natural for me to follow the same line of thinking. Functions are great, they are used to create a block of logic and then can be used in large to create usable programs or apps.
But, Functions looks great and feels better if their names are meaningful.
The idea is to tell you and the future maintenance engineers what your functions is going to do. And, yes that doesn’t mean you are going to write a function name 100 words long.
A function name, ToCalculateTheMeanOfTheSumOfEpicNumbers() is useless. It confuses others and you to in the longer run.
A better function name would be MeanSum().
Now, comes the turn of variable names. Variables names and function names are limited by the programming language you are using. Many programming language doesn’t let you start the variable or function name by underscore(_) or number.
On the other hand, creating a variable name that are short and gives the reader as much information as possible is necessary for high readability.
Recently, I have been active on HackerRank and solving some easy problems. I below code is written for solving the service lane problem.
//calulating the largest vechile def find_vehicle(entrypoint,exitpoint): the_final_array = arr[entrypoint:exitpoint+1] the_largest = 3 for each in the_final_array: if each < the_largest: the_largest = each return the_largest //taking input length, testcases = input().split() length, testcases = int(length), int(testcases) arr = list(map(int,input().split())) for i in range(0,testcases): entrypoint, exitpoint = input().split() entrypoint, exitpoint = int(entrypoint), int(exitpoint) res = find_vehicle(entrypoint, exitpoint) print (res)nd_vehicle(entrypoint, exitpoint) print (res)
If you read the problem and then the solution, most of the ideas will come to you naturally and that’s how the good code is written(I welcome any suggestion that can make the code better in any aspect).
6. Commenting and OverCommenting — Where is the comment?
A coin always has two sides and this is true for many ideas and concepts or behavior we come across through our daily life.
Commenting your code is necessary and highly rewarding if done right. And, there are two type of people who treat their code. The number one are those who do not comment at all. The other type, do comment, but overdo it by a large margin.
Both the signs are bad and complement each other. Commenting your code makes it easier to understand and sends the message in natural language to the reader. On the other hand, too much information can really make the situation ugly and unnecessarily complicated.
Slight use of humor in comments can work, but unnecessary writing an essay in comments is not at all recommended(unless needed).
For example, Variable += 1 // increment Variable by 1, is unnecessary and unsettling for others.
7. Half Baked Knowledge
Beginners generally fail to utilize the power of the programming language. The programming language comes with all the tools and techniques and it is fruitful for the beginner to learn at least one new concept on the daily basis.
Also, mastering a programming language takes time. So, it is always better to stick with the programming language for a longer period of time. Creating valuable projects can help you gain complete knowledge of the programming language.
8. Backing Up the Work
My friend recently came to my house asking me ways to restore lost work. Of course, there are some ways to restore lost work, but it never a good idea to not backup your work.
Machine are fallible, the hard disk can fail and so does your work. The best way to make sure that your work remains safe is to back up your work on regular intervals(2 days of me works or use GitHub).
Dropbox is a great cloud service that can make you save your work in no time. Drag and drop and it is uploaded to the cloud.
9. Not Using Pen and Paper
I am a big fan of pen and paper. My brain works better when I use the tools that I have been using for the past 20 years. The real advantage of using pen and paper is to get you start thinking and solve the problem before writing a single line of code.
Many beginners try to write the code without understanding the problem. That that spell disaster and they can easily lose time without making any significant progress.
Planning before proceeding is the key here. The basic things that you should keep in mind before starting to write down the code in your editor are as follows:
- Understand the problem requirements and limitation — The first crucial step is to understand the problem at hand. What’s the input and in which format? What is the desired output? What is the time-limit set for the program? and other tons of question that goes into your head, needs to be resolved before moving forward.
- DataStructure to Pick — The next biggest step is to pick up a data structure for your problem. Can a stack solve my problem or a list or better a queue? Experiment to find out the best possible data structure for the solution. Picking the best data structure is crucial for the performance of the solution.
- Think about any corner test cases — Testing your code is as important as writing the code in the first place. Make a Mental map or better write down the corner test cases that you can think of.
- Think of a rough working draft of your code — This works for me. Not exactly the code that works, but the code that can work and is as close to the solution(Sometimes you can hit bingo on the first try, but chances are less for complex problems).
- Break the problems into solvable pieces — For many programmers, easy problems can be done in the mind, but real-world problems are different and requires thorough planning.
Now, fire the editor and start writing code.
10. Not using proper debugging tool or IDE
Debugging is an essential part of programming. Debugging can be done manually or using a tool. The tool provides vital information regarding the errors or bugs that make the program not usable.
Using debugging tools or Integrated Development Environment can improve the way you write and debug code, improving productivity and satisfaction.
Programming is one of the rewarding trade out there. It can be frustration on many occasions, but many of us know the rewards and satisfactions it yields after successful execution. Today, I went through the 10 mistakes beginners programmers makes.
The list is in no way complete and the readers are encouraged to share their own experience. Beginners experience the world of programming differently and it is always best to make mistakes as fast as you can. Understanding that you are making mistakes fast can improve you in less time and make you a better programmer in a long run.
The idea of this post came into my mind when my friend asked me on how he can avoid making common mistakes. It’s very easy for beginners to fall in the trap of thinking that they are moving in the right direction and can lose precious time practicing odd habits and code writing habits.
So, do you think that the article is complete? Comment below and let us know. Also do not forget to tag your friends and share it with them. Share the love!