Improve your technical and communication skills, learn to write readable code, and start writing about anything
When I started writing, I could barely code. My little experience with Python came from university projects. At the same time, I thought he was a great writer! Looking back now, I cringe at some of my earlier articles.
This shows me that writing tutorials has improved my technical and communication skills. Ultimately, it has made me a better data scientist. I want to share my experience and discuss some specific benefits. This includes writing readable code and providing the first step in writing about difficult topics.
Technical skills are obviously important for developers and data scientists. At the same time, we work in fields that are constantly changing. This means we need to keep up with the latest tools. This can be difficult and time consuming, so it takes a real commitment to continually learning.
Writing has motivated me to constantly learn new technical skills and develop a deep understanding of those topics.
Writing has been a great motivator. Not only am I able to learn new things, but I am also able to share those lessons with the world. It’s addictive: getting people to read and interact with your work. The desire to constantly post new articles has pushed me to constantly learn new things.
Not only that, but I find that writing is the better way of learning Often it is only after I have tried to explain something that I realize I don’t really understand it. Besides this, I always try to add value to a theme. The introduction of novelty requires a good understanding. In this way, writing has been a verification of my knowledge. It has pushed me to truly understand the technical concepts I write about.
write readable code
A related skill is writing readable code. Good code should be self-explanatory. Similarly, a tutorial based on readable code is easier to write. I spend less time explaining what the code does, and often you don’t have to explain it at all. I found that this benefit extends to industry collaboration.
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
—Martin Fowler
An example comes from a recent article of mine: Using SHAP to debug a PyTorch image regression model. In the tutorial, I worked with SHAP values given in a 5-dimensional array. I wanted to display this array using one of the functions in the package. To do this, the array first needed to be reordered. Originally, the code looked like this:
# Reshape shap values for plotting
shap_numpy = [np.swapaxes(np.swapaxes(s, 1, -1), 1, 2) for s in shap_values]
the nested swaps Functions were not fun to explain. The TLDR is that the code transposed the third dimension of the matrix with the fifth dimension. I found myself writing a long paragraph about how the code was doing this. So instead I rewrote the code:
# Reshape shap values for plotting
shap_numpy = list(np.array(shap_values).transpose(0,1,3,4,2))
The transpose function is more intuitive and the code was easier to explain. When I write code for tutorials, I always look for examples like these. Readable code makes the writing process smoother and the tutorial more digestible.
I have found this skill particularly useful when collaborating with other professionals. You can never walk away from rollouts and code reviews. Explaining the code during these processes is no different than explaining it in an online tutorial. Ultimately, writing readable code means I spend less time explaining that code to my colleagues.
When I started working, I quickly realized that non-technical skills were also critical. You need to not only get results, but also explain them and your process. I had to produce emails, presentations or technical documents on a daily basis. There was no way to escape the writing!
…traditionally, different people follow different paths in their careers, some are more technical, others are more creative and communicative. A data scientist must have both.
―Monica Rogati
Writing coding tutorials is great practice for this. The more I wrote, the better I communicated at work. Complex analysis became easier to explain and I had to clarify my work less. I quickly saw the tangible benefits. However, this was only the beginning.
Using tutorials as a starting point for writing
Compared to other articles, coding tutorials are easy to write. There are no deep thoughts or nuanced arguments. You just explain the code. This means that they can be a way to get into more difficult writing.
Writing is something you need to practice to be good at. The tutorials helped me take my first steps. I started experimenting with adding catchy stories to the instructions and conclusions. Stumbling across these helped me transition into different types of articles.
Taking more confident steps, I moved on to pieces based on my experience as a data scientist. These were articles based on more abstract concepts, my personal experience and feelings. I found these much harder to write than any coding tutorial. However, I wouldn’t be at this point if it weren’t for those early tutorials.
Looking back, there have been a lot of benefits to writing coding tutorials. I have improved my technical knowledge and I have learned to write readable code. Writing tutorials has also gotten me to the point where I feel confident writing about almost anything. I haven’t even mentioned the benefits to my reputation and financial compensation.
So if you’re interested in writing, coding tutorials are a great way to start. If you are having trouble with ideas, you may find this article helpful: