Avoiding UX Debt: Modularity, Part 1
There was a trivial bug logged in JIRA—yes, it was a minor detail—that had been assigned to me to fix. The bug affected several different buttons appearing on different screens of the application. The fix required a small change to the HTML, and that meant I had to alter the JavaScript that was generating the buttons. It was simple enough that, with my limited understanding of JavaScript, I was able to implement the fix without assistance from a developer. Having fixed the button on one screen, I assumed I would be able to pretty much copy and paste the fix into the other screens. However, upon viewing the code, I realized that the code generating the second button was written differently from the code generating the first, even though the resulting HTML was identical.
The two screens had been implemented by different developers at different points in time. Rather than reusing code that already existed in the product, the second developer implemented the screen in his own way. As a result, the codebase became more difficult to maintain. Months down the road, it took twice as long to implement a simple bug fix as it would have if code had been shared.
A well designed user interface, by its very nature, is consistent. A button is represented in a very specific way, consistently throughout the entire application. There may be variations, but the user will always recognize it as a button. As such, a user interface, by its very nature, should be modular. Like a set of Legos, each component should be reusable in different contexts.
This modularity should apply not just to the appearance and behavior of the UI components, but to the code that generates them. If every button in the application is composed of an icon and label contained within a pill-shaped box, there should be a chunk of code that can generate every button in the application when passed the text for the label and the ID of the icon. That way, when the team decides that they want to change the button, they don’t have to implement the change in 100 different places throughout the application. The change is made once within that single chunk of code, and every button in the application automatically exhibits the change.
I complained to the lead developer about the way the buttons had been implemented. During the next iteration, she wrote a function that would generate the HTML to display a button given a few variables, and then it was employed throughout the application. This was when I first started imagining what I would eventually come to call a design system.











