Code Documentation – before, after, and during coding
Tags: documentation, git, ruby, code
Published: 2018-11-01 16:08:39

---
title: Code Documentation – before, after, and during coding
published: true
tags: documentation,Git,Ruby,code
canonical_url: http://christine-seeman.com/2018/11/code-documentation-before-after-and-during-coding/
---

Sometimes you just need to started on some design for work on a larger ticket or new feature, you want to get your thoughts down and maybe start plotting out a code flow or some potential classes but what app do you reach for?

![](https://media.giphy.com/media/cMVgEhDeKzPwI/giphy.gif)

So much of the time I reach for Google Docs, for my personal or professional work. It’s easy, automatically backs up your work, and makes it very simple to share the document or convert it to another format. Opening a Google Doc, and starting to type out some pseudo code can be frustrating with the automatic capitalization or the code just not displaying as you would like.  I have found the [Code Blocks extension](https://chrome.google.com/webstore/detail/code-blocks/ebieibfdjgmmimpldgengceekpfefmfd?hl=en-US) extremely awesome with that.  Putting in code next to text is a breeze with it.

> Helpful tip – If you are using Google Docs you can change up your preference to not annoyingly capitalize the first letter in a sentence (which is rather annoying for your Ruby classes which like to start with a non-capitalized letter).

![](http://christine-seeman.com/wp-content/uploads/2018/09/Screen-Shot-2018-09-14-at-11.00.37-AM.png)

Sometimes you just want to work on a spike story or share research that you had to done on a particularly hard debugging process or obscure part of your application. For this type of information, I like the use Confluence, a GitHub readme, or even the GitHub pull request itself. Just depending on if it is something I am currently fixing (it will go in the GitHub PR, preferably with screenshots if it a UI type fix), research for tickets or design coming up (Confluence, so easy to share and searchable for other developers) or if it is something that is needed for the code itself, like metadata or installation information, a readme works well. As a developer, I am trying to improve my git commits and PR for future development and maintenance. I highly ecourage anyone working in Git to check out [Tekin Süleyman’s awesome “A Branch in Time” talk](https://brightonruby.com/2018/a-branch-in-time-tekin-suleyman/). Also his blog post on [creating useful git history](https://tekin.co.uk/2018/07/resources-for-creating-useful-revision-histories) has some great Git tips and tricks, and really makes you think about how your git comments today, and effect someones code tomorrow.

For UML and flow diagrams, [LucidChart](https://www.lucidchart.com/), is my current app of choice. It is an online diagramming tool that has a lot of flexibility on what you want to show. Coming up with your flow diagram isn’t too hard, just make use of the typical shapes and lines. For me drawing the lines for the code that is calling a self.method was the hardest, but LucidChart has some [pretty good tutorials](https://lucidchart.zendesk.com/hc/en-us/articles/115004174923-Work-with-Lines) that can walk you through the process, and help you with all the keyboard shortcuts that make you work life happier.

![](http://christine-seeman.com/wp-content/uploads/2018/11/Screen-Shot-2018-11-01-at-10.33.53-AM.png)

For the documentation of the code itself, I love writing code that is self documenting. For years with writing Java, if your code needed to have comments above it so other developers could understand what it was doing, it was probably too complicated. Writing comments were not encouraged, and refactoring out methods, and patterns to be better descriptors were the norm. Now with Ruby and the software I develop on, there are more comments in the code base. There doesn’t seem to be any stigma with code comments. Sharing information on how to use a command object, or the usage of an API or providing context on a classes public contract all seem to be valid use cases for inline code comments. I am getting used to using comments effectively in Ruby, and the not bring over any Java stigmas that I might have carried over about comments.  I still do lean towards refactoring out code into smaller chunks with self descriptive method names, but do understand when code comments are helpful. All my method names tend to be more verbose, and I am still working on remembering to [snake case](https://en.wikipedia.org/wiki/Snake_case) everything.

![](https://media.giphy.com/media/9xaryfkdWqqiK6QHKf/giphy.gif)

There are so many different things that we have to document as developers that it is so important to figure out the best tools and applications that work for you. So, you as a developer, can document code effectively, efficiently and hopefully in a way that other people can find it and use it. Because the only thing worse than not documenting code, is not using code documentation.