Archive for the ‘c#’ Tag

Dynamic LINQ != Headache

Had a bit of a headache today when i realised I needed to dynamically sort the results of a Linq query – with Linq being type-safe at first it didn’t seem straightforward. Then Scott Guthrie came to my rescue and saved me rewriting the whole darn thing to use a stored procedure. Phew!

Advertisements

Microsoft release source analysis tool

Microsoft have launched a new source analysis tool called StyleCop, similarly named to thier other analysis tool FxCop, but whereas FxCop is intended to check for good practice and standards against assemblies, StyleCop is more about checking good practice and standards in the source code itself.

Full details can be found on the MSDN Blog.

Initiatives towards encouraging well written, readable code are generally a good thing but it appears some already have some gripes with the standards MS are recommending with this tool – particularly with respect to the use of spaces over tabs – and the fact that, unlike FxCop, it is not possible to define one’s own rules, although having a set of common standards does imply one set of standards and not every “joe programmer’s” set of rules!

Also, it seems the tool simply reports the issues, which is as one would expect, and this has led some to propose that it should additionally perform a productivity function by automagically fixing all the issues as well.

It could be argued that in some respects it’s a good thing for a developer to return to thier code and manually correct these issues, since it might encourage a “right first time” approach in the future but with real world practicalities (deadlines et al!) I guess it’s a tough call to make.

Regardless, I’ll certainly be giving it a whirl – and correcting those issues …if I have time 😉

Update: 27/05/2008

It seems you can configure the tool to enforce or ignore specific rules.

Additionally when I took a look around the settings panel, under the “Settings Files” tab there are options to merge with additional settings files – as yet however I can find no documentation on how to create a settings file!