TechHui

Hawaiʻi's Technology and New Media Community

Microsoft released VisualStudio 2008 last week. We now have a production version of C# 3.0 with LINQ. Using LINQ is much nicer than dealing with queries embedded in Strings. I really think Java is in dire need of something like LINQ. Thoughts?

Tags: C#, Java, LINQ

Views: 424

Reply to This

Replies to This Discussion

I agree wholeheartedly Dan. This is MS's most interesting innovation in 15 years, it should be ported thoroughly to Java.

Hehe this is an interesting topic for me as i work for a company which is quite polarised on platform evangelism (.NET vs Java). All the .NET guys love LINQ and the Java guys don't know what they're on about. I've had the pleasure of using it for a short term C# project and the one thing that stood out for me as dangerous (linq to SQL) was how easily you can forget that you're dealing with potentially expensive data queries in the background. I guess it boils down to the misuse of ORMs. If developers don't understand HOW the data is being queried, they cannot possibly account for performance deficits or even begin to understand where the performance problem is let alone how to fix it. 

(probably off-topic, but related...)
I've experienced a few issues before where (using Hibernate) we have had performance bottlenecks (thousands of concurrent users) where the requirement would be querying a combination of simple fields on an entity, but because the developers used reverse engineered hibernate mappings on a normalised database, the ORM was doing numerous joins in the background and pulling back an enormous amount of data which was not needed and came at quite a price. We ended up writing custom queries which dramatically improved the performance of the system. 


So i guess i'm nervous of a language abstraction for querying large data repositories in high-performance environments. As cool as it is, it can be troublesome. Although, more of an ORM concern than a LINQ concern. Anyone else have these types of problems before? 

 

 

@Tim - You have all the same problems with ORMs that use queries embedded in strings. The only difference is that they are opaque to the compiler (no types, syntax validation, etc.) I'm a huge fan of Java (16 years of experience including working on standards groups for the language and libraries), but I don't think there is any good argument against LINQ. Sure, you can misuse it and end up with expensive excessive joins and DB round trips but the same is true for HQL in strings. Bad programmers don't need any help hurting themselves. At least with LINQ queries become first order language constructs with type safety and syntax validation.

Note that LINQ works over any datastructure for which a provider has been written including in-memory data structures, XML, etc. It is by any measure an elegant language feature.

I agree it certainly is a great abstraction! I guess my comments were targeted more at the pitfalls of ORM tools rather than Linq. Although, I do believe that Linq2sql is an 'enabler' as far as this is concerned. I don't see many developers asking questions about the side-effects of using Linq2sql  (or other ORMs ), which worries me. The integration with datastructures of other types is useful though - I think java could really do with language integration as far as XML querying goes - it's part of almost all of our everyday lives and at the core of enterprise integration, so it makes sense that we should bring it into the language.

Would love to hear more about your involvement in the Java space!

 



Hi Tim - ORMs certainly can be enablers for excessive round trips to the DB, but they can also provide opportunities for smart frameworks to do clever optimizations. The more information your compiler and your framework have, the better, and LINQ provides a lot of information. In general, I've always thought modern languages should have generic language level support for queries over in-memory data structures, XML, databases, etc. I've seen multiple attempts to get it right including Oracle's ill fated SQL extensions to Java, but Anders Hejlsberg and his team were the first to really nail it with LINQ.

re: involvement in the Java space - Our team page contains details about our Java involvement. I poured many hours of my life into contributing to the Java community but I'm rather disappointed with the current velocity of its evolution and the politics in general.

Reply to Discussion

RSS

Sponsors

web design, web development, localization

© 2014   Created by Daniel Leuck.

Badges  |  Report an Issue  |  Terms of Service