From Beginner to Expert: How Code Evolves – Part 3
What separates a coding beginner from an expert? Is it sheer knowledge, or something more? After observing the actual coding on coderbyte of both groups tackling the same challenge lab during our NTCU program and comparing to some internal experts doing the same challenge, a surprising answer emerged. It wasn’t necessarily all the complexity of the code or experience, but rather some basic challenges. We saw firsthand how subtle differences in approach could lead to dramatically different outcomes. In this three-part series, I’ll share these insightful observations from the NTCU program.
In this post, we are going to provide some tactical adjustments you can make.
Reading Stack Traces
This is easily the biggest adjustment one can make from my observations. Engineers found themselves fighting with their code and rerunning the same code over and over versus taking the time to read the stack trace and trying to understand them.
Especially the common error codes of NameError
, AttributeError
, KeyError
, ImportError
, and IndexError
should never confuse you, even as a beginner. It is okay if it does, but now is the time to take a step back and try to truly understand them.
Understanding one of these errors is only half the battle, but it is an important part of the battle. Just because you have an AttributeError
, it may not even be in your code, there could be some downstream code that you are using that is expecting data crafted in a certain way.
Debugging Effectively
Understanding the state of the program at the time of failure is key. This is often done with a series of print statements such as print("Made it!!!!!!!!!!!!!!!!!")
, the extra exclamations for not only added excitement, but easier to find as well.
After getting a stack trace of an issue, it may be code that is in a completely different file that causes the error. So it is often necessary to work backwards such as:
- What data does this function have in it?
- What data was sent to this function?
- How was this data crafted before being sent to this function?
This can go on for a rather long time, but knowing the state at time of error is key, as our intuition often betrays us and our assumptions lead us astray.
In general, it is best to not trust yourself and verify the state or data multiple times.
Understand Data Structures
Understanding the difference between a list of dictionaries and a dictionary with a key of sites that is a list is going to be crucial to understand every other decision code needs to make on it.
While this does take some practice, it is not something that will take too long to learn. The importance put on it is not really stressed in many beginners’ journeys, but experts gravitate to caring about this at every step.
Some Minor Cleanup
Several of the challenges with beginners are things that can be learned rather quickly with some light practice. How functions work, alternatives to using input, and not always relying on Pandas are all quick actions to take.
Outside of Code
While outside the original scope of understanding the code, beginners that succeeded did tend to have both patience to understand what was being asked and grit to finish the job.
Understanding is table stakes for anything worth coding. Many simply looked at the instructions, scrolled up and down, then started to code, only to reread it some time later after minimal success. Those that took 15–30 minutes to read, understand, and presumably develop some kind of plan were much more successful.
While I cannot monitor the emotions of participants, I can glean the level of frustration from the number of repeated attempts. A certain amount of patience and grit is needed to be successful in coding. It can be a stressful mess before the final payoff.
Conclusion
Wrapping It Up
While being an expert clearly takes practice, there are some minor adjustments that can be made to elevate your journey. Most of what was observed was not based on intense experience, but rather based on some precision learning.
Finally, even if you are an expert, hopefully this gives you some insight into the challenges that those who are beginning go through.
-Ken
Contact Us to Learn More
Share details about yourself & someone from our team will reach out to you ASAP!