DEV Community

Discussion on: How do you orient to a "new to you" code base?

Collapse
 
jeremyf profile image
Jeremy Friesen

One of my preferred methods of learning about a Rails application code base is to open up the app/controllers directory and start looking at files.

I do a quick visual scan of the method shapes; I’m looking at method lengths and widths, indentations, and syntax highlight. Looking for visual symmetries. In a way I'm looking at each controller as a visual painting.

Why? When I notice symmetry, it likely means that there’s consistency in approach. When it’s lacking, then I know that there’s a wider variety of approaches.

This process takes no more than 30 minutes. It gives me a quick sense of what my stewardship efforts will look like for this code-base.

Then, on the main branch, I run git log --pretty=oneline app/controllers. (Actually I run my own git-slog which makes it a more legible to me output.)

The git log gives me a list of all of the commits that included app/controllers. In a way this log is like listening to the highlights of the podcast produced by the contributors of the application.

Why the controllers? In my experience, these are the most contentious areas of a code-base. Which harkens back to the venerable "Fat Models / Skinny Controllers" conversations (put forward years ago by Jamis Buck).