Tigraine

Daniel Hoelbling-Inzko talks about programming

Useful Resharper Live Template for WPF development

While doing some work in WPF for a customer project I found myself writing far too often code like this:

private bool isSelected;

public bool IsSelected {     get { return isSelected; }     set     {         isSelected = value;         OnPropertyChanged("IsSelected");     } }

Auto-properties simply don’t work with INotifyPropertyChanged so you have to do all the grunt work over again .. Thank god there is Resharper!

It’s said lazyness is a virtue on a programmer, so I made this little Live Template that will create all that code with you only having to fill in type and name of your property:

image

Download it here: wpfprop.xml

Filed under net, programmierung, wpf

Keep away from regions!

Well, I’m currently digging a bit deeper into WPF and the thousand little things you can do with it. Naturally I’ve been looking through my fair share of demo apps and tutorials too. And that’s where I stumbled upon this little gem of information hiding:

image

Exactly, that is what you get to see of a 200 LoC file when opening it up in Visual Studio. And the author did that for every single file, so whenever I opened a file I had to hit “Toggle all outlining” (Shortcut by default is CRTL+M, L).

Now, I’m all for clean code and tidy classes. But there are one thing fundamentally flawed with regions:

Once you need regions – Your code is simply too long.
My most successful (and biggest) project to date had no class that exceeded 100 lines of code, and you simply can’t imagine what a joy it was to work with that codebase. You simply can’t put enough logic into 100 LoC to make it hard to test, just by limiting the length of a class  you also lower the possible complexity of test and maintenance by a huge amount. Nice side effect: 100 LoC almost fit onto one screen so you understand the code without having to scroll through 3 pages of code to look up the name of a field.

Fix the root problem, not hide it!

What again reminds me of Jeff Atwood and he is totally right:

image

Filed under net, programmierung

The dark side strikes again!

image

Oh, Microsoft took it’s sweet time with Visual Studio 2010 and C#4 but now that it’s finally here I had to find out that the Vibrant Ink theme I’ve been using for years now needs an update to match new stuff in the language.

Thank god I did a quick search to see if someone already did that, and I stumbled on a pretty cool little website: studiostyles.info
A website dedicated to Visual Studio Themes, apparently written in ASP.NET MVC it allows users to create styles with a pretty simple editor and then share it with the world. They also added voting and some community stuff to it, but even if it was only a user-generated theme gallery for VS I’d love it. Cool stuff.

Anyway, Luke Sampson (the creator of studiostyles.info) updated Rob’s Vibrant Ink theme for VS2010 and shared it through studiostyles. Thanks a lot.

You can find it here: http://studiostyles.info/schemes/wekeroad-ink

Filed under net, programmierung, internet