Hacker News new | past | comments | ask | show | jobs | submit login
Using Go's interfaces at Clever – more than just easy collaboration (clever.com)
63 points by schimmy_changa on April 17, 2015 | hide | past | favorite | 6 comments



Go is an interesting language. I get it. But there is nothing unique to Go about their use of interfaces in Sphinx. This presentation is about the usefulness of interfaces. Something that can be done in almost every modern programming language.


I think why there's interest is because the way they're implemented in Go is a nice intersection between duck typing and type safety. In most type safe languages (eg. java), you explicitly have to say that you want your goose to pretend to be a duck. In most type unsafe languages (eg. python), you don't have a way (or, at least without type annotations) to say what features you need to pretend to be a duck.

You're not wrong. That's what Go is about: Well tried techniques, implemented with well practiced knowledge.


I understand their presentation is not the most technically groundbreaking, but as someone who uses C++ in the day job and discovered Go for personal projects I had the same giddy enjoyment as the Sphinx engineers of discovering the power of not having to include explicit inheritance to satisfy an interface requirement.


Right, and this is a presentation at GoSF about Go's interfaces, and how they work with Go's testing packages.


The thing about interfaces and Go that is kind of unique is that unlike with Java you don't need to declare up front that a struct implements a particular interface. And you can easily have a sort of interface composition like if you have a io.ReadWriter interface which is just a 'virtual' interface that implemements both io.Reader and io.Writer interfaces. Not a breakthrough in CS but still a very convenient and not so common thing.


I think the point was implicit interfaces, that can actually be easily created before or after the implementation is finished.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: