3 ms·
I think he missed one of my favorite uses of classes: a collection of implementations of defined methods, especially if you can't pass around function pointers.
by sukuriant 15y ago
I think he missed one of my favorite uses of classes: a collection of implementations of defined methods, especially if you can't pass around function pointers. For example, you're working with a Reader and the Reader is something that needs to be able to read() and flush() and open() and close(). You use that Reader everywhere with those abilities. You don't care how they work, you just need for it to be able to do those four things. If you're expecting different Readers, it's useful to have a Reader interface and then classes that implement it.
Unfortunately, this is the only way to perform this activity in Java. Also, I adore Go's style of pseudo-OO programming.
.. or, from reading the HN threads, is that decoupling?
If so, I'm using decoupling right now!
- ibejoeb 15y agoI think he addressed that (or a very similar circumstance) while talking about the stdlib heap, and again in response to the question on "bag of related functions." I don't think he'd take issue with your position. Alternatively, if you are working with things that you expect to follow a certain interface, Python does not really require a formal definition. Duck typing should suffice.