aspose file tools*
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Code to Interface in Groovy" Watch "Code to Interface in Groovy" New topic
Author

Code to Interface in Groovy

Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

Hi,

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

Thanks.


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

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Code to Interface in Groovy