3 ms·
The Simple Ways to Refactor Terrible Code
- fjfaase 6y agoPlease run your example code. What is isFourHundradthYear?
- fjfaase 6y agoPlease note that what is hard to read is not the same for everyone. Some people find it easier to read complex expressions (with nested && and ||), while others find it easier to read when temporary variables/functions are used with explicative names. Having to look up a function/property with a simple expression is also breaking the flow of reading code. If there were simple rules to what makes code easy to read, than we would have a lot of better looking code. Especially, if you are working in a team, you have to adapt to some common ground, even if that is not what you prefer yourself. I also think that this is what defines a good software engineer: not someone who writes smart code, but someone who writes code that is readable to most people in the team.