Eugene Fedorenko is Writing, Reading, and Traveling

Are you writing legacy CSS code?

One of the most sane articles I ever read on code refactoring, writing maintainable CSS, and visual regression testing.

On a definition of “legacy code”:

In his 2004 book, Working Effectively With Legacy Code, Michael Feathers describes a different definition of ‘legacy code’. He defines it as code that is not covered by tests. That’s it. If you think about it for a moment, it makes sense. It applies to old or new code. It focuses on maintainability and understandability. Code without tests is hard to change with confidence.

On visual regression testing:

Visual regression testing tells you that something has changed. The tests themselves do not describe how we expect the system to behave. When a test fails, we still have to interpret the visual diffs to identify both what the expected layout is, and how our implementation differs from it. It’s really a more consistent, sensitive and faster version of manual cross-browser testing.