As it goes with all software, initially you think you have it all figured out and it’s all clear, but as soon as you start writing it you realise there are a couple of things not as straight-forward as you would have liked. The implementation of the ObjectSavingFramework is no exception to this, even though it was designed to be a very simple application.
The first version only had to have 3 different concepts:
- Objects: which contains other elements (potentially other objects).
- Values: which just indicate a certain value.
- References: pointers to objects.
The references are an important aspect to avoid infinite nesting, or object duplication. An object that contains another object will have to decide whether this object is private to him, or if it is shared. If it is a private object, the whole object needs to be written as a child element, if it is shared then the reference is required. It is however this reference concept that caused most of the problems.
A common part of any application is to save data, altough there can be a big difference in the reason why you are saving data. Maybe it is just the output of the application which takes a certain input, processes it and writes some output again. But a lot of applications save data to have some kind of memory in case it is shut down, or in case of a failure. A lot of applications wouldn’t be thinkable without any way of storing data for later usage, even simple ones. I recently encountered this with the GroceriesInsight application, which currently doesn’t do much, but even then I already felt the pain of not being able to save the data.
Because of this saving data is a well known process that holds little secret. The first thing you would decide would be in what format you want to save your things, this can vary from a text format such as XML, JSON to a database. Once decided you will search for a library that makes it easy for you to write the data in a correct format. But then you are faced with how to get your data from the object to the library to save it, this problem will the be topic for this blog post.
Before starting any actual development I decided to dive into the features GitHub provides. Since it is just a personal project, I see little reason to start hosting my own Jira or other heavy applications that I would need to keep running somewhere. Instead I would opt for free cloud-based solutions. As a fact I know that GitHub has a lot of features, which is nice because then everything is located in a single location.
I have however never used any of these features, and thus I was out for an interesting journey on setting everything up. In the end the goal was to have a nicely organised repository with a clear flow, where merging branches and continous integration is standard.
In the past I tried to contribute to an open-source C++ project, mainly because I want to keep my knowledge of C++ up-to-date. However finding an interesting project has been tough, but eventually I did find one. However, as with all projects there is a quite a big learning curve to get involved. Due to my lack of time, this never really took of.
Recently I decided to start working an a personal project, as with all of these projects they arise from a feel of need. The application I will create has as main goal to keep track of expenses. There are probably a lot of other applications that can do this, but by doing it myself I will have more control over the features.