Chander Dhall's Blog

  • Review on some of the books

    Our user group members reviewed certain books in the holiday club. I apologize for being a little late in blogging the reviews. Like you all know I am not a blogger in the true sense but do love presenting all over the world. Last weekend I presented at Chicago code camp and talked about some of the books we reviewed. Here is list of some reviews and more are about to come.

  • Strategy Pattern Using Delegates (Func)- www.Hands-On-Coding.net presentation on Dec 14, 2010

     Strategy Pattern using Func
    An alternative to using Strategy pattern using interfaces is Strategy Pattern using delegates.

        •    Create a class with all the different strategies.

     public class Calculator
        {
           public static int Add(int num1, int num2)
           {
               return num1 + num2;
           }

           public static int Subtract(int num1, int num2)
           {
               return num1 - num2;
           }

           public static int Multiply(int num1, int num2)
           {
               return num1 * num2;
           }

           public static int Divide(int num1, int num2)
           {
               return num1 / num2;
           }

        }

        •    Test the code.
    int a = 100;
                int b = 50;

                Func<int, int, int> calculate = Calculator.Add;
                int sum = calculate(100, 50);

                calculate = Calculator.Subtract;
                int difference = calculate(100, 50);

                calculate = Calculator.Multiply;
                int product = calculate(100, 50);

    If you are new to the syntax, Func. Func is like a delegate that in the above case takes the first two ints as input and outputs the int (third).
    Another cool way of using Func is using lambda expressions.

      Func<int, int, int> calculate;
       calculate = (x, s) => x + s;

    We could do the above in a single line itself. But what it means is changing the strategly on the fly. Func is a pretty cool feature that reduces a lot of the delegate code we had to write in .NET 2.0. Happy coding !



  • Dallas day of dot net

    We are putting together a great conference together at Microsoft Conference in Dallas. It's Dallas Day of Dot Net. Www.jointechies.com

    We have 3 different tracks. Beginners' track which is more hands on, intermediate track and expert track We plan to incorporate the hottest dot net topics for discussion.

    Ayende is flying in from Tel Aviv. Our speakers include 3 from Microsoft, 2 authors, 4 open source contributors, 5 MVPs, 3 architects and the list is growing. 55% of the registrants as of now are from outside the state. I will keep updating from time to time.

    You can use 'ChanderDhall' as the discount code Thus is an additional discount code over the early bird discount code. All proceeds go towards a cancer patient For more information contact info@jointechies.com

    Thanks to our sponsors:
    Matrix's Dallas Day of dot net's main sponsors. Platinum sponsors also include Telerik and DevExpress. Caffeine sponsors: Comsys. Volunteer Gift Sponsors: TekSystems. Golds Sponsors: Head Spring Systems and ITalent. Gift sponsors: Oreilly and Pluralsight.

    If you'd like to sponsor the event please email mailto:info@jointechies.com

  • Composition vs Aggregation

    Composition and aggregation both are different forms of association. If an association is more like a 'is a' relationship, both of these are more like a 'has a' relationship. It is more like a whole/part relationship or an owner/owned relationship. For example, an automobile has an engine or the other way round, engine is 'a part of' an automobile. What's the difference?

  • Asp.Net MVC2 and Azure - Dallas Tech Fest

    It was great presenting at Dallas Tech Fest on Asp.Net MVC on Azure.  However, this is the dilemma I have to go through unfortunately still. In a show of hands before the talk starts I still find majority of the audience not knowing about either of the technologies. So, I have to make my talk more dynamic so that I don't keep the audience guessing. This usually takes the talk in a direction that is really good for most of them. However, for the ones who know both I always run short of time to cover everything I had. In this talk, it was fun explaining how the partitioning guidelines for Azure Table Storage. I shall blog about it soon as I had a good feedback about the guidelines and it was pointed out that my recommendations have not been made on the web by others. That will be my first web contribution since I have been contributing only through talks and want to start reaching out a wider audience.