Better formatting for collection initializers with Resharper

January 3, 2010 21:42

By default, formatting for collection initializers doesn't look really neat with Resharper.

Just type some initializers or paste them from another place
or reformat existing code - and here's something you will probably get:

var hmm = new NewYearHangover
            {
                Year = 2010,
                Place = new Place
                        {
                            Latitude = "40º 55' N",
                            Longitude = "21º 00' E"
                        },
                Memories = new Memories
                           {
                               Conversations = new[]
                                               {
                                                   "Philosophy", "Aviation", "Children"
                                               },
                               Fun = true
                           }
            };


However, you can easily make it less space-consuming. How about this:

More...


Static initializers vs Static constructors

December 27, 2009 18:40
class One
{
    private static string me = "Am I different?";
}
class Two
{
    private static string me;
    static Two() { me = "Am I different?"; }
}

There's a certain confusion around static constructors. Why should we use them instead of static initializers? Any difference between the two samples above?

The rule of thumb is simple. If you want to control the time when CLR would initialize static fields, add the static constructor. If you don't care - skip it and use static initializers.

More...


Poised for the next big thing

December 18, 2009 10:08

Update: Not actual anymore. Thanks to all interested.

My contract with the current employer prematurely ends in January 2010, so I've started looking for the next big thing.

If  your company is in EU and needs a .NET expert passionate about agile development - please drop me a line at andrew[AT]codevanced[DOT]net to get the CV and discuss the opportunities.

Interestingly enough, quite a few of my colleagues also have their contracts finished in January. So if you're looking for hiring a team of highly skilled professionals,  I'd be more than happy to discuss that as well.


NDepending Resharper

November 29, 2009 19:58

Doesn't it look like Christmas has already started? Recently I had the pleasure of being contacted by Santa Claus Patrick Smacchia, lead developer of NDepend, who offered me a free Pro license.

(In case you don't know: NDepend is an awesome static code analysis tool to measure quality of .NET apps in a bunch of ways, including code metrics and bewilderingly abstruse, yet
amazing, visualization approach.)

Woo-hoo! I remember playing with a trial version last year, which was kind of nice, but a free Pro is a free Pro. The offer didn't require a blog post in return, but very soon I realized that I cannot but post... because I'd picked up Resharper as a guinea pig.
More...


Mock-n-Roll: an overview of mocking frameworks available for .NET

November 22, 2009 20:52
A while ago your humble correspondent conducted a talk on mocking frameworks here in Prague.

Thanks to all who attended, it's been a great pleasure for me to present. As usually, if you have any questions you didn't ask there, feel free to drop a comment or two.

You can find the slides and the transcript here. Enjoy!

Distributed Agile Development

November 15, 2009 22:34
A week ago your humble correspondent conducted a talk on Distributed Agile Development at ESWC in Berlin.

You can find the slides and the transcript here. Enjoy!


Upcoming talks

October 25, 2009 23:08

November is going to be busy this year.

On November 7 I'll be talking about Distributed Agile Development at ESWC in Berlin. Tried to make it both hilarious and insightful - we'll see if it would pan out. At least the slides are drawn by hand.

And on November 11,
just 4 days later, I'm doing an overview of mocking frameworks at Microsoft here in Prague - mostly a coding session highlighting the differences between Isolator, Moq, NMock2, Rhino Mocks and Pex.

More...


Type safe route registration in ASP.NET MVC

October 18, 2009 17:25

A few days ago my workmate Ian made a point that there should be a nice way to implement type safe route registration in ASP.NET MVC.

Type safe! Can anyone read these words without experiencing a tug of excitement, without being swayed by the view of departed bugs and newly arrived refactorings on controllers and actions - refactorings that don't break your app?

Indeed, type safe is possible. Here's how we register our routes now:

routes.MapRoute(
    "viewProduct",                                                        
    "{locale}/{product}/view/{mode}/",                                 
    new { controller = "Product", action = "Display", mode = "full" }  
);
 
and here's a type safe way:

routes.MapRoute(
    "{locale}/{product}/view/{mode}/")
     .On<ProductController>(x => x.Display("full"));

More...

Twitter Geek Quiz at Typemock

October 11, 2009 03:27
Geeks - you gotta love it.

You say you're pretty lazy when it comes to technology. That you expect your gadgets to do all the mundane stuff, while you focus on the high level important tasks like reading blogs.

So on October 14 you'd have a chance to get a gadget or two for free. Well, not exactly "just get" - you'd need to answer a few geeky (and software) questions at Typemock's Quiz.

But that will be plain fun. Prerequisites for those who want to participate:
  1. Have a twitter
  2. Tweet a message with the quiz's hash tag – #GeekQuiz. 
  3. Be fast enough with the tweet above: only first 400 people could join.
More details here. There are about 150 tweets so far so you still have a chance to join and win a Wi-Fi detecting T-shirt or even an Xbox. Good luck!

Mocking frameworks comparison

October 4, 2009 22:14

About 9 months ago I posted a comparison of different mocking frameworks. A lot has changed since then - armloads of bugfixes, gratifying influx of new features, and even a new mocking framework (!) - so time is ripe for a new comparison.

But before I move on, here's a very brief list of changes.
More...