Kentico 12: Design Patterns Part 23 - Improving Our Projects with Documentation
Tags: kentico, aspnet, mvc, cms
Published: 2020-05-11 15:08:57

---
title: Kentico 12: Design Patterns Part 23 - Improving Our Projects with Documentation
published: true
description: Learn about the many different ways we can use documentation to improve our projects.
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/0r9003gzp4g3vp9bnbc5.jpg
tags: kentico, aspnet, mvc, cms
series: Kentico 12 - Design Patterns
---

## Laying A Foundation

I've recently had some conversations with other developers about setting up and configuring projects.

I work 👷‍♂️ for a web development and marketing agency, [WiredViews](https://www.wiredviews.com/). Working for an agency involves a constant stream of greenfield projects, which means I've had lots of experience "starting" things.

Below I'd like to cover some recommendations for setting up a Kentico 12 MVC project and what benefits these bring.

This is going to be a 3-part post. In this post we're going to look at Documentation.

> The previous post was about [Developer Experience](https://dev.to/seangwright/kentico-12-design-patterns-part-22-improving-our-projects-for-developer-experience-1jjk) and the next will be about Configuration.

Let's begin!

![Cat typing like a champ](https://media.giphy.com/media/uzglgIsyY1Cgg/giphy.gif)

---

# Documentation

Documentation is not only commenting our code or a giant Microsoft Word file handed over to the client at the end of a project - it's also something that should _live with the code_ to help us and our teammates long after we've forgotten how everything works (or if we're brand new to someone else's code 😓).

## README.md

![Screenshot of a sample README.md file template](https://dev-to-uploads.s3.amazonaws.com/i/o8fyossz7l64la5ca80f.jpg)

If you have worked with Wikis, Sharepoint, or Word and Text files passed around through email, you might be familiar with how documentation will often rot 💩 even faster than code.

That's likely to happen, because if developers aren't looking at it every day, they are sure to forget about it - we have more important things to do, like fixing all the bugs 🐛 we wrote last week 🤣!

This is why I recommend keeping documentation in the Git repository, the closer it is to code, the better chance it has to survive 👍🏿.

The GitHub convention of having a `README.md` [Markdown file](https://daringfireball.net/projects/markdown/syntax) at the root of the repository is a great idea.

It gives developers a well known place to go for project configuration, setup, and deploying instructions. It can be versioned with the code and reviewed during [Pull Requests](https://docs.microsoft.com/en-us/azure/devops/repos/git/pullrequest?view=azure-devops) 🧐.

If you're not familiar with writing a `README.md` file, checkout the [Markdown cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) or read about some good [README conventions](https://www.makeareadme.com/).

We can also use the `README.md` to link to other documents, or images in the repository, URLs of the application in different environments, specify what servers the app runs on, or add CI/CD badges to show the status of the build/deployment.

Now, with Kentico 12 MVC, we are managing 2 applications instead of 1. That means twice as many app settings, architectures, web servers, URLs, and quirks our teams need to know about to develop and build Kentico sites.

All of this knowledge needs a home that [isn't in a single developer's head](https://en.wikipedia.org/wiki/Bus_factor) 💀, and a `README.md` serves that role well.

> Here's [a README.md template](https://gist.github.com/seangwright/4efd2d87942e346364c08029e8bc7aa3) I like to use for my projects.

To improve the consistency and formatting of our markdown files we can use this [Markdownlint VS Code extension](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) 💪🏽.

If we want a better experience editing markdown files in Visual Studio, we can install the [Markdown Editor](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.MarkdownEditor) extension 👏.

## Diagrams

![Diagram showing client to server request flow](https://dev-to-uploads.s3.amazonaws.com/i/zipej3qjxs3dx1acxq03.jpg)
<figcaption>Made with Mermaid</figcaption>

In the same way that the `README.md` is a 'living document', any additional documentation we create has the best chance to stay maintained if it is housed in application's Git repository.

This is especially true for diagrams, which can quickly get out of date!

We might try to keep these diagrams up to date by continuously re-exporting images from Visio or Draw.io, but that's a manual task and likely to be forgotten as soon as deadlines start to approach 🙄.

Wouldn't it be great if we could "code" up some diagrams and keep the code in source control! 😅?

Well, we can!

[Mermaid](https://mermaid-js.github.io/mermaid/#/), a JavaScript library that renders SVGs from a Markdown-like syntax and [PlantUML](https://plantuml.com/), another similar syntax and set of tools, will let us do exactly what we want.

We can version and diff our diagram files, re-render images if we need to send someone an updated view, and have powerful visual representations of how our applications work for both stakeholders and developers, new (or returning) to the project.

> I've used both tools and I think they're both cool. PlantUML is a bit more established, but Mermaid's toolchain might be a bit easier to get started with.

Want to be able to easily describe to teammates or stakeholders how a Kentico scheduled task integrates with that external system, or the way Kentico's cache system is integrated as a cross-cutting concern into your MVC application 😀?

Create a diagram! But create it with code and store that code in your repository 😁.

> Edit: I just saw that [Draw.io has a VS Code extension](https://marketplace.visualstudio.com/items?itemName=hediet.vscode-drawio) to allow for diagrams to be designed and saved (as XML) directly in our repositories!

## General Documentation

![Folder structure in VS Code showing various notes and documents](https://dev-to-uploads.s3.amazonaws.com/i/y44lgqu39pzsuyhvoonf.jpg)

Both the `README.md` and code-based diagrams are examples of specific documentation, but it's not uncommon to have more general purpose docs related to an application.

These could be meeting notes, commonly used `.sql` scripts, or instructions on how to perform tasks like grabbing the latest FTP drop that only needs to be performed every 6-months 😣.

These types of documentation can also be kept with our source code, especially if they are meant for the development team.

The `README.md` should usually be focused on high level information that's relevant to the entire code base.

Try creating a `/docs` folder at the root of your repository and saving everything there. It will bring the same benefits that were mentioned previously:

- Changes over time are visible in source control histories
- The whole team can review changes to documentation in Pull Requests
- Easy to find in a centralized location no matter which project (`/docs`)
- More likely to be maintained when close to to where developers work (code!)

> In my previous post I discussed how all of these can be added as items to Solution Folders in Visual Studio:

> {% post seangwright/kentico-12-design-patterns-part-22-improving-our-projects-for-developer-experience-1jjk %}

## CHANGELOGs

Projects change over time and each new change that makes its way out to QA or Production has the potential to impact users - hopefully in a positive way 🙂!

Stakeholders are likely keeping their own list of changes to the application - either for prioritizing work or messaging to the app's users.

Developers usually have much more technical knowledge of changes that happen with each deployment.

With Kentico 12 MVC projects, for the first time we have a Content Delivery application that is decoupled from the Web Forms CMS application.

This means that we can deploy updates to one of the applications without affecting the other, and we have more incentive to update our Production environment and deploy changes faster, since the Content Delivery (MVC) code base is smaller, faster, and decoupled from administration 😎.

It can be helpful to record these changes somewhere in the repository...

### Literal CHANGELOG.md

The changes to an application over time can be documented in a `CHANGELOG.md` file kept at the root of a repository (a common practice on GitHub).

This makes it easy to see what the latest feature set was when looking at the history of this file, and also helps developers unfamiliar with a code base understand what a team has recently been working on.

I like the way that the [Angular repository](https://github.com/angular/angular/blob/master/CHANGELOG.md) uses their `CHANGELOG.md`. It's very clear what was done for each version, which regressions were fixed and what new features were added. These changes each contain a link to a commit hash or issue, to let readers investigate further 🤓.

### Meeting Notes

I've used lots of different tools for recording meeting notes related to Kentico sites I'm working on.

- Notepad
- Microsoft Word file attached to email (😒)
- Google Drive Docs
- Google Keep
- Pencil and paper
- Fresh VS Code session with a Markdown file

But a lot of times these documents get created and lost, or they are in a place that isn't easily reviewable by team members who might have ideas or questions (or maybe their own set of notes to add in).

Having a history of meeting notes in a repository, especially ones that impact how the application is coded and developed, can be beneficial for a team.

Using Markdown and an agreed upon folder/file naming structure can result in an easy to read history of the discussions around a project.

This thought leads me to my final recommendation on documentation...

### Architecture Decision Record (ADR)

Have you ever started working in an established project and wondered "Why did the team choose to use `.ini` files for configuration 😤?" or "There is a bunch of JSON in this database column, why wasn't this de-normalized into multiple tables 🤔?" only to hear from a teammate "That was done a long time ago - I don't remember why 🤷🏼!"

With Kentico 12 MVC we are likely integrating even more external services ([Azure Blob Storage](https://docs.kentico.com/k12sp/custom-development/working-with-physical-files-using-the-api/configuring-file-system-providers/configuring-azure-storage), [Azure Search](https://docs.kentico.com/k12sp/configuring-kentico/setting-up-search-on-your-website/using-azure-search)), coming up with our own design patterns to organize the blank slate of a new MVC project, or using new tools like client side JavaScript frameworks, now that we have full control of the rendered markup from our sites.

One of the best ways to document architecture decisions made by team for an application is with Architecture Decisions Records (ADR) 🧐.

An ADR is exactly what it sounds like (as [described by Steve Smith](https://ardalis.com/getting-started-with-architecture-decision-records)):

> "An Architecture Decision Record is a tool for documenting a decisions that has been made (or is under discussion) related to the architecture of a particular system or application."

Each time your team decides to use Azure Blob Storage instead of the filesystem, rely exclusively on `Guid` values to reference database rows instead of auto-incrementing integers, or adopt Autofac as your dependency injection container after considering many others, you are making an architecture decision.

The motivation for discussion, what options were considered, and why the final choice was made, are great things for your team to record.

You can start an ADR (even in the middle of application development) with details as simple as:

- What technologies is the project currently using?
- Are there any risks/concerns with the current tech?
- What new design patterns or services have been discussed for adoption?
- Who is the expert/champion for each specific tech used in the application?

If you need help getting started on an ADR, checkout [these templates on GitHub](https://github.com/joelparkerhenderson/architecture_decision_record) 💪🏾.

If anything, you might realize how little of the architecture of the application has been discussed before adoption and how much of the patterns and ideas are assumed to be 'common knowledge' on your team 😕.

---

## Conclusion

In this post we looked at the many ways we can improve documentation in our Kentico 12 MVC projects. README files, diagrams, CHANGELOGs, meeting notes, and ADRs!

Whether or not we find any of these ideas is familiar will depend on how much we've worked on larger teams, contributed to open-source software, and developed more architecturally complex applications.

The benefit that each suggestion will bring to our project is also dependent on the goals of the project we are developing and the organization of people working on it 🤔.

However, no matter which documentation options we choose from those listed above, having some information organized and documented will always benefit at least 1 developer - ourselves, 12 months from now, when we've completely forgotten everything about the application and we have to fix a problem the CEO just found 🤦🏽‍♀️!

...

As always, thanks for reading 🙏!

---

<figcaption>Photo by <a href="https://unsplash.com/@furbee">Oscar Nord
</a> on <a href="https://unsplash.com">Unsplash</a></figcaption>

---

We've put together a list over on [Kentico's GitHub account](https://github.com/Kentico/Home/blob/master/RESOURCES.md) of developer resources. Go check it out!

If you are looking for additional Kentico content, checkout the Kentico tag here on DEV:

{% tag kentico %}

Or my Kentico blog series:

- [Kentico EMS: MVC Widget Experiements](https://dev.to/search?q=kentico%20ems%3A%20mvc%20widget%20experiements)
- [Kentico 12: Design Patterns](https://dev.to/search?q=Kentico%2012%3A%20Design%20Patterns)
- [Kentico CMS Quick Tips](https://dev.to/search?q=Kentico%20CMS%20Quick%20Tip)