Sergey Shishkin

on agile software development

Archive for the ‘Presentations’ Category

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

Reactive Extensions @DNUGK

Update: last time I forgot to put the usage example of the ExpectedSequence extension method. Fixed now. See the end of the post.

Previously introduced in Siverlight Toolkit, Microsoft Reactive Extensions (aka Rx) is making its way to be shipped within .NET Framework 4 now. Albert Weinert gave me an opportunity to demonstrate some of my geeky experiments with Rx on the DNUGK meeting yesterday.

The following API comparison between the well-known .NET iterator pattern and the new Rx observer summarizes the intent of Rx: provide API to work with events similar to that of collections, while preserving reactive nature (push-model) of events.

That means that we can do the same set-based operations with events as we already do with collections, e.g. Select, Concat, Join, Where, Merge etc. I must admit at this point that by events I don’t mean .NET events but rather more general occurrences of asynchronous nature, speaking Rx – anything that implements IObservable can be treated as an event and even participate in Linq queries.

To following example will make things more concrete:

public class KeySequencer


    private readonly Subject<char> keys = new Subject<char>();

    private bool shouldStop;


    public IObservable<char> Keys


        get { return keys; }



    public void Start()


        while (!shouldStop)


            var key = Console.ReadKey(false).KeyChar;







    public void Stop()


        shouldStop = true;



The KeySequencer class publishes all the keys that user presses as a sequence of IObservable events via its Keys property. Creating an IObservable is in fact very simple – I use the Subject class from Rx that is an “observable observer”. As an observer it has an OnNext method where I can push keys into, and as an observable it forwards them further to everyone who has subscribed down the line. Note that key events are of type Char. As I said, everything can be an event!

Well, the more interesting part is what we can do with those events published by the KeySequencer. First of all we can subscribe to them:

var keySequencer = new KeySequencer();





Now every character will be put out to the console twice – first when it’s pressed and after that when the subscribed Console.WriteLine method has been called. Still not impressive? What about that?:

Func<char, IObservable<char>> pressed =

    x => keySequencer.Keys.Where(key => key == x);

Func<char, IObservable<char>> notPressed =

    x => keySequencer.Keys.Where(key => key != x);

Func<char, IObservable<char>> followedBy = x

    => pressed(x).Take(1).Until(notPressed(x));


var exit =

    from e in pressed(‘e’)

    from x in followedBy(‘x’)

    from i in followedBy(‘i’)

    from t in followedBy(‘t’)

    select new Unit();


exit.Subscribe(x => keySequencer.Stop());

Here we define four further event sequences (pressed(‘e’), followedBy(‘x), followedBy(‘i’) and followedBy(‘t’)) and combine them into another event sequence (exit) which happens when the user types “exit”, so we can stop listening to keys being pressed and quit the program.


A further logical step could be to generalize the “expected sequence” pattern, of course with Linq in a nicely functional style:

public static class SequenceExtensions


    public static IObservable<T> SelectEqualTo<T>(
        this IObservable<T> source,
        T expected)


        return source.Where(x => Equals(expected, x));



    public static IObservable<T> SelectNotEqualTo<T>(
        this IObservable<T> source,
        T expected)


        return source.Where(x => !Equals(expected, x));



    public static IObservable<T> FollowedBy<T>(
        this IObservable<T> source,
        T expected)


        return SelectEqualTo(source, expected)
            .Take(1).Until(SelectNotEqualTo(source, expected));



    public static IObservable<IEnumerable<T>> ExpectedSequence<T>(

        this IObservable<T> source,

        IEnumerable<T> expectedSequence)


        return expectedSequence

            .Select((item, index) => index == 0 ?

                SelectEqualTo(source, item) :

                FollowedBy(source, item))



                (accumulator, item) => accumulator.SelectMany(_ => item))

            .Select(_ => expectedSequence);



Now I can turn the “exit” sequence into this:

var exit = keySequencer.Keys.ExpectedSequence("exit");

exit.Subscribe(x => keySequencer.Stop());

And of course it works same way for any sequences. Just put a string as a parameter for character a sequence (since String implements IEnumerable<char>) or any other IEnumerable<T> for an IObservable<T> event source of your choice.

So, that were just my first steps in a new world of reactive programming with Rx. And I really liked it!

Written by Sergey Shishkin

11.12.2009 at 15:48

Posted in Presentations

Orthogonal Architecture @NRWCONF’09

I want to thank everybody who came yesterday to my talk on orthogonal architecture at NRWCONF’09 in Wuppertal. I got useful feedback from several people yesterday and will try to improve this talk in the future.

This 1 hour talk just scratched the surface of agile architecture. Almost every second or so slide in the deck deserves a separate talk. I tried keep the talk concrete though by using code samples depicting the discussed architectural patterns.

For those who wonders what SOLID has to do with orthogonal architecture, look at the slide 10 which says:

Open/Closed Principle

  • Open for extension, but closed for modification
  • Orthogonal architecture = OCP on the architectural level

It turns out that I had to stress this point better in the talk.

You can view the slides here, but you need to be a registered attendee to download them from the conference website.

Written by Sergey Shishkin

29.08.2009 at 14:18

Posted in Presentations

NHibernate Profiler Demo @DNUGK

Yesterday I did a small demo of NHibernate Profiler at DNUGK in Cologne. Here is the sample code and some links:

Thanks again everybody who came yesterday to the UG meeting.

Technorati Tags: ,

Written by Sergey Shishkin

19.08.2009 at 11:51

Posted in Presentations

Messaging Talk @DNUG Cologne

Yesterday I gave a talk on asynchronous messaging at .NET User Group Cologne. It was a lot of fun for me to speak about one of my favorite topics, and I would like to thank Albert Weinert for this opportunity. The audience was great, we got an interesting discussion afterwards. Unfortunately, I could not manage to attend the “after-party” and continue the discussion 😉 I know the topic is very hot now, so feel free to ask your questions and give me your feedback in comments.

Here are the slides:

And a couple of references:

Demoed StockTrader news module with messages (see revision 12)

Original composite WPF guidance aka “Prism”, StockTrader RI

Some OSS messaging frameworks

Fallacies of distributed computing

Four tenets of service orientation

Enterprise integration patterns

Written by Sergey Shishkin

08.04.2009 at 10:07

Posted in Presentations