This year on Friday 21st 2018 I had the chance to join the super nice SoCraTesDay family for the second time. Again the unconference took place at Ergon in Zürich. As usual, the first hour was to built up the schedule for the day.
Cutting code quickly
In my first session Oliver Nautsch showed us a cool way to bring legacy and untested code to the point of being tested and ready to refactor. The method is called approval based testing where you try to build many unittests by running the current code. In the scenario he built up a serialization of the results of a given method. Next he made the assumption that the legacy code in it’s current state is valid.
Next the testmethod was called using different parameters found in the code. The principal is to run the method with all possible value combination and write down the output. Each combination result in one test. This is done without touching the method itself. The goal is to bring all branches to be covered by the unittests.
Using this approach he was able to write around 500 unit test cases in around 30 minutes. And once the tests are in place you may start to refactor your method and validate it against the approved results.
As everything in our business this is not the holy grail that solves all your problems with untested legacy code. But it is an approach to get some things quite fast under test. As soon you have the tests, you can bring the code to a better quality level.
Organizing a big bad monolith
The second session was about ideas to structure and organize a big bad monolithic application. Here we discussed about ways to structure a monolithic application. Following the discussion it confirmed once more: “If you are unable to structure a monolith, you will fail badly at microservices”. This was a really refreshing session that did not follow the “microservice” trend.
As expected building a monolithic app can be done without to many layers or structure. For a really small one this may be fully ok. But as an application grows, you will be faced with some design decisions and there is no “yep, thats the one perfect solution.” You have to take tradeofs and there are a lot of them to think about.
One of the important things you have to figure out is the same for all architectures. The bounded context of each part / module / microservice / <nameItAsYouLike> is really important. If you miss these, you will screw up your codebase sooner or later. And just as a warning: A bounded context is not just build up on one view. There are technical arguments, bussiness arguments, dependencies to external systems, the view of the testing, workflows of the user and all nonfunctional stuff like performance requirements that may impact to your code and structure.
I’m quite happy to not be the only one struggling with this.
Should I become a manager
The third session was not about architecture but people and people management. It was a nice discussion what problems may arise if you want to make the transition from a developer to a manager. My key takeaway here is the thing that is all about. It is about talking to people and about trust. And the second thing is the culture of allowing misstakes and an open culture how to deal with them. Blaming and punishment lead to the wrong direction. One should be encouraged to tell about the misstakes happend and what we can learn from them.
Microservices meet legacy application
This was my talk and I was looking for ideas and people with some experience with introducing a microservice architecture in legacy applications. The second question was about the approach if I would go down this road. At the end I got some more ideas and an indirect confirmation that the way I approached the situation looks right. Next year I eventually may hold a speech “Lessons learned from introducing microservices in a legacy app”.
Self contained systems
The next session was all about self contained systems. This talk was basically an introduction into scs-architecture.org. I got some insights about the benefits of a self contained system and how these systems may be implemented to work as a larger product. As everywhere, there is a trade-off you have to take if you build self contained systems. Maintainability and little discrepancies may happen as for example each system provides the main page including stuff like navigation. So during some updates in these parts, the system may look inconsistent depending on which system you land first. But in fact, if you really work on a system that is so large that you have to split it in separated self contained systems, this trade-off will be the one that should be the easiest. As with monoliths and microservices the hardest part will be once again getting the right bounded contexts. And the second really important part is how to make sure, global updates reach all the different systems without introducing a high coupling.
Prometheus and grafana
The final session was a nice walkthrough how to setup a lab instance of prometheus and grafana. Prometheus is a nice database optimized for time series data. It provides many plugins and exporters to gather metric from the monitored systems. The exporter starts from basic system information up to custom application metrics.
On top of Prometheus you may use grafana to visualize the data stored in the time series. You may start with an empty system but to get some working dashboards and ideas, you can install one of the many templates provided by the grafana project. You may also upload your dashboard and share it with others.
The example used docker to set the systems up and included an exporter used to export the docker hosts metrics and visualize them in a dashboard.
Once more a really cool day. I had the chance to learn a lot an gather ideas to solve real problems I’m facing in my day to day work. The people are just great here and the open minded style of this unconference is outstanding. Every single person is here to learn or share experience. All kind of professions united at one location, from managers to testers to coders to architects. And this is what makes it so special as you can learn from anyone if you’re open to listen and free to review and adapt your own thoughts and ideas.
Many thanks to SIX Payment services to support me visiting the unconference.
I’m really looking forward to the SoCraTesDay next year. Perhaps I can make it to the big SoCraTes event, but this is always a trade-off between family and passion / profession.