2 ms·
This is an interesting idea and I think it's interesting to have it somewhere in mind while programming. A few thought though : - If you really push this to t
by jre 14y ago
This is an interesting idea and I think it's interesting to have it somewhere in mind while programming.
A few thought though :
- If you really push this to the extreme, you'll end up with all the logic hidden in the classes inheritance hierarchy. I'm not sure this is more readable/extensible than if/else statements.
- Most of the example given by the author to use "language features" are just syntactic sugar. Using collection.select instead of collection.each or || instead of if else is really just a matter of notation. I doesn't reduce the number of test cases required for your code and it might lead to "magical" one-liners that you have to read 20 times to understand.