Habit Tracker — Part 2

Averrous Saloom
2 min readAug 26, 2023

--

previous part | home | next part

In these past 4 days, I’ve finished the creation of the backend service. Golang is used, purely because I have never previously written api service in Golang and I want to learn it. One thing I learned from working with dotnet this past 3 months in my internship is that swagger makes it easy to test the API hence improving the development experience. So in this Golang project, I also write swagger specifications on top of handlers and embed a swagger UI middleware so that a swagger page can be accessed.

I also wrote the frontend logic. Why I said logic, because it still look like shit.

So shit, but at least the logic runs

I hated creating so many react states. But after reading about custom hooks, the pain reduced. It is a simple abstracting technique, that wraps complex logic into a function, but I missed it so many times. Reading a react component code is usually very painful for me, even when I wrote it myself. Abstracting operations truly is the backbone of modern engineering.

Abstraction is everywhere. A car manufacturing factory will receive parts from other factories and assemble them only knowing what will the part do instead of knowing how the parts do it. These parts are called modular assembly units. With these units, the assembly worker only needs to focus on the arrangement of the units and integration testing of a set of interconnected units. The process of assembly becomes faster by reducing the amount of things the worker needs to be aware of.

The goal of a software engineer is to reduce complexities. Either for herself or for the engineer who will maintain the codebase. Creating abstractions for complicated logic is a central issue. By having well-engineered abstraction, the cognitive load that an engineer needs to bear when working on a task is reduced significantly.

The same happen for testing. When I do TDD or as simple as test if a procedure run or not, the cognitive load I felt is reduced. When I am not testing there is always this ghost that creeps in my head: “Will the thing I build this thing on runs?”. Testing allows me to get into the flow easier.

Remaining works

The time rule logic hasn’t implemented yet, and it is the most important logic. I suppose the logic analysis for this will be long and worth to use the simple problem solving tools I learned from Ken Wanatabe’s book.

And the rest is deploying it. I plan to use a VM and run these two services on docker and serve it to the internet with Nginx. I will also setting up github action on it so the changes can be redeployed swiftly.

--

--