Yaml is probably the briefest common structured text data representation. And thus it’s often a go to for configuration, build and other pipeline files. It’s basically made up of lists of key:value pairs.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
orderitems:
  - code: 001
	descritpion: ESP8266 feather board
	quantity: 1
  - code: 002
	descritpion: Transistors 200 piece pack
	quantity: 1
  - code: 003
    description: Red, Grean, Yellow and Blue LEDs 20 piece pack
  - code: 004
    description: breadboard with sticky back
  - code: 005
    descrtion: Jumper Wires, male to male, 100mm 50 picec pack

Use Case: Application Configuration

I discovered while developing the FileArchiver that I didn’t really know how to use ConfigurationManager in .NET, so I started to look through the classes and discovered it was pretty bloated and overly complicated. It left me asking myself “If this was simple what would it look like?” I have used a bit of Yaml to setup Azure DevOps build pipelines before. So the hunt for something to parse a Yaml file was on. A few minutes later and I’d found YamlDotNet, it behaves similarly to NewtonSoft’s Json.NET. It was game on, and a bit later I had a configure file being serialised to a custom configuration object for the project. The solution is not only eloquent, it also saved a whole lot a time given I didn’t have to figure out the object model being used by the System.Configuration object model.

Use Case: Personal Structured Data

Each day I try to make journal entry based on The Five Minute Journal, but I prefer the keyboard to a book and pen, as I’m keen to have the ability (potential at this point) to explore the data for trends that may prompt me to reflect and then plan a changes for the better. The concise and minamalist structure of Yaml make it great for this. Here’s a fabricated example of a journal entry for me. I just keen these in an online Git repo.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
Journal: 
  Quote: Well-being is realized by small steps, but is truly no small thing. ~ Zeno, Quoted in Diogenes Laertius, lives of the Eminent Philosophers, 7.1.26
  GratefulFor: 
      - Having my own office and a great setup at work
      - Getting on with it, avoiding dwelling
      - Having a great family
  WhatWouldMakeToDayGreat: 
      craftsmanship: Progress creating a data source for the DataHub project
      productivity: Adding the ISO8601 format to my text expander scripts
      self: Progressing the Yaml content for my personal site
  DailyAffirmation: 
      - As a Stoic I choose my thoughts
      - To make things happen I apply aptitude
      - To deliver as a craftsman I apply gumption and grit
      - I provide a greater good by helping people further themselves.
  ThreeAmazingThingsThatHappened: 
      - Great feedback on network outage communication
      - Arie and I had fun playing with the pipe and balls afterwork
      - I got a walk in at lunchtime in the sun
  HowCouldIHaveMadeToDayBetter: Displacing some of the coffees with water

Resources