From Beginner to Expert: How Code Evolves – Part 2
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 observe three key things that our experts John Anderson and Jacob McGill did.
Understanding Data Structures
One of the challenges involves returning a data structure in a certain way, which is probably standard of most functions. The two experts did exactly the same thing when they jumped into the code, which was to stub out a static definition of the return data structure. So as an example, if the request was to return a dictionary with keys as the site name and a list of devices within that key, they did something like this.
>>> def get_site_info():
... sites = {"nyc": {"devices": ["nyc-rt01", "nyc-rt02"]}, "sfo": {"devices": ["sfo-rt01", "sfo-rt02"]} }
... return sites
...
>>>
From there, they were able to test that the rest of the code worked as expected, without having to worry about the complex logic to build the actual function. Additionally, they are better able to mind map each step of the way, and understand if the code errors out, the scope is much smaller.
There are countless other examples, such as understanding whether it was a string or an integer where you could see that they would print out the data structure or the type
of the data structure.
When juxtaposed with beginners, the amount of data structure or type issues they had but didn’t realize was enormous. This was not a challenge to the experts and it was naturally the first thing they addressed.
Reading Stack Traces
While beginners struggled with stack traces, for experts it was their superpower. The common errors were handled immediately without hesitation, such as NameError
, AttributeError
, KeyError
, ImportError
, and IndexError
. While other errors took more time to go through and realize the issue, they would immediately go to the stack trace, study it, and not try anything until they at least somewhat understood the stack trace.
Contrast to beginners who would often repeat and see the same stack trace and not try to understand it, go look at other parts of the code, or irrelevant parts of the output.
Command of Typing
The experts did something that would be difficult for beginners—they knew exactly what the names of methods or functions were without looking. It was nearly all from recall. They did not get tripped up if it was sort(site_list)
or sorted(site_list)
and same for site.sort()
or site.sorted()
.
They understood which built-ins were already available and what their exact names were, capital letters and all.
In general, they had a plan of what the strategy was going to be and were able to stick to that. This is obviously the advantage of experience; but in an age of AI and IDEs that can predict what you are going to type, you can tell that they truly had mastery of their skill.
Conclusion
Wrapping It Up
While some of these examples differ nicely to the beginner series, some of the examples do not align as well, showing both what is being done as well as what is not being done between beginners and experts.
In our final blog in the series we will review some of the key takeaways.
– Ken
Contact Us to Learn More
Share details about yourself & someone from our team will reach out to you ASAP!