Sergey Shishkin

on agile software development

This Blog Is Moving

I decided to move away from WordPress.com and created an Octopress blog. The new URL is http://shishkin.org. I won’t migrate any content from the old blog, it all stays here for the record in the read-only mode.

Subscribe to my feed if you haven’t done so yet. The feed is powered by FeedBurner and should remain stable.

Written by Sergey Shishkin

02.06.2012 at 10:55

Posted in Uncategorized

My Revised REST Talk at OOP 2012

Last week I attended and have spoken at OOP 2012 in Munich. It was overall great experience and unfortunately, as at each top conference, I often had hard times deciding which session to attend. I learned a lot from thought leaders like Johanna Rothman, Diana Larsen, David J Anderson, Jurgen AppeloMatthias Bohlen, Stefan Tilkov and many more and probably missed some really great sessions and discussions as well. I also used the chance and met my friends in Munich – it was a great time.

My session was titled “REST: you’re doing it wrong” or “REST, du machst das falsch” in German. It was a significantly revised version of the talk I gave at NRWConf 2011 in Wuppertal. This time I enhanced the story a little bit as well as overhauled the whole presentation. I used imress.js framework to create an HTML5 presentation to be shown in browser – no special slideware needed. I very much like the result, though I gathered somewhat mixed experience achieving it. It was particularly troublesome to arrange all the presentation steps on the canvas while working in pixel units. Maybe some layout plugin or template language would help. The presentation also doesn’t work well in all browsers. From the presenter’s standpoint it ok: it works smoothly in Safari on a Mac, but for publishing online it’s a major drawback: Chrome on a Mac has performance and rendering issues while current stable Firefox is not supported altogether. Anyway these issues will be ironed out sooner or later and I’ll probably stay away of any PowerPoint-inspired slideware from now on.

I started the talk with the ironic tale of the ice-cream maker written by Sebastien Lambla. After that I continued with fundamental architectural decisions made by the creators of the Web and upon which REST as an architectural style is based.

Then I moved to common misinterpretation of REST, like claiming that not using SOAP or using JSON for serialization is already RESTful. After that I introduced Richardson REST Maturity Model and started moving the story towards a RESTful system.

First, I talked about resources and their identifiers. It was also important to mention the distinction between resources and representations. It was then obvious that using URI is inappropriate way of specifying a representation (like the API version or language being part of the URI).

I then mentioned the importance of understanding HTTP mechanisms and assumptions it makes against different methods. The most common pitfall in RESTful systems design is from my perspective to stop on that stage and build a CRUD (Create Read Update Delete) service. Though CRUD certainly has its application domain, nonetheless it’s inappropriate for most of the business systems, as the application logic remains outside of the application – like an Excel spreadsheet, where the user just edits raw data instead of fulfilling business tasks.

The natural step from a system designed out of HTTP methods is a system designed out of resources, where each business task is a resource. This is almost the same principle we use for ages building web applications. Such a system can leverage well-known mechanics of hyperlinks and forms to provide a truly RESTful API.

The HTML5 presentation is available on GitHub pages. You can also be interested in the previous PowerPoint version with speaker notes over at Slideshare.

Update: There is also a ~5.8 megapixel poster of the overview slide in PNG format if the impress.js version doesn’t happen to work for you.

Written by Sergey Shishkin

01.02.2012 at 17:51

Posted in Presentations

Upcoming Events

Quite busy time is approaching me and I really look forward to it. Here are some of the upcoming community activities from my agenda:

31.08.2011—.NET Coding Dojo at DNUGRR

As a good tradition every other month .NET User Group Rhine/Ruhr organizes a coding dojo in Ratingen. This time we get more interactive and learn TDD as if you meant it altogether in pairs. If you are around and want to join us, you’re welcome!

1–3.09.2011—Software Craftsmanship and Testing

New European software craftsmanship community is emerging and I’m very glad to participate in this two day-long intense community fusion:

This event is about the sustainable creation of useful software in a responsible way.

It consists of two days of highly collaborative interactions, including Lightning Talks (on Thursday evening), scheduled sessions (on Friday), and a self-organized Open Space (on Saturday).

The event will be much like a retreat. We will be there for 48 hours to collaborate and share ideas.

I will present practical experience with Specification by Example, I gathered working with an agile team back in 2010. Gojko Adzic has written THE book about Specification by Example, which I highly recommend. Want to discuss this topic? Register for SoCraTes 2011!

9.9.2011—NRWConf in Wuppertal

It is a great honor for me to be part of this year’s line up of speakers at NRWConf. My session on REST is focused on why is true REST so much different than WS-* and CRUD POX services. Want to avoid common mistakes and leverage the web platform, join me in Wuppertal.

16.09.2011—Professional .NET in Wien

Austrian .NET community hijacked Greg Young for a day to speak about all things CQRS. I just can’t miss such an opportunity to see hilarious Greg speaking, neither should you! As part of the event I will be speaking about NOSQL and why it is becoming even more attractive for separated read and write data models.

2-3.11.2011—prio.conference 2011 in Nuremberg


This year’s prio.conference is focused on cross-platform development and I think that the web platform is currently the closest realization of that vision. That’s why I was so excited, that my talk proposal about “getting REST done right” was accepted. In contrast to my NRWConf REST talk, this one is focused more on concrete examples of how to get things done following the REST way, rather than pointing at failures and pitfalls.

So, next months are going to be tough, but I look forward to meet bunch of interesting people and be inspired and energized by the community!

Written by Sergey Shishkin

19.08.2011 at 21:25

Posted in Uncategorized

Code Retreat Düsseldorf

…or how I learned to stop worrying and love deleting the code.

Yesterday I had a great opportunity to participate in a very enlightening and thought-provoking activity, named Code Retreat, in Düsseldorf! It was smoothly conducted by Daniel Temme and Adrian Bolboaca and hosted by codecentric AG. The idea of the code retreat is very simple: use TDD and Pair Programming technics to automate Conway’s Game of Life in sessions of 45 minutes …but delete all of your code after each session!

What?! Delete code?! But how am I supposed to get the job done?

The point is not to get something done, but to exercise the technics of test-first development and simple design. This looks silly and pointless at first and is indeed really hard.

But it all look pretty simple at first. In the first session my pair and I haven’t even come to the game rules. We started with some examples, that we represented as strings. Then we were writing a parser, that would take string representation of the game grid and provide a two-dimensional array with Boolean flags, indicating life, so that we could feed our examples into the game engine. It seemed a logical top-down approach to me at first, but proved itself meaningless.

After the session we all together discussed any findings and ideas that we got out of the session. Adrian was provoking us with questions like: Why do you need an array? Where this Cell class came from? etc.

So the next session we changed pairs (this is a rule of Code Retreat) and started all over again. This time we focused on game rules, test naming and abstractions, but were still unable to make very small baby steps with our design. Abstractions just spawned out of nowhere (out of our head, actually) and made it right into the code. We discussed it after the session and decided to treat the imaginary design obsession syndrome with a very restrictive diet…

TDD As If You Meant It

Gojko Adzic described this brilliant exercise originally proposed by Keith Braithwaite back in 2009. It’s very simple:

    1. write exactly ONE failing test
    2. make the test from (1) pass by first writing implementation code IN THE TEST
    3. create a new implementation method/function by:
      1. doing extract method on implementation code created as per (2), or
      2. moving implementation code as per (2) into an existing implementation method
    4. only ever create new methods IN THE TEST CLASS
    5. only ever create implementation classes to provide a destination for extracting a method created as per (4).
    6. populate implementation classes by doing move method from a test class into them
    7. refactor as required
    8. go to (1)

Despite of the simplicity of the rules, it’s very hard to follow them. But it works. Design gets in fact much simpler and it really gets derived from tests.

Conclusion

We did 6 sessions during the day. I programmed 3 times in Java, 2 times in C# and one time in Ruby. Switching languages is great exercise in itself. No matter what language, testing framework or IDE/Editor we used – the most important concern was to understand the problem domain, codify it in tests, and let simple design solve it.

Throwing out code is not only useful as an exercise. I can imagine a Code Retreat workshop as a way to understand a very complex core domain (in DDD sense) in productive development.

After the event I felt exhausted and energized at the same time. I realized that I barely did any TDD before, but I learned where to start and how to proceed my learning. All in all it was the densest coding activity I ever had. Really look forward to participate in another Code Retreat soon and will do my best to organize the next one in Düsseldorf!

Written by Sergey Shishkin

19.06.2011 at 19:41

Posted in Uncategorized

Coding Dojo @ .NET User Group Rhine/Ruhr

Last month we had a coding dojo on a user group meeting in Ratingen. This was the first coding dojo for most of the user group members and I was allowed to facilitate it. As a big fan of Ilker’s style coding dojos for his entertaining talent I wanted to deliver an energizing experience to the attendees if anything at all. So instead of throwing people at kata right away and watching them arguing which unit-testing framework to use I decided make a “demo of a coding dojo”.

Imagine yourself sitting in a racing car having never seen a race and knowing only how to ride a bicycle. Now go on and have fun on a track. Two hours later you already can start the engine and release the handbrake.  Was it fun? Will you come next time to learn how to shift gears? I doubt. Now Imagine somebody took you for a drifty ride. Now it makes sense! Now there is even a point to learn it yourself. The same way I learned to love coding katas: by watching masters (like this one) doing them.

I choose a modified version of the String Calculator Kata: instead of just adding numbers joined to a string, I aimed to implement an arithmetic expression evaluator (“1 + 2” –> 3). My tools for this kata included VS2010, C#, Resharper, xunit.net as testing framework, and Should as a fluent assertions library.

The thing I like most about TDD is that the whole software design emerges out of a consequence of simple decisions. Each design is unique and none is the right one. You can follow my implementation on Github, I’ll just list here most noticeable steps:

The first feature was to evaluate a decimal constant. The simple “double.Parse(expression)” method did the trick.

The next one was a simple addition. The “string.Split(‘+’)” is obvious to extract the arguments of addition, the next step is however that same little design decision that defined the whole solution. Instead of manually juggling array indices I used my favorite .NET API – Linq. So, to add the arguments from a string array I wrote the following:

return expression

    .Split('+')

    .Select(x => double.Parse(x))

    .Aggregate((a, b) => a + b);

Now implementing multiplication was analogous. The resulting code duplication was an obvious smell though. I always forget those fancy functional slang, but the point was to effectively build a pipeline of functions, where each function is applied to the result of the next one in the pipeline. Then the only thing to do is to call that pipeline as a function and pass it the original string expression. The whole solution looks like this:

public class Calculator

{

    private static readonly Func<string, double> Parse = double.Parse;

    private static readonly Func<string, double> Pipeline = Parse

        .Wrap(‘*’, (a, b) => a*b)

        .Wrap(‘/’, (a, b) => a/b)

        .Wrap(‘+’, (a, b) => a + b)

        .Wrap(‘-‘, (a, b) => a – b)

        ;

    public double Evaluate(string expression)

    {

        return Pipeline(expression);

    }

}

public static class PipelineExtensions

{

    public static Func<string, double> Wrap(

        this Func<string, double> inner,

        char split,

        Func<double, double, double> aggregate)

    {

        return expression => expression

            .Split(split)

            .Select(inner)

            .Aggregate(aggregate);

    }

}

It definitely doesn’t take parenthesis into account, but it quite elegantly solves four arithmetic operations with operator precedence and more than two arguments and more than one operator per expression. Without using Linq I would probably go with a bunch of if/else statements being than refactored into an expression parser and an expression tree evaluator (which is a way to go for supporting parenthesis). Anyway for the first iteration I implemented all the features I wanted and ended up with very little code, which I don’t mind to throw away if it doesn’t fit anymore. And this is a true virtue of TDD.

The next Coding Dojo at the User Group Rhine/Ruhr will be on 27th April, hosted by MT AG in Ratingen. Follow announcements of the UG or sign up at Xing.

Written by Sergey Shishkin

11.04.2011 at 16:15

Posted in Uncategorized

Binding Explicit Interface in Silverlight and WP7

Yesterday I faced a quite annoying limitation of Silverlight (and of its Windows Phone 7 variant). Due to the lack of cross-assembly private reflection Silverlight’s Data Binding is unable to bind to explicitly implemented interface properties. No, I wasn’t jail-braking the phone, all I wanted to do was to bind some hierarchical data control to a LINQ Grouping. Unfortunately IGrouping<TKey,TElement> is implemented in .NET not just by internal classes (as usual, ARRRGGHH!!!) but in addition explicitly. Fine!

Others confronted with the same problem gave up by writing a public wrapper class exposing a public Key property, binding-ready. Although that solution worked I felt wrong polluting all the queries in my view model because of Silverlight data binding limitations. Another interesting approach proposed by Christopher Bennage on Stack Overflow used a Value Converter to get the Key property of a grouping. Now it looked much better in terms of separation of concerns, but the converter was hard-coded to work with IGrouping<string, MyDomainClass> only. Remember? No cross-assembly private reflection.

I tried to tweak the converter approach with no luck:

  • LINQ expression tree code generation didn’t work without Reflection.Emit.
  • Casting to IGrouping<object, object> didn’t work without co-/contra-variance in WP7

So after pulling some hair out of my head I found a rather simple solution. The Key property on the interface itself is obviously public. It is indeed possible to use reflection to get the property value if only you use a PropertyInfo from the interface, not from the implementing type.

The resulting universal value converter looks like this:

public class ExplicitPropertyConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return value == null ? null : GetPropertyValue(value, (string)parameter);
    }

    private static object GetPropertyValue(object target, string name)
    {
        return (
                from type in target.GetType().GetInterfaces()
                from prop in type.GetProperties()
                where prop.Name == name && prop.CanRead
                select prop.GetValue(target, new object[0])
            ).FirstOrDefault();
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

And the usage from XAML is like this:

<TextBlock
    Text="{Binding
        Converter={StaticResource ExplicitPropertyConverter},
        ConverterParameter=Key
    }"
    />

This is almost the right way from my perspective (the right way would if data binding in Silverlight just worked, but it’s not what Microsoft developers are accustomed to anyway). The converter itself is implemented as a cross-cutting concern, being able to bind any interface property. The only notion of this workaround is in XAML data binding, where it belongs. Of course I wish Silverlight, and especially WP7, was a real thing and not that creepy lame castrated shade of .NET, standing in my way to be more productive. Rant over…

Written by Sergey Shishkin

18.01.2011 at 11:34

Posted in Uncategorized

First Success With Heroku

Recently I moved my blog away from Live Spaces to WordPress.com. I remember myself a few years ago comparing Live Spaces and WP among other blogging platforms, I bought in to Live’s tight integration of the blog engine, the SkyDrive and the Live Writer. That was definitely not my best decision as recently Microsoft announced that they are discontinuing Live Spaces and all users are kindly requested to move their blogs to WP. The migration procedure took just several clicks and I got my whole blog with all the comments on WP. One thing I missed after Live Spaces however was custom domain redirection. I want my domain – shishkin.org to point to my blog, but this is a premium feature at WP that costs money. After no luck with DNS configuration at my registrar I headed to cloud solutions.

And here comes Heroku. Heroku is a ruby hosting platform in the cloud, which is free for small demands and feature rich, rock-solid and scalable when you need it. So I decided to build and host at Heroku an absolutely dumb HTTP Ruby application that should redirect all the requests to my blog at WP. Thanks Heroku Custom Domains I was able to host my small dumb app for free with my custom domains (shishkin.org and www.shishkin.org).

The application itself is a simplest Rack application:

class Redirect
  def call(env)
    [301, {
      "Location" => "https://shishkin.wordpress.com",
      "Content-Type" => "text/plain"
    },
    ""]
  end
end

run Redirect.new

That’s it! Using simple Heroku documentation I was able to build, test and deploy my little app in minutes. Heroku’s git-based deployment is somewhat cool. It just can’t be simpler given that each Ruby developer probably has git installed already.

As for Rack, I think it’s an awesome framework we really miss in .NET. After being intrigued by Rack’s ultimate simplicity and extensibility I watched TekPub’s episode on Rack and started to watch the Sinatra series. Now I’m intrigued even more Winking smile Rob Conery does a great job of getting .NET developers out of their comfort zone and provoking us by showing how simple software development can really be on the other side of the fence.

To summarize, I finally did something productive with Ruby! I solved my real-world problem (not that big for sure), I solved it simple, fast and elegant. And I learned a lot along the way.

Written by Sergey Shishkin

29.11.2010 at 21:44

Posted in Uncategorized

CloudCamp Düsseldorf – November 25, 2010

Save the date! On Thursday, November 25, 2010 in Düsseldorf Open Space CloudCamp un-conference is taking place. The main theme of the event is Cloud Computing as you may guess 😉 And the Open Space format guarantees a lot of fun! The camp starts at 13:00 and will be kindly hosted by employer – MT AG in Ratingen (map). Thanks to MT AG the event is completely free for attendees.

The agenda is not carved in stone yet, but will be something like this:
13:00 Registration, networking
13:30-18:00 TBD (Keynote, lightning talks, open space sessions)
18:00 Networking

So, if you are near Düsseldorf on November, 25 and are interested in Cloud Computing (no matter which vendor or technology you prefer), I really don’t understand why still aren’t you on the attendee list?! An Open Space event is only successful if enough passionate people attend it, please help us make Cloud Camp a success. Register at http://cloudcamp.org/dusseldorf.

And we are waiting for your lightning talk proposals. Mail me: sergey.shishkin [ at ] mt-ag.com.

Update [22.11.2010]: CloudCamp Düsseldorf is postponed to undefined date due to the lack of registrations. Sorry.

Written by Sergey Shishkin

14.10.2010 at 18:48

Posted in Uncategorized

.NET Open Space Süd in Karlsruhe

Envy me, I spent last weekend in Karlsruhe with some of Germany’s smartest and most passionate .NET developers. Big thanks for that to organizers of the .NET Open Space Süd and all the participants. I feel inspired and am full of ideas again.

The anti-conference started for me with a great functional programming session with @sforkmann introducing Monads. The topic was so great that immediately after the session many attendees started implementing the Maybe monad in C#. And monads accompanied us all the weekend in all sort of jokes 🙂

Functional programming continued with a session on Reactive Extensions, where I introduced the framework as a new way of doing .NET events and async programming. After that @sforkmann supported the topic with JavaScript samples and an introduction of IQbservable followed by a great discussion.

Two sessions were focused on software specifications, BDD, and ATDD. I was representing ATDD and FitNesse camp, however to be more effective I should bring more hands-on examples to break through code-centric developer heads 🙂 Anyways, the “BDD Shootout” session was really inspiring and code-intense. Not a big surprise with people like @agross (MSpec), @sforkmann (NaturalSpec), and @BjoernRochel (XUnit.BDDExtensions).Although the guys were skeptical about a comparison session at first, the session was a real success: win-win-win for all three frameworks 😉

NOS Süd finished with a Coding Dojo facilitated by @ilkerde. After that dojo (my 3rd only) I still have some mixed feelings. I was looking for learning any new design/coding practices but the only major thing I learned was the importance and complexity of selecting members for a development team. After a while it’s not fun anymore to argue about whether we do TDD or BDUF… Still it was very good experience for me, and I think for others who took part. Thank you Ilker!

If Open Space is so great because of the “coffee break”-like experience, imagine the coffee breaks at Open Space! Of course the biggest part of NOS Süd (at least for me) were it’s parties and breaks when I chatted with many bright and passionate folks and it was the most inspiring and enjoyable experience of the weekend!

Written by Sergey Shishkin

23.06.2010 at 22:59

Posted in Uncategorized

DotNet Cologne 2010: WCF4 Live Coding with GitHub

Another great .NET community event has taken place on last Friday – DotNet Cologne 2010. Big thanks to all the attendees, speakers, sponsors and organizers for making it happen. The event was a huge success. And I even got a chance to speak there about improvements and novelties of Windows Communication Foundation 4.0.

To make it more fun and educating at the same time I decided to do an experiment: use Git–a distributed version control system–in combination with live coding. I took quite a fast coding pace aimed for experienced WCF developers, showing them what’s really new about WCF4. But to make the code samples more accessible for the beginners and to make my coding “traceable” I committed each exercise to a local Git repository right during my presentation and pushed them all in the cloud to GitHub.

A local Git repository makes it really easy to save your coding progress, while code hosting platform in the cloud like GitHub allows you to share and collaborate on your code with others. So now anybody can review the commits history of my live WCF4 demo and easily grasp for example what it takes to call a dynamically discovered service via a generic channel factory.

I liked the experiment myself and also got some positive feedback from the audience regarding the usage of Git. On the downside I ran out of time and had to leave a couple of interesting demos aside, though not because of Git but poor time planning. Lessons learned, promise to improve next time 😉 Join me on GitHub. Your feedback is always welcome!

Written by Sergey Shishkin

01.06.2010 at 22:25

Posted in Uncategorized