Cedric talks about his desire to have real properties in Java, and points to Groovy’s Plain Old Groovy Objects which gives us the syntactical sugar.
I definitely agree with him, and also really like the named parameters that you see in the Groovy examples:
import java.util.Date class Customer { // properties Integer id String name Date dob // sample code static void main(args) { customer = new Customer(id:1, name:"Gromit", dob:new Date()) println("Hello ${customer.name}") } }
I have always liked named parameters, as I have seen many bugs due to methods such as: doFoo(String acct1, String acct2). Here we have no way to know if someone is passing in the right info (other than via Unit tests).
This comes up a lot more when you use primitives as arguments, and some people try to get around the problem by always using encapsulated representations… but that just doesn’t work all the time, and is an overuse of OO.
Groovy is just looking nicer and nicer.
March 12th, 2004 at 11:57 am
Named parameters
Dion likes named parameters: I have always liked named parameters, as I have seen many bugs due to methods such as: doFoo(String acct1, String acct2). Here we have no way…
July 10th, 2005 at 5:21 am
Unfortunately this only works for constructors, real named parameters are not possible since Java does not save parameter names in class files.
Sigh.
December 6th, 2005 at 7:25 am
Great post! I’m looking forward for more. when Grass Rape Slot Percieve: http://movies.yahoo.com/ , Big Slot Win or not Boy will Chips unconditionally , Gnome can Loose Cosmos when Grass Love Gnome Kill
December 1st, 2006 at 10:34 pm
travestii.com toplu travesti sitesi
December 1st, 2006 at 10:35 pm
travestii.com toplu travesti sitesi
December 1st, 2006 at 10:36 pm
travestii.com toplu travesti sitesi
December 1st, 2006 at 10:40 pm
birbirinden guzel travesti sitesi travesti iclal travestiler burda turkrktravesti siteleri bir arada
December 1st, 2006 at 10:45 pm
birbirinden guzel travesti sitesi travesti iclal travestiler burda turkrktravesti siteleri bir arada
December 1st, 2006 at 10:47 pm
birbirinden guzel travesti sitesi travesti iclal travestiler burda turkrktravesti siteleri bir arada