4 ms·
Go OO is like Java only they took stuff away. They took away class extension and they took away the requirement that you declare interface implentations. So if
by jxcole 15y ago
Go OO is like Java only they took stuff away. They took away class extension and they took away the requirement that you declare interface implentations. So if you have all of the functions required for an interface then you implement the interface, no need to be more complicated.
So it's hard to see why people from an OO background (assuming an OO background like Java or c++) would have a problem with it. It's like that only simpler.
- lukesandberg 15y agoI guess go interfaces are like c++ template implicit interfaces except the interfaces have names instead of just protocols. I think the reason that it can be difficult to grasp is because it isn't as explicit. Maybe OO programmers are afraid of the crazy gcc error messages you get when you incorrectly instantiate a template in c++ and think you might have the same difficulty. Whereas explicit interface implementation declarations give you better error reporting. I have very little go experience but when I first learned about go interfaces that is where my mind went.
- tspiteri 15y ago> they took away the requirement that you... They removed a restriction. If you are restricted less, you can do more, but you have to learn the new things you can do. Java people can still do what they're used to: that is simpler, they just do not declare the interface implementations. But they are still not using Go fully.