Why is this code written?

Igor Budasov
WebDevOps
Published in
1 min readMay 15, 2018

When we’re looking at code — we can see how it works, we can see that data comes inside, how is it being processed and how returned.

But often nobody can say why someone wrote this code.

As an engineer, you suppose to know motivation behind it, because of if you don’t — you can’t change it, you just have no right to do it.

So, what can I do here?

  1. Ask Product Owner
  2. Read unit tests, every test name suppose to describe motivation behind the code. Good unit-test tests behavior, not a function/class.
  3. Read acceptance tests — intention suppose to be obvious
  4. git annotate — will reveal the history of commits with, hopefully, Jira’s ticket number where you can find the reason

Also I can think of writing long descriptive function names, which will reveal the intention behind the implementation.

--

--

Igor Budasov
WebDevOps

A traveller. A drinker. A photographer. A blogger. An engineer.