3 ms·
I have seen terrible and unreadable generic code, people building abstractions just for the sake of abstractions. Hello-world level projects with 20 class deep
by theshrike79 5y ago
I have seen terrible and unreadable generic code, people building abstractions just for the sake of abstractions.
Hello-world level projects with 20 class deep hierarchies of generic classes, just to make it "generic" in case you need it later.
- doctor_eval 5y agoI agree. It’s true for all languages. I once had to untangle a small Java app that had about five packages with two classes per package (I refactored it into a single package). Some people will abuse generics, no doubt, just like my colleague abused packages. But Go has such a strong culture around idiomatic code that I’m not too worried that generics are the end of the world. In fact, I don’t like keywords like “append” and I’m hopeful generics will replace them. TBH I was more upset about the Go 1.17 ability to panic during a type conversion from slice to array pointer. That one really grates my gears.