4 ms·
I don't think this article captures the main advantage – when you have layers of logic, eliminating special cases lets you have O(n) pieces of code instead of O
by SatvikBeri 8y ago
I don't think this article captures the main advantage – when you have layers of logic, eliminating special cases lets you have O(n) pieces of code instead of O(n^2). And even if each portion is less readable, 100 functions beats 10,000 functions any day.
A good example of this is making values non-nullable by default, with Optional types, and eliminating a huge swath of special case handling.
But the benefit doesn't show up without significant scale, and isn't worth it for functions that are just used once or twice.