# Great coding practices from a genius

- Link: https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/
- Published: 2020-03-20T10:24:05-07:00
- Author: rich

Well the smartest person I know (ok I’m biased one of the three smartest people 
amongst the [Alex](https://alextong.net), [Calvin](https://calvintong.com) and [Grace](http://gracetong.com)
crowd). But Calvin did a great job summarizing on his new blog (he’s imprisoned 
in his own self-quarantine).

But he has some [great summaries of how to be really productive](https://calvintong.com/2020/03/14/on-scientific-python-best-practices/#comments)
and the comments are pretty basic, but really good:

 1. Create a single subdirectory where you put all your code into one place in `~/ws`
    and then your stuff doesn’t get sprayed everywhere.
 2. Put everything and I mean everything into source code control. Github is so great
    for this.
 3. Use virtual environments as much as you can, use Conda for Python because then 
    you don’t have to remember what you’ve installed. It is super cool to be able to`
    conda activate` an environment and get what you need.
 4. Use Makefiles and not shell scripts to gather together together how you do an installation
 5. Yes spend time on your README.md

I could add a few more. The most important idea is reproducible build (thank you
Sam!) which means that you should be able to recreate everything from a bare machine(
whether on your laptop or on your virtual server in the cloud):

 1. If you can run your applications in docker. This is just another way to insulate
    yourself from your current environment. You can actually create a Makefile that
    does this all automatically, so it is just a matter of changing the Dockerfile 
    and you get what you need. This takes more time but is worth it particularly since
    Docker Hub really does have every environment you would every need.
 2. Check in your `.bash_profile` and other configuration scripts. Make this private
    of course, but it means that if you make a change and your machine gets borked,
    then you can quickly recover.
 3. Spend time on an automated installation script. There is nothing like losing your
    machine to blow things up. The key is a simple shell script (under git control)
    that does all the installations for you. With Homebrew for command line (for Mac
    and Linux now), Scoop (for Windows), you can really automated everything. There
    is so much commonality these days thanks to Windows Subsystem for Linux that you
    can really have the same development environment no matter what client.
 4. The black hole is what to do with your secrets and credentials. This really a horrible
    spot for automation. I had to create my own secrets storage using a Dropbox (soon
    Google Drive) that has an encrypted volume using Veracrypt. That way, you can get
    all your SSH keys in one place.

### Share this:

 * [  Mastodon ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=mastodon)
 * [  LinkedIn ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=linkedin)
 * [  Facebook ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=facebook)
 * [  WhatsApp ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=jetpack-whatsapp)
 * [  Email ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?subject=%5BShared%20Post%5D%20Great%20coding%20practices%20from%20a%20genius&body=https%3A%2F%2Ftongfamily.com%2F2020%2F03%2F20%2Fgreat-coding-practices-from-a-genius%2F&share=email)
 * [More](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/#)

 * [  Telegram ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=telegram)
 * [  Print ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/#print?share=print)
 * [  Pinterest ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=pinterest)
 * [  Tumblr ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=tumblr)
 * [  X ](https://tongfamily.com/2020/03/20/great-coding-practices-from-a-genius/?share=twitter)

### Like this:

Like Loading…
