Expressing intent in your code
Years ago, I met a girl at junior high school. We share our personal feeling. We care about each other. But i did not tell her what i want from her. So in the end our relationship still same. Today, I am busy with my life and she also.
Humans is not a mind reader. They can’t fully know what others are thinking, want to do, and feel at the moment. Especially in a field that collaboration is a key to reach a success. One of the field is software engineering.
So what is intent?
Intent can be used as a noun or adjective. If you are intent on doing something, you are determined to get it done. If you have an intent, you have a motive or purpose.
Why should we express our intent?
You will work with a lot of different people. They came from different country. They also have different cultures and backgrounds. By expressing our intent, other will understand you better and you can collaborate easily.
How to express our intent in our code?
There are a lot of ways to do it but i will share a few below:
- Every time you commit something, write a message and description that tells the reader what are you doing and what state that changes.
- Implement a clean code and use convention that your team have agreed.
- Write a readme/documentation files with assumption that the readers don’t know anything about your work.
Here a list of book that i recommend you to read:
- Clean Code : A Handbook of Agile Software Craftsmanship by Robert C. Martin
- The Pragmatic Programmer: From Journeyman to Master by Andrew Hunt and David Thomas