On Sun, Jan 11, 2009 at 2:07 AM, Luke B <[email protected]> wrote: > Huh. Yeah, I don't really know the history of Generics in each language. I'm > assuming there's value in the .NET model, but I still find the Java model > more intuitive to program in. The reason is that I think of Generics as > something that are "contained" in a class, while being separate of the > class. So something like: > Mug<Cocoa> yourdrink = new Mug<Cocoa>(); > Mug<Coffee> mydrink = new Mug<Coffee>(); > Mug.topology = Doughnut; > makes more sense, I the general shape of all Mugs shouldn't be dependent on > what liquid they contain. I can see the value of the dotnet approach too, > but its just simply less intuitive.
I disagree entirely, and I was a Java developer long before I learned C#. I find the Java system incredible mind-bending and the only difficulty I had transitioning to the .NET model of generics was unlearning the Java model (which was a joy). There is nothing worse than enforcing the use of .equals and friends over what should effectively be primitive types, but are actually objects. And, of course, there's the memory footprint you create by boxing primitives for no good reason. What you're specifying there, by the way, actually doesn't even make sense since data like that would be better exposed in a property (or getter method, if we're talking Java) since it's not something you would expect to be able to set about all Mugs that exist in an application all at once. -- Chris Howie http://www.chrishowie.com http://en.wikipedia.org/wiki/User:Crazycomputers _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
