9 classic mistakes to avoid when you're a junior web developer

 


A junior web developer can code really fast, but will often make many more mistakes. Some errors in logic can be, but especially methodological errors, which can waste a lot of time and make the maintenance of the application much more difficult. The mistakes of a junior web developer are often the same: lack of planning, refusal to give up, etc.

We relied on an article published by a web design company in Pakistan to offer you a tour of the 10 classic mistakes of a junior web developer. A must-read for any junior web developer, but also for the people who work with them.

1) Write the code without planning anything

In general, high-quality editorial content cannot be created easily. It requires careful thought and research. The creation of computer programs is no exception. Writing quality programs is a process where you have to take steps: think, research, plan, write, validate, modify. Unfortunately, there is no good acronym for this.

One of the most common mistakes as a newbie programmer is starting to write code without much thought and research. While this might work for a small standalone app, it does have a negative effect on larger apps. Just like you need to think before you say something that you might regret, you need to think before you code.

Coding is also a way to communicate your thoughts. Programming is mostly about reading the previous code, finding out what is needed and how to fit it into the current system, and planning to write functions with small additions. The actual writing of the lines of code is only 10% of the whole process. Programming is a creativity based on logic not just lines of code.

2) plan too much before writing the code

Yes, planning before you dive into writing code is good, but even good things can do you a disservice when you overdo it. Don't look for a perfect plan, it doesn't exist in the programming world. Your plan will change along the way anyway, but what it's good for is forcing you to stay structured. This leads to more clarity in your code.

Too much planning is a waste of time. We're only talking about planning for small features. This is what we call the waterfall approach, which is a linear plan with separate stages that must be completed one by one.

Writing programs should be reactive activity. You'll add features you never would have thought of in a waterfall plan. You have to fix the bugs and adapt to the changes. However, you should plan your next features to a minimum. Do this very carefully because too little planning and too much planning can adversely affect the quality of your code. You have to choose the right dosage.

3) Underestimate the importance of code quality

If you can only focus on one aspect of the code, it should be its readability. An unclear code will go straight to the trash. Never underestimate the importance of code quality. Your main job as a coder is to clearly communicate the implementations of all the solutions you are working on. Even the little things matter. For example, if you are not consistent with your indentation, you should just stop the code.

Another simple thing is the use of long lines. Anything over 80 characters are much more difficult to read. You might be tempted to put a long condition on the same line to keep a block more visible, that's a mistake. Never go beyond the 80 character limit. Lots of simple problems like this can be easily solved with formatting tools. In JavaScript, we have two great tools that work perfectly together: ESLint and Prettier.

4) Choose the first solution

While the first solution you find can be tempting, the best solutions are usually discovered as soon as you start to look at all the possible solutions. If you can't find more than one solution to a problem, it's probably a sign that you don't fully understand the problem. Your job as a programmer is not to find a solution to the problem, but to find THE easiest solution to the problem. By "simple" we mean that the solution must work well and perform well, while still being simple enough to read, understand and maintain.

5) "Non-abandonment"

Another common mistake is to stick with the first solution even after identifying that it may not be the easiest approach. This is probably psychologically related to the “no-give up” mentality. It's a good mindset to have in most activities, but it shouldn't apply to programming. In fact, when it comes to programming, the “right” mindset often fails. As soon as you start to doubt a solution, you should consider rethinking the problem, no matter how much you have invested in that solution. Source control tools like GIT can help you experiment with many different solutions.

6) Don't use Google

There are surely times when you have wasted time when you could have searched for the solution on Google. Unless you are using cutting edge technology, when you have a problem there is a good chance that someone else will encounter the same problem and find a solution. Save yourself some time and use Google. Sometimes Google reveals that what you thought was a problem isn't really, and what you need to do is not fix it, but rather adapt it. Don't assume that you know everything about choosing a solution to a problem. Google will surprise you. However, be careful what you search for on Google. Another sign of a beginner is copying and using code as is without understanding it. Although this code may correctly resolve your problem,

7) Plan for the future

It is often tempting to think beyond the solution you write. All kinds of scenarios will pop up in your head with every line of code you write. But it would be a mistake to use this in each case. Don't write code that you don't need today. Writing a feature because you think you might need it in the future is just pointless. Always write the minimum amount of code that you need today for the solution you are implementing.

8) Not using the right data structures

When preparing for interviews, novice programmers usually put too much emphasis on algorithms. It's good to identify good algorithms and use them when needed, but memorizing them won't help your genius. However, memorizing the strengths and weaknesses of the different data structures that you can use in your language will certainly make you a better developer. This article is not intended to teach you about data structures.

Do not use stacks

When writing code that requires some form of recursion, it is always tempting to use simple recursive functions. However, it is generally difficult to optimize recursive code, especially in single-threaded environments. For example, optimizing a recursive function that returns two or more calls to itself is much more difficult than optimizing a recursive function that simply returns a single call to itself. What we tend to overlook as newbies is that there is an alternative to using recursive functions. You can just use a stack structure.

9) Don't write tests

If you think that you are an expert programmer and that your thinking gives you the confidence to write code without testing, you are a beginner. If you don't write tests in code, you'll probably be testing your program in another way, manually. If you are building a web app, you will refresh and interact with the app after each line of code. There is nothing wrong with manually testing your code. However, you must manually test your code to determine how to test it automatically. If you successfully test an interaction with your application, you should go back to your editor and write code to automatically perform the same interaction the next time you add code to the project. You are a human being. You will forget to test all previously successful validations after each code change. Let a computer do it. If you can, guess or design your validations first before you even write the code to satisfy them. Test-Driven Development (TDD) isn't just a “hype”. It positively affects how you think about your features and how to create a better design for them. TDD isn't for everyone and it doesn't work well for all projects, but if you can use it (even partially) you should. Test-Driven Development (TDD) isn't just a “hype”. It positively affects how you think about your features and how to create a better design for them. TDD isn't for everyone and it doesn't work well for all projects, but if you can use it (even partially) you should. Test-Driven Development (TDD) isn't just a “hype”. It positively affects how you think about your features and how to create a better design for them. TDD isn't for everyone and it doesn't work well for all projects, but if you can use it (even partially) you should.

Comments