I’m happy and proud to announce that I am still off of beer since January 1st…well except that one time where I had 7 ipa :) Things are going well without the beer, although I had some major cravings a few days ago. Cravings seem to spike around the weekends!

Now back to the app!

Some refactoring

I refactored the current application a bit. Nothing major but the followings:

  • Created a new project - Journaling. This project will handle the logic of keeping track of my daily beer log.
  • The console application doesn’t deal with anything but just running the application.
  • Renamed the class Beered to Entry. I like this a bit better because the class actually represents an entry log.
  • Also made Entry class internal. This class represents the internal domain logic and anything outside(UI etc) doesn’t need to know how the actual entry is being created, stored etc.
  • Added a new Value Object class - EntryDto which actually will be passed out to outside(UI etc).
  • There’s also a static class DataStore which has static helper methods to store and read from the actual LiteDB instance.

The code for this post is at branch: learning-unbeered-3

Whats next?

  • When running the app, I still have to manually add an entry since Day 1. I’d like to make this a bit more easier, i.e only ask me to add an entry for the days that I have missed to create an entry for.
  • I think we can replace the static class DataStore with something better.
  • I’d also like to separate out the logic of storing vs reading entries. Having read vs. write model would make things clearer. Hint: CQRS :)

Until next time!