Do you amass nasty feelings about your designs?

I remember the time when structured programming lessons first came into my attention. Control flow constructs like sequence, choice, loops, etc.

In particular, the condition-controlled loop that places the condition test after the loop body, for example do-while loop of C/C++ or C#, or Repeat-Until loop of Pascal. I have not seen this type of loop very often in programs, in my experience, from the group of condition-controlled loops, the most frequently used is the loop that places the condition test before the loop body.

For example, the operation of reading string lines from a text file, I have seen it many times expressed as the following loop in C# code:

 void showfile(string filename)
{
 using(StreamReader reader=File.OpenText(filename))
  {
       string textline=reader.ReadLine();
      while(textline != null)
     {
           Console.WriteLine(textline);
            textline=reader.ReadLine();
     }
   }
}

It works but, I don´t like the nasty feeling left by invoking ReadLine method in two different places.

Using the do-while loop in C# –as in the following code– then that nasty feeling disappears and instead a somewhat emotional pleasure is left (see "Miroyokutaki hinshitsu").

 void showfile(string filename)
{
    using(StreamReader reader=File.OpenText(filename))
  {
       do
      {
           string textline=reader.ReadLine();
          if(textline == null) break;
         Console.WriteLine(textline);
        }while(true);
   }
}

Many software designers –I have seen– tend to disregard their own nasty feelings of this kind and their detailed design (source code) is less, much less of what it could be.

Fortunately, professional software designers do not ignore such nasty feelings about their designs.

For example, Andrew Koenig and Barbara E. Moo write very good insights about design in the following work:

Accelerated C++ Practical Programming by Example
by Andrew Koenig and Barbara E. Moo
Addison-Wesley, 2000
ISBN 0-201-70353-X
https://www.acceleratedcpp.com/