Java Deep

Pure Java, what else

Code Naked

  • I can not merge your pull request on our Git.
  • Why?
  • There is only one file modified.
  • That is because we modified only one Java class.
  • That is exactly the problem. I can not see in the pull request the modified JUnit test.
  • I could not modify the unit test because there was no any.
  • I see. And that is a problem of the past. The present problem is that still there is no unit test.
  • But we have no time to write unit test for the whole program. There are zillion of lines of code developed during the last few hundred years. They have no unit tests and they just work.
  • I acknowledge that. That is the life when you maintain legacy code. But why did not you write unit test for the change you just created?
  • There are zillion of lines already…
  • Yes, those that “work”. But your change is new. How do you know that it works?
  • We just agreed that we do not start to write unit tests now. We do ad-hoc testing.
  • Okay. Then let’s just get back to the basics. Why do we have unit tests? What is the primary reason?
  • To have working and tested code.
  • Im my opinion this is more like documenation. Unit test is a live documentation that is more likely to be maintained than any other documenation. You just created a few lines of code without documentation.
  • I get your point, but we just do not have time for that.
  • Let’s look at the following situation. It is summer and hot. You wake up late and want to rush to fetch the bus. You take the shower and drink your coffe and run to the bus. Right?
  • Right.
  • You do not even dress. Run out naked.
  • No! No! I dress!
  • But you have no time. You are in a rush. If you have time to dress yourself why do you let your code run to production without unit tests naked?
  • I get the point. But you can survive without unit tests. If you run on the street naked you will not survive.
  • Why is that? The summer is hot, you will not catch cold.
  • Yeah, but police would catch you.
  • So this is a kind of society issue, is it?
  • Yes, it is.
  • And the coding society is not that matured yet, it lets you run naked without unit tests.
  • I assume… yes.

we still have a long way to go ahead of us…

6 responses to “Code Naked

  1. tamasrev May 2, 2016 at 9:00 am

    So, we walk on the street naked because everybody else does. Thus we have lots of code out there that “works”🙂

    Like

  2. Stefan Reich May 2, 2016 at 9:20 am

    So you’re the “police” kind of guy. I think that’s why my algorithms are better than yours.

    Like

  3. tvk May 2, 2016 at 11:57 am

    There’s always time for having a conversation about having no time for writing unit tests.

    Liked by 2 people

  4. Vasile Boris May 17, 2016 at 2:22 pm

    There are projects were the clients do not want to pay for unit tests. I did not worked in such a project but I heard that it is a common practice. I heard that they explain that they will do the testing so there is not need to also unit test it.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: