I think many of you have seen some developers repeat some common subexpression. For example, it can be something like this:
Point newPoint = new Point(Field1[i+1].Field2.Field3.x, Field1[i+1].Field2.Field3.y));

As you can clearly see, the part “Field1[i+1].Field2.Field3” is repeated twice. Many developers will try to convince you that it is fine because the compiler can inline and remove common subexpressions and, as a result, performance will not suffer.

This statement is correct for almost any language, and it is actively used as an excuse to write this code, and I’ve seen and heard it way more than I wanted. But this code is quite bad, and it is why I always insist on fixing this code. Let