Julius's profileJulius Ganns . netzkernPhotosBlogNetwork Tools Help

Blog


    February 08

    Fitness for Body, Brain and Soul

    Some people might have noticed that I changed some things in my behavior and my habits during the last months. The truth is, I have changed really a lot of things, but most of them had much more silent impact on my life. What is visible outside is more or less the result of my efforts and to be honest, I'm a little proud of what I accomplished. But let's start at the beginning...

    I worked really hard over the last 4 years and I achieved a lot. I had to overcome a lot of obstacles to get where I am today. I loved my job, our company was running very well and we were getting more and more successful with every step we took - but instead of being overwhelmingly happy about that I felt worse with every step forward we made. My work seemed like an excuse for all the things I wasn't doing, especially in my personal life.

    The truth is, I hadn't treated my body very well, I was overwhelmed by all the additional work that came with the success and there was this feeling that there were so many things in my professional and personal life that I should have done already - and being just 24 years old, I had the feeling that something was fundamentally wrong with that. So I decided I had to change some major things in my life.

    As Marquise du Deffand said: Distance is nothing, it is the first step that is difficult. And indeed, it was.

    I knew, I had to introduce a major change at the very beginning. Usually habits should be developed in small steps, one at a time. But to have a point of reference for my decision, like a gunshot at the beginning of a race, I had to start with something really big. So I decided to take the money I worked so hard for over the last years to get myself a Personal Trainer. Ironic, isn't it?

    The training really changed my life. Going forward with my body seemed in some way to free my soul and relieved me from a lot of pressure I felt the years before. Always finding excuses NOT to do sport obviously needed much more energy than just doing it.
    At this point I really want to thank my trainer and friend Daniel Knebel for the great work he has done. It was the beginning of all the changes I introduced in the end of last year.

    Of course my ultimate goal was to reduce my overall stress and to focus more on the qualities of my life, at work and at home. But to have that freedom, I had to increase my productivity and to get much more control over my "stuff" in a more natural, relaxed way. Some years ago, I received a present from a very special person in my life. The book "Getting Things Done" from David Allen. Of course, I had never time to read it. I should have done it. It really changed the way I work today.
    Don't get me wrong, to fully implement GTD in my life, it will most likely take another 10 years. But shortly after having read it for the first time and having done all the necessary re-organization in my life, a lot of things changed immediately. Today I'm reading and listening to it (audio books are a great invention, by the way...) for the fourth time, together with the second book of David Allen - "Ready for Anything".

    There are some great books out there that can really make a difference in your life. Two other books I'm listening to at the moment (both for the second time) are "Eat That Frog" from Brian Tracy and "The 7 Habits Of Highly Effective People" from Steven R. Covey.
    "Eat That Frog" is a very good toolset to support my GTD methodology, and "The 7 Habits" is what David Allen calls the altitude levels above 20.000 feet. GTD focuses on your actions and your projects, helping you to increase your productivity instantly with a fundamental set of simple rules at the bottom of your daily work. Coveys book starts at the opposite side and guides you from the inside of yourself to success and more greater awareness in the outer world.

    Another great resource for personal productivity is the Zen Habits blog of Leo Babauta. Especially the articles about inner resistance and the way especially smart people often start playing around with their productivity system were some kind of eye-opener.

    So what happened to netzkern while I was focusing on myself a bit more than I did the years before? Well, today we are somewhere among the top 100 new media companies in Germany and we will most likely be awarded as one of the 50 fastest growing IT companies in Germany over the last 5 years as well. Compared with the time four months ago, I'm feeling great today. I still have a long way to go, but I'm really looking forward to it. There are a lot of productivity and happiness secrets to discover, but I keep you posted about my endeavors.

    Have a great day!

    February 02

    Declaratively Re-Executing Methods on Exceptions

    In my previous post I've written about AOP and provided a lot of links, especially pointing to one article that combines WCF and AOP. Shortly after that I watched this video from InfoQ showing the use of Spring AOP (in Java) to re-execute an operation that fails with an exception.

    Actually this 'Retry' pattern is a great idea in a lot of SOA scenarios where you should be prepared to handle some connection problems or load issues at the foreign party. Usually we've implemented this way of dealing with messages in our systems using an asynchronous backend process that re-submits messages several times (up to a max) if the initial submission fails. This is of course only possible if the information within the message is not time critical, because we work with time spans from 5 minutes to several hours. Also this solution is fairly complex as it uses a windows service, several asynchronous threads, a database as well as logging and exception handling mechanisms.

    Of course there are other SOA situations were you would like to have a 'Retry' mechanism although you have only a couple of seconds max to execute your call to an inconstant resource again (an external check for example), but do you really want to implement this whole "while(maxAttempts) { try blablabla catch ex }" thing over and over again? I wouldn't.

    So creating an aspect in whatever AOP framework (I prefer Spring.NET, AspectDNG and PIAB) that handles this 'Retry' for you, ideally configured using META-Data (Annotation, Attributes, whatever it is called in another language, e.g. [RetryOnFail(5)] in C#), looks very straight forward. We can then "attach" it to every operation we would like to execute more than once in case of trouble.

    So trading in a little bit of performance (even if there is no exception at all, AOP creates some processing overhead) for the higher reliability of our app and less error messages in the UI seems like a good deal to me.

    AOP in .NET SOA applications

    Coming from the Java Enterprise World and always being very curious in new and rising technologies, I came across AOP about 5 years ago and started by first playing around with the Spring Framework and AspectJ.

    Since my commitment to .NET some years ago (2003, which means 5 years now, time is passing by...) I was searching for an alternative and eventually found one of the first beta's of Spring.NET (I'm a huge fan of this project) and some other implementations like Aspect#, Aspect.NET, AspectDNG, PostSharp and even created my own little, never-leaving-the-prototype-state based on .NET Enterprise Services (formerly known as COM+ Component Services).
    All these projects seemed very promising, but especially AspectDNG impressed me with its simplicity, and of course I love the way, Spring (regardless of Java or .NET) does most things it is designed for.
    You can find a pretty good overview of .NET AOP tools in the links section underneath.

    AOP always needs some kind of "interception", which leads us to the difference between compile-time, link-time and runtime approaches. The first two can also be summarized as "weaving", the last one is a "proxy" approach. Both have advantages and disadvantages.
    Weaving is faster, but more static and needs extra steps in compiling the code. In return, it can go "deeper" into the project (intercepting "more" and there is virtually no need to use special APIs like factories, etc.). Proxies are slower and demand the use of their API, but more dynamic and not as "intrusive" as enhancing MSIL. They can also be combined with Dependency Injection (see Spring.NET), which helps us every day to create loosely coupled, dynamic and well-designed components.

    To use the runtime approach, you need a way to "intercept" calls to the objects you want to "wrap" with other code. The .NET framework brings some features that support you in creating these "shells" around your code, namely contexts and proxies. You find contexts in .NET in two flavors: .NET Remoting and .NET Enterprise Services ("COM+", "Component Services", etc.). Contexts can be summarized as a "room" where your object lives. By calling a method on the object from outside the room, you need to use the door and the room can change your call (or "message") to whatever he wants. Juval Löwy has written an excellent article in one of his O'Reilly books named ".NET Components".

    Last year, Microsoft introduced Enterprise Library 3.0 and 3.1, which included the PIAB (the "Policy Injection Application Block"). PIAB is a runtime proxy that uses .NET Remoting contexts, which makes it necessary to use a factory and to inherit your objects from the special .NET Remoting base class MarshalByRefObj. The main reason they did that was that PIAB is supposed to run without installing or configuring complex features. Other reasons are explained here.

    In my opinion the best way to do AOP in .NET might be to extend the CLR to allow full-fledged proxy objects (and not only those that transparently "simulate" interfaces), and I hope to see that in the near future.

    At netzkern we are really into SOA and Web Apps, so our primary objective by using Spring.NET and EntLib every day is to improve the quality of our "composability", which means our code base, our maintainability and our overall software design.

    SOA is - in itself - the component thinking of the 21st century. Of course, components are important within a software or library also, but in terms of reusability an approach that treats services as loosely coupled, distributed components (like the Service Component Architecture in Java EE) should by a primary goal of every enterprise developer.

    So how can we use AOP to help us with our SOA development, especially in WCF projects? Have a look at this very good article in MSDN Mag, that uses MS EntLib and the PIAB to create a "chain of responsibility" by fading out cross-cutting concerns.

    Have a look at the following links from my link collection (yes, Mattes, I will upload it completely some time):
    http://www.sable.mcgill.ca/aop.net/
    http://msdn.microsoft.com/msdnmag/issues/03/03/ContextsinNET/default.aspx
    http://www.theserverside.net/tt/articles/showarticle.tss?id=AspectOrientingNET
    http://msdn.microsoft.com/msdnmag/issues/01/10/complus/
    http://www.geocities.com/aspectdotnet/
    http://www.infoq.com/presentations/colyer-enterprise-aop
    http://searchwindevelopment.techtarget.com/tip/0,289483,sid8_gci1278201,00.html