4 ms·
Welp definitely disagree -- pardon the assumption but when you say "young OOP days" I instantly think Java/C# and I think the baggage in those languages leaves
by hardwaresofton 4y ago
Welp definitely disagree -- pardon the assumption but when you say "young OOP days" I instantly think Java/C# and I think the baggage in those languages leaves a bad taste when it comes to abstractions that were supposed to stay light.
Of course it would have been impossible to jump to the future for you and use better languages, but modern languages with static type systems (Typescript, Rust, etc) reduce the difficulty of writing and maintaining interfaces so much that even if you never need it you benefit.
I also still think that the documentation benefit (seeing structure without implementation) is worth it.
> Minimize complexity wherever possible.
Fully agreed here, pretty much unassailable.
- lopatin 4y agoJust because a language makes it easy to create and maintain interfaces doesn't mean that interface was a good idea to begin with.
- betenoire 4y agoin case isn't clear to other, types and interfaces are effectively synonymous in Typescript. typescript doesn't really bring in that other cruft unless you want it
- arcosdev 4y agotypes are so synonymous that there is no reason to use interfaces in TypeScript.
- monkpit 4y agoI would be impressed to see readable, non-trivial TypeScript code that does not use Interface. Unless you are referring to interface as a concept, and not the keyword in TS.
- nawgz 4y agoCan you use the “class MyClass implements MyType” keyword with types?? That might be the only reason if you can’t
- eyelidlessness 4y agoThere are several reasons to use interfaces in TypeScript: - they perform better at build-time and in editor - they have more relaxed rules for recursion - they can help identify complex types and distinguish them from simpler ones - they’re guaranteed to be usable to enforce class implementations, whereas only simple types can be used - they’re much easier to read in type errors
- arcosdev 4y ago> - they have more relaxed rules for recursion Do you have a source for this? I would like to read more.
- viraptor 4y agoYou can certainly write java/c# without abusing interfaces. They're just available, not forced on you.
- nimchimpsky 4y ago