<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Lancelot Caron on Medium]]></title>
        <description><![CDATA[Stories by Lancelot Caron on Medium]]></description>
        <link>https://medium.com/@lancelot-caron?source=rss-64f96dd32fbf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Lancelot Caron on Medium</title>
            <link>https://medium.com/@lancelot-caron?source=rss-64f96dd32fbf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:07:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@lancelot-caron/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Software engineering best practices for data scientists — Part I: Coding]]></title>
            <link>https://medium.com/elca-it/software-engineering-best-practices-for-data-scientists-part-i-coding-d951909f84c7?source=rss-64f96dd32fbf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d951909f84c7</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Lancelot Caron]]></dc:creator>
            <pubDate>Wed, 30 Jun 2021 07:03:00 GMT</pubDate>
            <atom:updated>2021-11-26T08:02:04.941Z</atom:updated>
            <content:encoded><![CDATA[<h3>Software engineering best practices for data scientists</h3><p>Education in and practice of software engineering has arguably been on the decline among data scientists over the past few years, with new diplomas focusing more exclusively on data science and less on secondary (but necessary) subjects like software engineering. This directly translates to people being able to produce quick Jupyter notebooks, but not capable of making <em>quality</em>, <em>maintainable</em> data science products in a <em>collaborative</em> setting — and all of this is needed to take your models to production!</p><p>In this article you will find a list of best practices on software engineering (in particular, for data scientists using Python, but not only!). These are intended to be very general, as detailed rules tend to expire very quickly. The list is by no means exhaustive and each rule can possibly be challenged to a certain degree. They all come from my readings and my experience as a data scientist in the industry for a few years now. Working at <a href="https://www.elca.ch/">ELCA</a> allowed me to see a diverse set of environments at different clients, so these best practices are likewise the “lessons learned” of what I have seen there.</p><p>This article comes in two parts, this first part focuses on pure coding while the second one will be about specific technologies that are frequently used in data science.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bYVibTZwCdOCuiz7" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Always play by *the* rules, not by *your* rules</h3><p>This rule essentially trumps all the other ones. It can be read as: even if you think some coding guideline in your project/company is bad, you should stick to it. Now, this does not mean you cannot <em>discuss</em> the rules or try to convince people of your proposal. It simply means that consistency is key in software engineering. It is the most important aspect to keep a product maintainable so that people can easily collaborate. You might prefer using fastAPI over flask, or using 4 spaces indents over 2 spaces indents (and let’s be honest, for both things I do), but if this is contradicting your team’s guidelines then don’t do it. Any healthy environment would allow you to be heard about coding guideline changes within reason, especially if you have good arguments.</p><h3>There are plenty of guidelines already out there</h3><p>If you do not have any guideline in place for your project, do not worry. There are people out there who have already made guidelines for you. If you work with Python, these are two good starting points:</p><ul><li><a href="https://www.python.org/dev/peps/pep-0008/">PEP8</a>, which is the official guideline for Python style</li><li>the <a href="https://google.github.io/styleguide/pyguide.html">Google Python Style Guide</a></li></ul><p>There are very few instances where PEP8 can be broken and most IDEs (e.g. PyCharm) give you warnings about PEP8.</p><p>The rules you establish also depend on the context: you would probably allow more freedom in a Jupyter notebook for a PoC than you would in a Python library for a production project.</p><p>Again, some rules are debatable but widely-used guides tend to produce the best outcomes.</p><h3>Avoid noise in your code</h3><p>You should try to limit as much as possible all sources of noise in the code, as it makes it harder for a new-comer to read it:</p><ul><li>avoid redundancy (functions exist for a reason!): the more redundant some piece of code is, the harder it is to maintain</li><li>remove unused parts of the code</li><li>avoid unnecessary comments, they generally evolve into obsolete comments down the line</li><li>there is no good reason for commented code, everybody has version control nowadays</li></ul><h3>Explicit is (generally) better than implicit</h3><p><a href="https://codegolf.stackexchange.com/">Code golf</a> is fun, but you should not do these things for production code.</p><p>Even without going to this extreme, people do not take time to find good, explicit variable/function/class names in their code. Granted, Python is certainly not Java where names can easily reach 30 characters. But finding good names often replaces having a comment explaining what this variable contains or that function is supposed to do (tip: if you are in this case and you look for a name, just look at the words in your comment).</p><p>Fancy stuff like highly-convoluted list comprehensions should also be avoided because they only make everybody lose time: you lose time writing them, other people lose time reading them.</p><h3>Your code can always be better</h3><p>That is right, no code is perfect! This is pretty simple to implement: each time you go over your code, try to improve something along the way. It can be anything: a better variable name, a long function that should be split in two, etc. In reality, people already see a lot of improvements to be made when skimming through code, so you can just act on some of it! Again, this does not mean refactoring everything each time you implement a new feature, but rather “try to clean when you see some mess”. A software engineering project is like a house: if you clean a bit as you go, you have a clean house pretty much all the time; if you clean the whole thing every once in a while, you have a dirty house pretty much all the time.</p><p>These recommendations may seem very simple, but in practice they take time and effort to form a habit. Simply being aware of them does not make you a better software engineer, only practice does. However, once you’re applying these practices in your daily work, your deliverables will be of better quality, boosting collaboration and saving maintenance time.</p><p>A second part to this article is coming in the next weeks, it will focus less on coding and more on technologies data scientist regularly use. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d951909f84c7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/elca-it/software-engineering-best-practices-for-data-scientists-part-i-coding-d951909f84c7">Software engineering best practices for data scientists — Part I: Coding</a> was originally published in <a href="https://medium.com/elca-it">ELCA IT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>