#
Mantras
Authoring functioning code that does what it is intended to do is always the first priority of any engineer. Once that goal is accomplished, however, there are several other filters that should be applied to the refinement of a working solution before it is considered "done."
#
1. Code is for Humans
Code is communication. It communicates purpose and intent to other developers and should be clear, concise, and well-organized to that purpose. A 10x improvement in execution speed of a piece of software is generally negligible while a 10x improvement in readability can save hours.
Code that fulfills this mantra has the following attributes, in order of importance:
- Clarity - Purpose and rationale is clear to the reader
- Simplicity - It accomplishes its goal in the simplest way possible
- Concision - It has a high signal-to-noise ratio
Clarity over cleverness, readability over speed
#
2. Interface First
Interface refers to an API contract, user interface, function call signature, or any number of mechanisms to interact with code. The interface is the entry point to some interaction with code, and it is important.
Interface design is crucial for the following reasons:
- Communication and collaboration - The interface acts as a shared language between different stakeholders in the development process, including developers, designers, testers, and users
- Asynchronous development - A well-defined interface allows different teams to work independently. The frontend team can start building the user interface based on the API contract, while the backend team focuses on implementing the functionality
- Focus and maintainability - developers must clearly define the purpose and functionality of the code before diving into the implementation. This leads to a cleaner and more maintainable codebase, as the interface serves as a contract that dictates how the code should be used
- User experience - When the interface is designed with the user in mind, it leads to a more intuitive and user-friendly experience
A well-designed interface guides development towards successful implementation. Code written without this guide often lacks purpose and fails to deliver a complete and user-friendly experience.
#
3. If not now, when?
This mantra is a reminder not to fall victim to the lie "I'll remember to address this later." No, you actually won't, and that is ok.
If something needs attention but, for whatever reason, isn't urgent then create a ticket so that it won't be forgotten and move on.
Now might not be the right time if:
- The change is unrelated to the task at hand (scope creep)
- It may require a refactor or introduce a breaking change
#
4. No is temporary, yes is forever
Introducing a new library, technique, or code that deviates from existing norms or patterns can have lasting consequences.
This mantra encourages developers to think deeply before making significant changes. Taking time to evaluate the potential benefits, long-term maintainability, and impact on a codebase allows for informed decisions that promote innovation while minimizing potential risks.
Even if a proposed change seems initially appealing, saying "no" now allows for further evaluation and ultimately leads to building more robust and sustainable software over time.