Maxim Menshikov

Static analysis reseacher and startup founder


Implicit knowledge breaks your software Thoughts

Software engineering practices is what built the industry we know. It is always critical to acquire locks in order, to unlock the spinlock at all, etc.

Knowledge So, you know the technology. You think you may code more efficiently than best practices suggest, and it is often true. But what happens when you make exceptions for best practices?

Think ahead

A junior software engineer comes to the company. The person (hopefully) reads outdated policies and understands nothing about the development process in your company. The more tickets are assigned, the more code this person writes. How to write it? Of course, by looking into existing examples. Now, terrible things happen in the background, e.g. memory leaks start occurring… You review the code and miss bugs because a big part of the code looks familiar to what you write. The implicit knowledge of yours is lost.

The software consisting of implicit knowledge is broken since the beginning.

Takeaway

Enforce semantically correct API usage even if it looks redundant. It is better to repeat some function call and leave it to the optimization pass to decide about exclusion than to introduce delayed errors in future.

Exceptions from exceptions

Of course, there can be exceptions. If you think that following API usage is not efficient, write it as a comment. That will work and will teach junior engineers that explicit knowledge.