A Bit of Housekeeping
By: Jamie Wright
Some cool down, some progress
This past month I have been working on some desperate tidying up of the Tatsu house. There was a lot of code in the application that was necessary to prove some concepts and were eventually going to be moved to Juvet. I used the last few weeks to do some of that work, which slimmed down the code in Tatsu.
Here are some of the improvements made in Juvet that were extracted from Tatsu to improve the health of bot code in general.
- Normalized parameters - This pulls out the “common parameters” from each request and makes them easier to access. This makes the pattern matching in Elixir easier and more maintainable.
- Views - When building up a response, there can be a lot of little helper functions that just the one request uses. This is where views come in. They are used to handle a single response to a single action. This allows the code that was sprinkled in the controller to be moved to the view.
- Custom Middleware - Common functions that I perform on each request (like retrieving the current team) can now be moved to custom middleware that can perform this function on each request.
In addition to those features, I also implemented Slack events within Juvet so I could start on the app home development. App home in Slack is started with an event and so the event routing needed to be implemented in order to get app home published. I am happy to report that was successful and I have the initial app home view publishing.
Over the next few weeks, I will be working on finishing the implementation of the app home. My friends at Electric Fun are already working on a really well designed app home. There are so many constraints that only allow for certain elements to be a part of app home so it will be fun to see how they stretch it. While they are working on that, I will be implementing the functionality of displaying previous discussions.
Until next time. 🌎✌️