Should I define interfaces in Duck Typed languages?

前端 未结 4 1927
清酒与你
清酒与你 2021-02-05 13:31

I\'m just about to write my first application in a duck typed language (Groovy).

If I was to write the same application in a static typed language then I would need to d

4条回答
  •  梦如初夏
    2021-02-05 13:53

    Defining an interface is a kind of in-code documentation. With an interface you declare explicitly what you expect from the class to satisfy your needs.

    PS: groovy is not my language, so I actually don't know whether it's possible to define interfaces there at all.

提交回复
热议问题