ds-econ

Share this post

The Error might sit in the chair

dsecon.substack.com

The Error might sit in the chair

We write code for humans, not for the computer itself.

Finn
Apr 19, 2023
3
Share

Programming is the craft where we teach computers how to perform a sequence of actions. We can talk about what constitutes good code and how to write it. But after all, many data scientists tend to work step by step, and then edit the code after they established that it works.

Thanks for reading ds-econ! Subscribe for free to receive new posts and support my work.

I noticed that there are some quirks, we as humans have while writing our code.

Long computation times make us nervous. We start to think that the code is “doing something wrong”, for a mysterious reason, or we suspect that our laptop has crashed. We are often fine with waiting for a minute or two, but occasionally, our code takes hours to run. Can you feel the urge to press Stop, or to force-quit your VS Code / R Studio / Jupyter, after your code has been running for two hours?

Can it really run for so long? Let’s wait for one more minute and then a little more. It still hasn’t finished, something has to be wrong here, right?

Every so often, we write code in a way, that makes it humanly impossible to find its flaws. After programming a script of several hundred lines, we tell ourselves that this must be a big, complex, project. However, when we need to scroll for 30 seconds to reach the end of our script, how will we ever find the wrong data-type in line 204, when it only causes an error in line 397? How can we see the mistake, if it doesn’t even fit on the screen?

Yes, you are writing code for a computer to do things — But is your computer really the audience of your program? Aren’t you really writing the code for your future-self / your colleagues / the world?

ds-econ
Who is your audience?
Screen-writers, authors, bloggers, influencers and other creators all face the same question: Who is the audience? Depending on the audience, a writer might pick more simple or more complex language or write in a more cheerful tone. Surprise: Data scientists also have an audience…
Read more
5 months ago · Finn

How do we remind ourselves that df_output_monthly_2023_2, the data frame in line 32, was just to take a look at the data, and not relevant for the computation, when we come back to our project after a long weekend?

Consider making your code more human.

Think about documentation, warning messages, or adding progress-bars to your for-loops, to show the human in front of the machine that her computer is still alive.

Like writers, or carpenters, programmers create something for humans.

Loading...
3
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Finn
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing