Why Syntax Errors Will Make You a Better Software Engineer
Mar 25 2020
We’ve all been there. You’re coding, and when you run the code, it crashes. You see the error, and it’s a syntax error. Now, most developers groan, and look at the traceback and try to fix the error with no enthusiasm. But, I’ve grown to enjoy syntax errors. I don’t necessarily seek them out and dance with joy when I see them, but I’ve grown to accept them and have understood how helpful they are.
You may be wondering, how in the world can syntax errors be helpful? Sure, in context, syntax errors are not helpful. But what they make you do subconsciously is very beneficial, and I plan to point those things out. Whatever your stance is on syntax errors, I believe that syntax errors help you become a better software engineer.
Syntax errors make you more observant
You have to be observant, meticulous, and detail-oriented to efficiently seek out and solve syntax errors. This becomes human nature — if you’re observant, you can solve these errors quickly and easily. But, if you’re not so observant, you really have to look closely and slow down at what you’re reviewing. You must read code line by line, looking at each and every single character just to see what you did wrong. Now, I’m no neurologist, but going through this process over and over again helps your neurons fire, essentially building certain skills. This skill is not something specific towards programming, but skill in general of being more observant and detail-oriented.
Personally, I’ve found that over time, I’ve gotten better at reading my code and other people’s code and finding flaws in it syntactically. I’ve also gotten more observant in general. I’ve started noticing little details that I’ve never noticed before and on a frequent basis. Though being observant may not sound like the most amazing skill in the box, it’s one that’s required to becoming a great software engineer, and it’s a skill that’s used in everyday life.
Syntax errors make you more persistent
Being observant is not all there is to fixing syntax errors. You need to be persistent. Some syntax errors are easy to find and fix: maybe you forgot a parenthesis or an ending quotation mark, but some are harder to find: maybe you misspelled something or forgot to capitalize a letter. Either way, you probably won’t find the error right away. I’ve spent 2–3 seconds on syntax errors, but also several days just finding that one variable I misspelled. It’s helped me become more persistent in finding errors, debugging them, and fixing them.
A lot of students that I mentor give up way too easily. They call me over the moment they have a syntax error, which is usually a 2-second fix. Though you need to be persistent to fix syntax errors, a lot of the time it’s not that hard to solve.
Syntax errors will make you more resourceful tool-wise
This may sound a little bit far-fetched, but in the software engineering industry, using the tools around you can improve your efficiency immensely. Things like debuggers, word-searchers, and syntax validators are extremely helpful.
If you don’t know what debuggers are, they are pieces of software that run inside IDEs (Integrated Development Environment) and some text-editors. They help you freeze time at certain breakpoints in your code, and check the values of certain variables and function outputs. Debuggers are used a lot for logic and operational errors but can help a lot in checking where your syntax error lies and will point it out for you.
Something as simple as a word searcher can go miles. Especially for something like a misspelling of a word, you can simply look up the name of the variable you think you misspelled, as see if it exists in the place where you hypothetically misspelled it. I’ve used this to help me fix syntax errors dozens of times, and I feel like it is highly underrated by developers. Sometimes the simplest tools can make the biggest differences.
You may or may not have heard of syntax validators, but they are external resources that can syntactically validate your code and point out errors in indentation or missteps. For example, JSONLint is really helpful for validating JSON code. I’ve used it numerous times when I run into merge conflicts with my JSON files, and it always saves the day.
Syntax validators are not the first tools that I use, but it is a very good last line of defense.
I hope that I did syntax errors justice. Many developers dread them, but we should grow to appreciate them, and truly understand why they are helpful to solve. It can help improve our skills related to programming, but also skills outside of the field. It has definitely improved my skill and efficiency as a software engineer, and it can definitely do the same for yourself.
For beginners who are taking an online tutorial or in-person classes, try to fix the error yourself. Try to fix syntax errors on your own before calling a mentor or posting a question on an online forum. It will help you understand your code much better, and will, in turn, help you learn a lot more about programming in general.
If you have any questions, feel free to message me on LinkedIn!