March 12, 2012

Ditch the Grids and Use DockPanels

I have worked extensively with WinForms and WPF/Silverlight and noticed that docking/dock panels are not used that often.  At least this is the case where I work.  I find this surprising given their power and ease of use. Using XAML, why would a programmer choose a complex Grid/StackPanel setup over a DockPanel?  Or on the WinForms side, set the anchor properties for control rather than simplify things with the dock property? Read more

February 14, 2012

Executing Actions Before and After Code Blocks with IDisposable

I ran into a scenario this week where a boolean field was being flipped temporarily to modify behavior elsewhere while a block of code was executing.  I have seen this pattern mainly in WinForms applications where data are being loaded into controls, but their events need to be suppressed during the load.  Afterward, the events should fire normally. Below is an example of this scenario.  It is a Windows form with a single combobox. Read more

January 30, 2012

The Best Design Patterns

The first time I read the Gang of Four Design Patterns book, I was impressed, no blown away, by the brilliance of what I was reading. The Visitor pattern utilizing double-dispatch. Brilliant. Chain of Responsibility. Why didn’t I think of that? Adapter. Simple and powerful. Of course I was itching to start implementing these patterns. In practice though they seemed to be applicable only in rare situations. Adapter, Builder, Factory, Strategy, were the most useful. Read more

© Joe Buschmann 2020