In the ever-changing world of high technologies, at High Lander, where we strive to provide our users with the most convenient solutions in the shortest possible time, it’s critically important for us to pay close attention to the quality of our product’s code. However, it’s not always easy to clearly determine which development decisions were optimal and which were not. This is where tests come in, forcing us to make the right choices, which pay off in the long run.
Separation of responsibilities:
We strive to break even small parts of the code into independent segments, each responsible for a specific task. If our programmer doesn’t fully achieve this, tests will highlight that the method they intend to test performs more than one action, forcing them to reconsider the logic’s internal structure.
Example: When carrying out its mission, the drone must maintain constant communication with our backend server, which simultaneously updates its status in the database, analyzes the drone’s parameters, and monitors the surrounding environment. Naturally, each of these actions should be tested independently, meaning there must be at least three functions responsible for these tasks.
Minimizing code duplication:
Tests help us identify and eliminate code duplication. For example, in data processing from sensors or video transmission from different sources, it’s easy to overlook repeated elements. However, during the testing phase, it’s often realized that the code already exists elsewhere in the program and should be extracted into a separate module.
Example: If several independent modules process information from various sensors, tests will reveal similar data processing algorithms. This process is optimized, becoming unified and efficient for all data types, allowing for quick and painless future modifications.
Edge cases:
At High Lander, we encourage our talented programmers to develop the concept of competing with themselves to achieve maximum coverage of edge cases. When a programmer finishes developing a feature, they switch roles and use tests to uncover potential weaknesses in the code they’ve written.
Example: After writing code that updates a drone’s status while in flight, we make several assumptions about how the status update might arrive and proactively handle various exceptional situations during the development phase. This approach allows us to provide a higher-quality and more stable product to our users.
Minimizing input data:
One of the most important criteria for the quality of our code is minimizing input data at
every level. Often, in an effort to respond to user requests as quickly as possible, we pass much more information to our methods than they need. Fortunately, this is easily detected during testing, where the programmer needs to create all the required data for the method they’ve written. Not wanting to waste time, they quickly realize that not all of this data is necessary and remove the extra input from the method.
Example: Primitive methods in our code often receive large objects like drones, stations, or no-fly zones, whereas these methods only need specific fields from these objects. Tests effectively draw attention to this issue.
By keeping these simple but highly effective principles in mind, we aim to build an infrastructure that remains stable and adaptable to rapid changes, so that our users receive fast and optimal solutions for their diverse tasks.
Comentarios