Great coding practices from a genius

0

Well the smartest person I know (ok I’m biased one of the three smartest people amongst the Alex, Calvin and Grace 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 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.

Related Posts

© All Right Reserved