In the previous part we looked over the MainWindow class and found some improvement points. Those were common mistakes with simple fix. We skipped a big switch block, because it needed more work, and today we are going to refactor that part. We will not refactor it to its final form, though, first, we just make it better. In a second blog post, we will improve the code more.
In this part we are going to take a look at the source code and try to answer the question that usually sounds like “what problems can you see at first look” or “what do you dislike when you look at this code” or “how would you change the code to make it better”.
In this series we are going to solve a programming test which was designed for interviews to see how a candidate can solve practical problems. During the test, we need to refactor and improve a small application.
I read a funny remark on ‘null’ comparison recently which at first glance seems to be surprising, but uppon further investigation becomes understandable. The following program demonstrates: The output of the program: False True How can the ‘Less than or equal’ operator be false, when it has the same value on both sides? And why […]
Not so long ago I’ve read a note in a blog comment. It said that experts above a certain level should write their for-loop as the following: The important part is the ++i. Why is this better? A vast majority of developers use i++, I haven’t any idea as to why. I use i++, too, […]
There are some misconceptions about Object.GetHashCode(). Two of them are quite prevalent: The implementation of Object.GetHashCode() derives the hash value from the reference (as a memory pointer value) of the instance The return value of Object.GetHashCode() is unique to the instance. No other instances will have the same hash value. These two claims may look […]