An Opinion on Writing Test and Engineering Blog Posts

The other day, i read a blog post written by a certain software developer about his opinion on how a good developer should write a test. His post points out that writing test code is different than writing implementation code. Implementation code is about abstraction while test code is about readability. We can, and suggested to break some common discipline (eg. DRY) when writing test code in order to maximize the readability.

As i usually did when i just read some internet post or article, especially if it's related to my job, i'd like to discuss it with a friend. So i talked with a coworker of mine. He is self-declared opinionated guy, and an experienced software developer in his mid 30s. He also often becomes someone we consult about technicality in our team. I showed him the post and asked about his opinion.

After reading it for awhile, his opinion is kinda opposite to the author. He said the examples provided by the author is too small-scaled and it will be bad if we follow the author's opinion blatantly. The author's example showed that adding some verbosity is okay as long as it makes programmers understand what the test do from just looking at one test function.

It is okay if the our test code's scale is small, like for example, our own apps or something. For a large-scale app, like the company he and i worked at, usually have a lot of preparations before a functionality in which we want to test will be called. Putting all of this preparation code in all of the test functions is very bad.

The other thing he pointed out was an enterprise-level team like us, usually have a convention that is more important to write some part of the code to be like our personal preference (he mean if we want to write like that author advise).

He also said that that's why he hates technical blog post or engineering blogs in general. It can be misleading for junior programmers. They usually will take the authors opinions as is because of his regards towards the author who he seen as more experienced than them, while my coworker said it still counts as one person's opinion from the internet. If the junior programmer not careful enough he/she will be dogmatized by the author' opinion. It applies not only for engineering blog but also for all software engineering books out there like book about software architectures or refactoring.

I personally think that a blog post like what we discussed is not bad. I believe that the author's intention is not to dictate other programmers but just to express his preferences or opinions, which usually comes from his experience.

It also depends on us the readers, the programmers, who need to be open-minded and train our habits to think after reading some engineering blogs. This kind of blog's function, in my opinion, is to share and discuss ideas with other people. That's why there is comment section in the end of a blogpost isn't it?

And of course this post is just my opinion :)

Show Comments

Get the latest posts delivered right to your inbox.