In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you what mistakes you can make when programming. The content is concise and easy to understand. It will definitely make your eyes shine. I hope you can gain something from the detailed introduction of this article.
In order to have a repository that looks good, you should have regular operations that provide real-time versions of available projects, and show only a few projects you are proud of, rather than every line of code you have written.
These are the basics of repository maintenance, and sooner or later someone will look at your code to see if you fit in with the company. The recruiter will decide within minutes whether it is worth inviting you for an interview. This is both good news and bad news.
The bad news is that an obvious mistake can cost you a job; the good news is that people don't want to dig deep into your code. They want a general understanding of your code and architecture. You don't have to be brilliant, as long as you do the job well.
Here are some common mistakes that junior developers make. If you can avoid these mistakes, you will get more interviews.
Obsolete comments
Programmers differ on comments. It's hard to agree on whether or when to comment code, but everyone agrees on one thing: if you comment, it should correspond to your code.
Comments are used to explain code. When you write complex or unclear code, comments can help readers understand it. But remember, if you change the code, change the comments accordingly. Otherwise comments will not help but mislead, and there is no worse programming error than misleading. A bad comment is worse than no comment.
Even worse, comments in the code stand out. Modern IDEs color comments differently from other code, and comments are easier to spot. Add comments, and the "readme" symbol is added to the code. So any differences between comments and code are easy to spot. Choose your comments wisely and remember to update them as your code updates.
Combine libraries and languages using the same use cases
Before my first interview, I need to complete a recruitment assignment. It was a simple web application, so I wrote some code, googled some of the trickier parts, and finished writing the app.
During the interview, the recruiter asked me why I mixed jQuery code with pure JavaScript code, and I couldn't answer. The truth is, I pasted a few snippets of code without much thought, and after seeing that the code worked, I moved on.
This error is common among junior developers. We're so focused on solving tasks that we don't take the time to think about what we're doing. Don't fall for this novice trap, remember to check every line of code to make sure you know why you put it there.
duplicate code
Don't Write Repeat Code (DRY) is the law of programming. Creating abstract mechanisms for repeating code is the essence of programming. But at first, it's often challenging. You want to solve the problem, so do what you can. Then you move on to other tasks, and you keep writing duplicate code. Believe me, you can do better.
Develop good habits early. Every time you complete a feature, reread the code and think about whether there is an opportunity to refactor something. Remember, the first version of the code is flawed and you need to improve it.
Also, take the time to analyze duplicate code while you're working on other features. You almost always find room to rewrite it (for example, using a loop or creating a new function). If you improve yourself this way every time, you will write more robust and elegant code.
No error handling
It is almost impossible to build any meaningful application that always works perfectly. Errors occur whether you are putting data into a database or making API calls. Unhandled errors can prevent not only the execution of individual functions, but even crash entire applications.
Anticipation of possible errors is the hallmark of a competent programmer. As long as you are accessing or updating some external data, you must be prepared for the worst. Dealing with potential bugs can make your application stronger, while also enabling future developers (possibly yourself) to spot bugs quickly. This shows the recruiter your holistic view of the code.
lack of consistency
Consistency is a hallmark of good software. It makes the code easier to read and maintain. Uniform code is easier to predict and easier to reason about, so you should do this as much as possible. Consistency is difficult to achieve at higher levels of abstraction. It takes many years to master, and you should start learning as early as possible.
Remember to name things in only one language. Usually English, but in personal projects you can name variables and functions in any language you want, as long as it's always the same language.
It doesn't matter if you use tabs or spaces, as long as they're consistent. Because it's the same with the camel case or the snake case. Both are great, but you have to pick one. You need to create or choose a style guide and stick to it. You should also use tools like Prettier, which is a standard in professional environments and makes maintaining a consistent code format manageable.
Whatever tools and styles you use, make them second nature to you. Even bad code is usually better than inconsistent code because it's easier to fix.
Lack of knowledge of tools
In a typical project, some external libraries need to be used fairly quickly. Many programmers install some libraries almost automatically because they are used in every project.
External libraries are great because they solve recurring problems in proven ways. However, junior developers often don't understand the libraries they're working with and end up stacking one library on top of another or re-implementing some existing functionality.
Perhaps the most common misconception about modern web development is that Redux is used in every React project. Although Redux has a few use cases, in most small projects React is sufficient.
Each time you install a library in your project, read or browse the documentation. Examine the methods and properties available to you, and make sure you understand what problems the library can solve and what problems require different tools. That way you can choose the right tool for the job and prove that your choice is correct.
So that's what mistakes you make in programming, and have you learned anything? If you want to learn more skills or enrich your knowledge reserves, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.