I started to refactor a file of a few hundred lines of code. I had a vision how clean it will look. It took more days until I realized it takes more time to refactor the whole file. My tech-lead suggested to cut the task which I did and refactored only one class. It became really cleaner. It could've been used as a base class but people didn't use it but continued to use the quick and uglier way of the other classes.
I started to refactor a file of similar size now because it always takes some mental effort for me and for me coworkers to understand the structure of the file. It was written by one of the coding heroes of the company, it's dense and tangled and still verbose at the same time. It takes a few minutes to run all the tests for it so I made a relatively big change that didn't look harmful, I was just factoring out some helper functions. When I finished, I ran the tests and they failed. I got frustrated. It took me quite some time to find out that I had forgot to set an environment variable before running the tests. There was even a warning printed that could've suggested that but it was lost in the many lines of other logging output.
No comments:
Post a Comment