This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Groovy and the fly likes Code to Interface in Groovy Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Code to Interface in Groovy" Watch "Code to Interface in Groovy" New topic

Code to Interface in Groovy

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959


I'm starting to learn Groovy and I like it. I'm just wondering if in Groovy it's still a good practice to code to interface since we can rely on the duck-typing? I know we still can have interfaces in Groovy, but I'm trying to code like a Groovy developer and not a Java developer


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

The "best practice" of "code to the interface" doesn't even necessarily mean you'd create any interface types, even in Java.

From experience, I don't think it makes sense to create actual interface types in Groovy. I even avoid doing so in Java unless absolutely necessary.

A good workman is known by his tools.
wood burning stoves
subject: Code to Interface in Groovy
Similar Threads
What is Groovy and in which cases we need Groovy?
Question for Mr. Davis
grrovy's own API?
why groovy? or when will developer use it?
Jython with JDK1.5