re-motion Team Blog

From the Team

Lang.NET talk video available

with 5 comments

Hi there as well! I’m Fabian Schmied, also from rubicon.

Today, Microsoft has published the video of the talk Stefan and I gave at the Lang.NET symposium 2008, you can find it here (wmv). In the talk, Stefan explains our original motivation for creating re:motion mixins, our mixin library. I give a technical overview about the library (including a very short demo).

This is just the first post providing some insight about re:motion (especially re:motion mixins), though only indirectly. We’ll give more details, explanations, and samples in the near future. In the meantime, feel free to ask specific questions by posting comments to this blog.

– Fabian

Update 2009-03-23: Updated links to the Lang.NET video.

Written by Fabian

February 20th, 2008 at 1:14 pm

Posted in,mixins

5 Responses to 'Lang.NET talk video available'

Subscribe to comments with RSS

  1. Hi there!
    Last days I’ve played with re:motion framework and I found it good and sound. I am planning to introduce it to my team as we’ve adopted similar aop/mixin frameworks. I want to share my thoughts and experience. The learning curve is good. Although re:motion is not a replacement of an aop framework it could be used for some common tasks. Implementing interfaces gives some advantages as you can pass the objects as parameters to methods. I’ve used re:motion together with LUA and the results were pretty good. Good news for those of you who has to deal with scripting from .NET world. I’ve tried using re:motion together with ASP.NET and found some difficulties (implementing IHttpHandler works fine but you could find problems if you already have page handler factories). Anyway, it is possible to use re:motion and ASP.NET together. I used it in a real project for small change request and deployed it on a stage server. Until now it is stable. I involved a colleague to perform a code review and then assigned him a task to change my last changes. He was positive about the readability of the code (in the past we had some complains when using frameworks having new language extensions). So another good news. It seems re:motion is a good mixin library. I am going to post another comment when I have more feedback. Can you provide more details when do you plan to release the source code, licensing, support, etc? Thanks.


    23 Feb 08 at 11:46

  2. You seem to have looked into it pretty far. Like I said, re:motion mixins are not a generic AOP framework, they are not targeted at croscutting concerns. However, its implementation is similar to some AOP stuff, so we might add some mechanisms for croscutting stuff (what the EntLib guys at MS call “policy injection”). That would be nice for users who basically want the mixin stuff, but don’t want to use another library for crosscutting stuff (for ease of use or performance). That’s not a priority now though.

    The problem with ASP.NET is that it won’t call our factory methods, it just generates C# sources with “new” statements scattered all over it, then compiles it. That’s bad news if you want to mix stuff into controls/pages. What we’re doing is, we’re precompiling the subclasses that contain the mixins in the build process (not at runtime). Then we hook into ASP.NET to modify the markup on the fly so that it references our mixed types instead of the original ones. We’re using this in a product already, but it has not found its way into the framework repository yet, so it’s not in the preview.

    IL rewriting might be another way to handle situations where new gets called, but in the context of the ASP.NET compilation process, this would probably be a lot more complicated and fragile.

    Readability has been a major concern, I’m glad for any positive feedback. After all, readability seems to be the number one problem of AOP, we just tried to deliver a tool that’s more specific, and therefore easier to use.

    The source code/licensing question is a bit tough, since we’re about to deliver a very large code base with re:motion. Mixins were only the first part to be anounced because of I’ll keep everyone up to date on this blog.

    What’s LUA?

    Thanks for your feedback!
    – Stefan

    Stefan Wenig

    23 Feb 08 at 19:05

  3. Hi Stefan,
    It seems that your goal to integrate re:motion and ASP.NET is much bigger that I thought. Changing the markup to reference the mixed types sounds challenging. Good luck!

    What I’ve played with ASP.NET integration is much simpler. It is more related to common tasks like authorization, logging, etc. I created a couple of examples for my colleagues.

    I am planning to create more examples very soon and to update the site as well. However I am going to focus more on using re:motion with class libraries instead with ASP.NET as this is more related to my projects.

    LUA is an extension programming language. I am using it for scripting and changing application behavior at runtime. You can learn more on

    BTW there are some interesting (maybe not so useful) results from using re:motion together with LUA. I am going to publish examples about it.


    28 Feb 08 at 16:04

  4. Mihail,

    I noted that you’re redistributing our libraries in your ZIP file. I’d like to ask you not to do this for public downloads, as the license two-liner does not allow it. (We really don’t want to look into a redistributable interim license before we’ve got it all LGPL’ed. In the meantime that means anyone using your samples has to do a separate download, sorry about that.)
    Thank you!

    The ASP.NET markup stuff already works in one project, it’s just not been moved into the framework.

    A few comments about your code:

    1) The way you’re using mixin scopes in MyHttpHandler is correct, but untypical. Usually you’d either put an [Extends] attribute on the mixin, pointing to either Page or DefaultPage, or you’d say [Uses(typeof (MyPageEx))] on DefaultPage. But if you need to make that decision at runtime, there you go.

    2) Exposing protected methods via interfaces is dangerous, because it violates the intended encapsulation. Now anyone can cast to IMyPageEx and call those protected methods of Page.

    3) When you use [OverrideTarget] you really should consider calling the base method, just like when using the override keyword. In your example, registered event handlers for PreInit and LoadComplete would not be fired, because that’s just what those base methods do. You use “Base” (instead of lowercase “base”) to call base methods of mixins, but you have to do something to make sure the type of Base has all the methods you need to call at compile time:
    – Instead of Mixin<TThis>, your mixin must inherit from Mixin<TThis,TBase>, where TBase will be an interfaces that has all necessary base methods. So yes, in this case you actually need to create an interface for those protected methods. The good news is, you don’t need to implement it, keeping encapsulation intact.

    public class MyPageEx : Mixin<Page, IMyPageEx>
    public void OnLoadComplete(EventArgs e)
    Base.OnLoadComplete (e);
    This.Title = “My New Title”;

    That’s it. The interface is implemented automatically for you, but not exposed to anyone outside your mixin.

    I’m glad to see that it’s possible to get this far without much documentation though!

    – Stefan

    Stefan Wenig

    28 Feb 08 at 18:44

  5. Hi Stefan,
    Thank you for your comments. Using Mixin&lt;TThis, TBase&gt; solved all issues. I also have concerns about the public visibility of IMyPageEx members but now it’s ok. I’ve removed all re:motion binaries from the sample and I’m planning to move this sample page to our internal environment.


    5 Mar 08 at 14:43

Leave a Reply