Kathleen Dollard in Boise tonight

Wow, two great speakers in less than a month. Last month, we had Kalen Delaney speaking at Boise’s inaugural SQL Server User Group and tonight at the Idaho .NET User Group, Kathleen Dollard an INETA speaker is sharing her “Twelve Gems and Eight Dragons talk.

dollard

Here are the Twelve Gems

  • System.AddIn – one of two new features in 3.5 that are getting overlooked; allows you to let other people provide customization to your application; wraps everything about managing app domains; check out the Pipeline Builder tool on CodePlex
  • HashSet – sets = groups and very high performance, and sets are mutable; LINQ allows set-type functions, but is missing some features and always returns copies
  • WPF Async Data Loading – Asynchronous behavior offered for instance loading and (sometimes) property retrieval, by leveraging the ObjectDataProvider IsAsynchronous property in XAML
  • Generic Classes C# – Generic classes encapsulate operations that are not specific to a particular data type; the most common use for generic classes is with collections like linked lists, hash tables, stacks, queues, trees, and so on. Operations such as adding and removing items from the collection are performed in basically the same way regardless of the type of data being stored; Why generics? improve performance, enhanced behavior with 3.5, improve robustness by catching typing errors at compile time, reduce amount of code via generic refactoring; Kathleen’s guidance is to stop using System.Collections and replace it with System.Collections.Generic
  • Refactor/Rename – in her opinion the most commonly used refactoring; now available in Visual Basic as well
  • Snippets (your own) – Microsoft’s provided snippets are marginal; Kathleen says not to use Microsoft’s snippet editor, but rather Bill McCarthy’s Snippet Editor 2008 instead
  • Understanding Your Code – static analysis (FxCop, VSTS Code Analysis – but custom rules are hard), code-based analysis (CodeIt.Right and StyleCop), and VSTS Code Metrics (maintainability index, cyclomatic complexity, depth of inheritance, class coupling, and lines of code) – cool and (some parts) are useful, unit test code coverage, and performance
  • Data Driven Unit Testing – data sources define conditions, can be Excel, quality team can be included and expand the list, consider naming classes by condition, do not demand 1:1 class correspondence, and anticipate n:1 test correspondence
  • Extension Methods – Extension methods enable you to “add” methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type so you don’t have to wait for Microsoft to provide functionality you’2013-08-28 18:17:51’ve been waiting for;
  • System.Exception.Data – a key/value pair collection to provide additional, user-defined information about the exception
  • Partial Methods – separate responsibility, pretty useless unless they can interact; partial methods allow interaction between partial classes; they required definition of clear extensibility points and are a replacement for intra-object dependency
  • Document Outline – provides an outline view of elements and scripts in the current document (Web or Windows forms)

Here are the Eight Dragons

  • VB vs. C# nullable operators – be careful here because a lot of combinations of =, <, >, etc. may give unexpected results
  • Inheriting from Collections. Generic.List – Microsoft decided List should have max performance so they sealed everything to avoid virtual table calls, so you can’t modify, add events, anything;
  • Interface versioning – everything implementing the interface is broken, so create a new interface or consider using a base class
  • Immutability in anonymous types – once you place something in a dictionary, its hash must not change; anonymous types are used most in LINQ; in C#, all instances of anonymous types are immutable, but VB uses a key to define a immutable fields of anonymous types and if the key is missing, it will use reference semantics so for LINQ consistency, uses full value semantics in LINQ
  • The New constraint – the most useless piece of junk related to generics; generics provide 3 constraints: base, interface, and new; the “New” constraint requires public parameterless constructor and this is not consistent with most good development; instead you should use reflection to instantiate
  • Unexpected LINQ evaluation

Landscape Complexity

  • if we are feeling overwhelmed (and we should be given the complexity of .NET 3.5) with so many languages, data bases, server solutions, data access, presentation
  • There is a frightening pace of change, which is a generally a good thing, but we are losing hobbyists, one man shops
  • No one is competent anymore
  • You cannot know it all
  • Code for change – assemblies (n-tier and beyond, wrap XML, wrap communication, wrap office automation, wrap special library access) , class design (interface coding, partial classes, generics), code design (lambdas, LINQ core), big picture (source control, CI, reluctant polyglot programming, code generation, testing, metadata – DRY4D – don’t repeat yourself in the 4th dimension (time)

Other terms overheard this evening

  • Polyglot Programming – using the best language for the job; in this case, C# or VB ๐Ÿ™‚
  • CTRL + Shift + V – Cycle through the clipboard in Visual Studio
  • CTRL + A + C – Copy the text out of a dialog window