2 ms·
The main reason for YAGNI is not because of wasting time upfront, although it is part of the concern. The problem of trying to write generic code is that your
by analyst74 12y ago
The main reason for YAGNI is not because of wasting time upfront, although it is part of the concern.
The problem of trying to write generic code is that your generic code will inevitably become not generic enough, due to unforeseen changes of requirements. Refactoring simple code is much easier than to refactor complex abstraction layers.
Sometimes you'll find it impossible to write new abstraction layer that perfectly satisfy all implied requirements from existing abstraction layer and new requirements, and end up making compromises in areas like readability and performance, only to realize some of the implied requirements are not necessary ever.