So, lately I have been interested in learning more about the tools that are out there to help me increase the productivity of our rather small team. After a little searching I stumbled onto http://www.visualstudiogallery.com/ , this was a great source for new and interesting tools to support .NET development. As I Scanned through the offerings I saw there were toys for everyone. I thought that since I had a budget of little or none there would be just about that much offered to me. I was sure wrong about that… There are Code Metrics and Code analysis tools to help me ensure we have as high quality a product as possible, there are documenting tools for the members of the development team, there are even a few toys for the LINQ enthusiasts among us.
I am going to break my evaluation of these tools in to the above suggested 3 categories. First Management, then tools to assist in everyday development, and last things that were just neat toys but not all that useful.
FxCop
Type: Management
Source: Microsoft
Download URL: http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx
Price: free
FxCop is actually the utility that started this whole adventure, I recently read about as a sidebar in an article in one of the many .net developer oriented magazines. I did a quick search and found it available from our good friends in Redmond. It holds itself out as a rules based code analysis tool. Out of the box it comes preloaded with rules near and dear to the folks at Microsoft, it included more of their standards than I ever knew existed.
After downloading it and kicking the tires a bit I proceeded to turn it loose on our departments most recently deployed application. In no time it had a few suggestions to offer. By a few I mean 5000, and when I say suggestions, that is what they actually were. The application offered suggestions as to how to bring each warning into compliance. It reported on unused variables, anything that did not meet the .Net guidelines for naming, tense, even using a dictionary to make sure variables had a name that made since.
For my money, this is a great application to ensure that everyone working on the project stays on track, I plan to run it at regular intervals ensuring no other application gets so far out of spec, because in the end, we all want code that is as standardized as possible; it is just easier to support.
Next to be evaluated: Source Monitor 2
Monday, October 27, 2008
Friday, October 24, 2008
What is LINQ
LINQ (Language Integrated Query) is a component released within the .NET 3.5 Framework. It is one of the most powerful features of .NET 3.5. It serves the purpose of querying objects. It is a Microsoft programming model and methodology that essentially adds formal query capabilities into Microsoft .NET-based programming languages. LINQ offers a compact, expressive, and intelligible syntax for manipulating data. The real value of LINQ comes from its ability to apply the same query to an SQL database, a DataSet, an array of objects in memory and to many other types of data as well.
There is no one definition for LINQ, but it aims to solve the problem where we currently use different techniques for manipulating and selecting data from databases versus XML versus object collections; LINQ aims to make our life easier by giving us a coordinated, consistent and efficient syntax from our development environment and by using your one chosen programming language, rather than switching between programming languages.The current LINQ family of technologies and concepts allows an extensible set of operators that work over objects, SQL data and XML data sources. The generalized architecture of the technology also allows the LINQ concepts to be expanded to almost any data domain or technology, so what LINQ is today will expand in the future.
LINQ to SQL
The LINQ to SQL provider is just one part of the overall framework, however, it is a very powerful and attractive option when and ORM (see Object-relational mapping below) is called for. LINQ uses an SQL-like syntax to make query expressions well beyond the capabilities of embedded SQL as implemented in programming languages. That's because embedded SQL uses a simplified, streamlined syntax to add SQL statements to other programming languages, where there's no attempt to integrate such statements into the native syntax and typing mechanisms. Thus, you can't invoke native language structures such as functions in embedded SQL statements, as you can using LINQ, because it is implemented to use native syntax, structures, and typing mechanisms. Furthermore, LINQ may be used to access all kinds of data, whereas embedded SQL is limited to addressing only databases that can handle SQL queries.
In short LINQ to SQL can operate as middle ware between business objects and the database, the advantage of this may seem abstract but consider the following example. In SVT if we want to get just a single standard and do some work on it we first have to create a new object of type standard, next we tell the new object that it’s id is say 21. From here the standard object has been programmed to take that id and go call on other objects from the data namespace, it call a specific one the passes the standard id to a stored procedure which returns a query containing the desired info. Next, that query is returned to the standard object and it essentially, loops over all the columns in the query and populates a property in the new standard object for each one. Now (very simplistically speaking) we have our standard object, it has the methods and properties needed to do work. After we change a few things and tell the object to update the database, the whole process happens again in reverse. If on the other hand we were using LINQ we would simply write a 1 line SQL like expression passing the id of the standard we desired, and it would return a standard object ready to go. We could then edit that object and tell it to update and be done with it.
LINQ to Objects
The LINQ to Objects provider is used for querying in-memory collections, using the local query execution engine of LINQ. The code generated by this provider refer the implementations of the standard query operators as defined in the Sequence class and allows IEnumerable collections to be queried locally.
What this means is that when we want specific information from an array or other type of collection, instead of looping over the entire array, building another array of the desired data, we can simple query the array as if it were a table in a database.
Conclusion
The overall gain in productivity we realized by switching to LINQ is immeasurable, instead of taking all day to get everything needed in the SQLGateway class up and running, our team can do a LINQ query in seconds returning full blown already initialized objects. In an effort to make the implementation as effective as possible I dedicated months of personal research, read many books on the subject, countless articles, and attended several workshops. I felt that to make it all work I needed to become the departmental expert helping the others along as they were ready. As each team member came on board with the new concepts they too became very excited with the prospects and really wish other languages such as Coldfusion had similar features.
Object-relational mapping (aka ORM, O/RM, and O/R mapping) is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a "virtual object database" which can be used from within the programming language.
There is no one definition for LINQ, but it aims to solve the problem where we currently use different techniques for manipulating and selecting data from databases versus XML versus object collections; LINQ aims to make our life easier by giving us a coordinated, consistent and efficient syntax from our development environment and by using your one chosen programming language, rather than switching between programming languages.The current LINQ family of technologies and concepts allows an extensible set of operators that work over objects, SQL data and XML data sources. The generalized architecture of the technology also allows the LINQ concepts to be expanded to almost any data domain or technology, so what LINQ is today will expand in the future.
LINQ to SQL
The LINQ to SQL provider is just one part of the overall framework, however, it is a very powerful and attractive option when and ORM (see Object-relational mapping below) is called for. LINQ uses an SQL-like syntax to make query expressions well beyond the capabilities of embedded SQL as implemented in programming languages. That's because embedded SQL uses a simplified, streamlined syntax to add SQL statements to other programming languages, where there's no attempt to integrate such statements into the native syntax and typing mechanisms. Thus, you can't invoke native language structures such as functions in embedded SQL statements, as you can using LINQ, because it is implemented to use native syntax, structures, and typing mechanisms. Furthermore, LINQ may be used to access all kinds of data, whereas embedded SQL is limited to addressing only databases that can handle SQL queries.
In short LINQ to SQL can operate as middle ware between business objects and the database, the advantage of this may seem abstract but consider the following example. In SVT if we want to get just a single standard and do some work on it we first have to create a new object of type standard, next we tell the new object that it’s id is say 21. From here the standard object has been programmed to take that id and go call on other objects from the data namespace, it call a specific one the passes the standard id to a stored procedure which returns a query containing the desired info. Next, that query is returned to the standard object and it essentially, loops over all the columns in the query and populates a property in the new standard object for each one. Now (very simplistically speaking) we have our standard object, it has the methods and properties needed to do work. After we change a few things and tell the object to update the database, the whole process happens again in reverse. If on the other hand we were using LINQ we would simply write a 1 line SQL like expression passing the id of the standard we desired, and it would return a standard object ready to go. We could then edit that object and tell it to update and be done with it.
LINQ to Objects
The LINQ to Objects provider is used for querying in-memory collections, using the local query execution engine of LINQ. The code generated by this provider refer the implementations of the standard query operators as defined in the Sequence class and allows IEnumerable
What this means is that when we want specific information from an array or other type of collection, instead of looping over the entire array, building another array of the desired data, we can simple query the array as if it were a table in a database.
Conclusion
The overall gain in productivity we realized by switching to LINQ is immeasurable, instead of taking all day to get everything needed in the SQLGateway class up and running, our team can do a LINQ query in seconds returning full blown already initialized objects. In an effort to make the implementation as effective as possible I dedicated months of personal research, read many books on the subject, countless articles, and attended several workshops. I felt that to make it all work I needed to become the departmental expert helping the others along as they were ready. As each team member came on board with the new concepts they too became very excited with the prospects and really wish other languages such as Coldfusion had similar features.
Object-relational mapping (aka ORM, O/RM, and O/R mapping) is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a "virtual object database" which can be used from within the programming language.
Subscribe to:
Posts (Atom)