News Stay informed about the latest enterprise technology news and product updates.

LINQ in Visual Studio 2008 addresses object data modeling

In the relational world, a database is normalized and data is spread across many different levels. At the object layer, developers have to deal with the data as if it was still in tables. A user tells us that LINQ, a key ingredient of Visual Studio 2008, addresses this so-called impedance mismatch.

So far it has been a year of deployment for Visual Studio. Recent years have been full of one new tool or language capability after another. Ahead of PDC, it is worthwhile to view what people are doing with what they have now in Visual Studio 2008.

Some developers report dramatically boosted productivity with the new tool set. Some of the key improvements are coming from features like LINQ, Team Systems, and Windows Presentation Foundation.

For example, Mark Michaelis, enterprise architect at Itron and author of Essential C#, said he was able to vastly simplify complex applications that interacted with databases thanks to LINQ, which has reduced an entire application layer. Before LINQ, he spent six-work-months just writing this layer for one app, which also had to be maintained after development.

He noted, "Ever since we had the relational database model and OO code there was no way to handle that impedance mismatch. LINQ allows us to bridge that gap so that we can write OO code that deals with the data stored in the database."

"What is unique about this solution, Michaelis continued, "is that it is integrated at the language level. In the past, vendors provided us with rich APIs, but we still had to manage strings. With LINQ we can write OO code that interacts with the database in a seamless fashion."

The main advance is that he no longer has to normalize the database. Michaelis explained, "In the relational world, I have to normalize the database. I have data spread across many different levels. At the object layer, I had to deal with the data as if it was still in tables, even though the OO world provides a richer set of structure and hierarchies. When I had to expose the data to the client I had to keep the same format as if it was in tables. With LINQ, I can circumvent the restrictions with the database."

For example, if Michaelis wanted to query across a set of customers in the old model, he had to write a data query layer that pulled out every column from the customer database, which added significantly more data than needed in order to maintain consistency. With LINQ he only needs to pull the data required, and this can be done with pinpoint precision.

Michaelis estimates the development experience is an order of magnitude better than before. He gets a runtime improvement in performance as well because the data layer is much smaller, although this is not nearly as significant as the development improvement.

The specific application performance improvement depends on the scenario. In some cases, there was no improvement, but in others, it was an order of magnitude faster because they were selecting so much extra data. But the driving factor is how much faster they can develop and how much less code they have to write and maintain.

Michaelis is also impressed that the LINQ API can be used as an API for any collection. He said, "With LINQ, I can interact with a collection of processes or files running on the computer. I can interact and integrate with them exactly as I would integrate with a database. Now I just learn the syntax once and use it with anything I am interacting with. I can use LINQ to interact with the file system or make calls to all of the processes whose name begins with a 'P' or that are running out of this directory."

The unit testing code coverage capabilities in VS 2008 Team System have improved Itron's project management flow significantly as well. This allows the developer to see how much code has been tested in a large project. When someone on his team checks the code, the server automatically compiles the code, and runs a unit test on it behind the scenes. The programmer can see that the test was run, and can see the percentage of the code that was actually tested.

Michaelis said, "The end result is that by the time I hand the code over to QA, I have a smoke test of the status of the code. This also gives the manager a pulse of how the project is progressing. This enables the best practice of keeping that continuous innovation running. This is very helpful for project management."

The only significant challenge Michaelis has found with Team Systems is that the tasks are not hierarchical. This makes it difficult to break a large project in sub-tasks as large projects are displayed in the same level as individual to-do items. He said, "That was an improvement that we were looking forward to, but they have not put it into 2008. In the real world, we have big tasks broken into smaller tasks, and currently Team Foundation Server does not let you do that."

Dig Deeper on Visual Studio 2008 and Language Integrated Query (LINQ)

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

SearchCloudApplications

Close