While working on the mobile port of Lagrange, where I've needed to introduce alternative UI layouts and entirely alternate views, it has started bugging me that there is a buildup of entropy in the code base.
The navbar, for example, is one of the most complex UI elements in the app, second only to Preferences. It has wide and narrow layout modes, a width limit on the URL input, indicators and buttons that appear based on context, and a collapsed mode for the portrait phone orientation where only a subset of the buttons are visible. When the window/display is resized/turned, or when the UI scale factor changes, there is a rather complex chain of UI events that will notify widgets of the new dimensions and cause them to reposition themselves. The window itself will also recalculate and update some paddings and manually set widget heights.
Especially with the addition of the mobile version, this has started to feel way too complicated. Entropy is being introduced in the form of little tweaks and fixes here and there, in a haphazard fashion. This means I'm accruing tech debt, and will eventually have to revise parts of the UI layout mechanism so it doesn't become an unworkable tangle of kludges.
Of course, part of this feeling is a tendency toward perfectionism, where clean and straightforward code is preferred to simply functioning code. But even from a pragmatic point of view, having code be more easily understood and maintained will pay off handsomely in the long run. Messiness and tech debt will eventually grind development down to a halt, as friction increases when one has to spend time trying to understand why/how something works. Debugging also becomes much more difficult.
The best way forward is to be more mindful of this trend and try to counteract it with small cleanups here and there as you go.
🏷 Programming, Lagrange