Thursday, January 7, 2010

The Most reusable code in my libraries

  • First and foremost I think is the Member class  
    • No more binding using brittle string literals. 
    • Compile time member access name safety.
  • BDictionary
    • Allows for reference of a an item by key or by the index
  • String Transformations
    • Can take comma separated values,CR/LF, excel copied, SSMS results column copied  and transform them into
      • a SQL in clause
      • an array initializer
      • a string array initializer
  • bThread(of T)
    • Threading implementation with strongly typed result value
    • Wraps processing in try/catch so the thread doesn't throw an exception
  • bMacros - originally named bVbMacros but the snippet section does C# now
    • takes a partially formatted string and creates a code snippet for use in Visual Studio
    • Takes a VB object constructor and automatically generates backing fields and public readonly properties to expose those values
  • DebuggerWriter:System.IO.TextWriter
    • Wrapper to allow you to stream output to the Debugger
  • XmlFont
    • Makes serializing a System.Drawing.Font simple
  • Windows Forms specific:
    • TextBoxWriter:System.IO.TextWriter
      • Wrapper to allow you to stream output to a WinForms Textbox
    • Control Extensions
      • Extension methods for thread safe operations on the UI
      • Extension methods for nullable value binding
      • An extension for populating a comboBox with an enum Type's values
    • ErrorProviderManager
      • Wrapper for the ErrorProvider class
      • Centralized repository that takes a control, a Func delegate and the associated error message.
      • hooks into the control's validating event to run all the Func associated error conditions, if it fails validation, the ErrorProvider is updated accordingly, and vice versa
That's a fairly small amount of really reusable code. To me, whether or not the reusable code I wrote gets reused much is important, but so is what I learned from aiming for framework-worthy code and learning from the failures.

No comments:

Post a Comment