Bug in the C# Yellow Book
/Phiko even sent a diagram explaining the mistake
My C# Yellow Book has been out for a while. I still get emails every now and then with corrections to the text. Phiko got in touch last week about an error that nobody else has spotted. At the start of the book we write a program which works out the amount of wood and glass required to create a window. It contains the statements:
glass area = width of window * height of window
wood length = (width of window + height of window) * 2
Phiko explained that this is wrong, because the length of the wood required must include enough to make the corners of the frame. So, to work out the correct length you also need to factor in the width of the wood too. This all goes to show the importance of testing. If I’d actually tried to make a window using the amount of wood calculated by the code, I’d have found the problem immediately. I think Phiko has a great future as a developer. Well done. I’m going to update the example in the next version of the book.