Code Templating lecture – any buyers ?

A few months ago, I lectured before Microsoft C#/C++ User Group about advance usage of delegates, generics and anonymous methods. The audience was great and I got really nice feedback. I was talking with my good friend Pavel a few days ago about lecturing in general and he made an excellent point: I should have done more “rounds” with this lecture. This could have been good experience for me to learn from the feedback I got and use it into practice before different audience. So, would you like to hear me present for ~1.5 hours about those topics (after “work hours”, say 17:30+) in your “home”(=working place)? All I need is a projector and a working air conditioner(I don’t have 3 built-in fan as my computer have, unfortunately). You can look at the lecture syllabus here and there are code samples and presentation(ppt) file of the entire thing right here. Of course, there should be a minimum number of people attending as I don’t want to drive for an hour just to talk with 2 people (actually, I do, but this won’t be very productive and bad usage of my time, so I’m sorry folks).

Minimum knowledge required to participate: good understanding of .Net 1.1 is a must; .Net 2.0 – bonus.
Lecture (“MS”)Level: 400. (technical hardcore stuff, no SOA will be presented, I promise).

Drop a comment or send me an email (oren dot ellenbogen at gmail dot com) and we’ll set a date.


Slides & Demos from my Code Templating presentation

I had so much fun lecturing yesterday before the C++/C# User Group about abstracting your code via delegates & anonymous methods. The number of people that showed up was really astonishing, at least to my expectations, as about 70 people gave me the honor to talk about something I really like so thank you guys !

I got some really good feedbacks(update: Royo, Ken and Shani dedicated a post on the matter) from the audience, one of them even told me at the end that my lecture was much better than one of the lectures at TechEd 2006 about Generics so I’m really happy that my words and demos made an *impact*. Still, I feel that I can do a lot better so I hope I’ll have the pleasure to give more lectures on the near future.

Finally, I got to say a BIG thanks to a bunch of folks: Justin Angel helped me to put my lecture on video so all of you (Hebrew speakers) can hear & see the live presentation(Justin – you rock!), Roy Osherove helped me think about the context of my lecture and connected me to the C++\C# User Group Leaders – Shai & Moshe. I owe a big thanks for Shai Bar Lev & Moshe Raab for giving me the opportunity and making it all possible. And finally, I want to say thanks to my teammates at SQLink that really pushed me through.

You can download the presentation & demos from this links:

Code Templating presentation (ppt) – 1.8 MB

Code Templating Demos (zip) – 500 KB

Code Templating Database (zip) – 139 KB

    * You need to restore this database on Sql Server 2005 Express which comes free 
       with VS.NET 2005. Without the database the ISPARefactoring demos wouldn’t work.

The video will be available in a few days so stay tuned.

btw – Barca won the Champions League cup! What a great evening!



Reminder: advance use of delegates & generics in the next C# group

I’m presenting before the C# group on the following Wednesday (17/05/2006, 17:30) and I thought to give you a heads-up. You can click here for more details about the “Agenda”, including how to get there & where to park your keyboard.

I’ll elaborate on a new way (aka “Code Templating”) to refactor your existing code for better re-usage and present some cool tricks via delegates and anonymous methods so get ready for some * cool * code. For the finale, I’m planning some live refactoring on existing code so you really don’t want to miss this one !

btw – if you aren’t familiar with the terms delegate, event, anonymous method or Generics – this presentation is for you as well; I’ll try to cover as much as I can in this session.

It will be great to see you all there.


TechEd 2006. Day 2. What a day…

We got up at 07:05. It was hard as hell, but we had to put the effort for the team. After all, we came to hear some great lectures. No way in hell I’m gonna miss it.

Lessons from “the Factory floor” on How Microsoft does software engineering, by Amnon Horowitz

This lecture was nice- but I can’t say that Amnon did the maximum he could have done. I think that he could transfer the material with some more excitement, after all, he manage thousand of people! The lecture turned out to be pretty dry and somehow boring as Amnon started to answer some really not-important(I’ll be soft) questions and even to answer a question which was answered 5 minutes before. I hope that on his next lecture he could be a little tougher and ask some of the guys to ask him those questions during break time. Enough bitching, there were 3 pluses as well:

  1. MS doing some things right! It was great to hear how MS works from an insider. I really admire the strength to say: “Hey, we have to cut those features and to close those bugs for the near release”.
  2. I was able to think about the way I communicate with my QA department. I can make some dramatic improvements by cutting down some long, hard to read & understand papers, and form a 6-7 lines of Dos(and how) & Donts so my programmers can work more efficient with our testers.
  3. I had some time to think about ideas for my lecture, mostly about how to present the data I want to transport.

My grade for Amnon’s lecture (1-10): 6.

New directions for developing rich Web applications with Atlas, by Leon L.

I’ve enjoyed this session. I must admit that I didn’t play with Atlas enough so Leon managed to teach me a lot of things and make me want to start playing with Atlas. I really liked the Server Centric approach, its almost like you develop WinForms application. It’s amazing what you could do with a good, solid framework.

My grade for Leon’s lecture (1-10): 8.

Getting specific on Generics, by Noam King & Alon Felis

I must admit, this one was pretty bad. In a lecture of 400+ level, I expect to learn something new, even if I’m quite familiar on the subject. In addition, there were a lot(!) of errors in the presentation slides; Ken & I counted at least 4 slides with terrible mistakes. I told Noam about those mistakes at the end of the lecture so I hope he’ll get them fixed. To sum-up, I simply didn’t get into the “beat”…

My grade for Noam and Alon’s lecture (1-10): 4.

Oh, one thing! Try to tell what OS this dude is running:


Yep, this is Linux (GNome)! a big NO-NO at TechEd ! :-)

WPF – Part 2 – Interoperability with Windows Forms, by Arik Cohen

I love this dude! Arik is such a typical American geek. He’s one of those folks which you enjoy to share your geekness with. His presentation was pure joy. I really got excited about WPF for Windows Forms and Web Forms. Arik showed a bunch of samples about the way you develop WinForms & WebForms with WPF, just to understand how it all works. One important thing – WPF/e – This baby will able you to convert WinForms application to WebForms application in one click. WPF/e will download a small “host” (~2MB) for the browser which will allow you to show your XAML application as it was developed for WebForms application from the beginning. Cool !

My grade for Arik’s lecture (1-10): 9.

Ask The Experts

Ho man, that was cool !! Myself & Ken talked with Luca Bolognese about several ideas we had. We even met Oren Eini and talked a bit. And as always, Yossi Taguri, one of the guys I really like at MS, gave us some answers and connected us to some experts in the field – Thanks Yossi.
It’s just a shame that I don’t like beer because there were plenty of it there… :(

The P-A-R-T-Y !!



                                       Party time!



                        Come on!! get low, get low, get low !!



                               Me, Ken & Shani


                 He can’t code, but he sure can dance! Ho well…


                  I’m thirsty, and you ? What a hot bartender !


                        Coding is fun, but this is better !


                                       Me & Shani


               Me – drunk, tired, no laptop…


                  Me – with the laptop… the good life


               Ken, a guffy guy. You got to love him… (?)


              Me and some messed up dude! Man, he was hilarious !


                     Me, Roee & Ken. padding-right: 100px;



TechEd 2006. Day 1. Our story begins…

So it all began on Tuesday, Moty (CEO), Roee(CTO), Ken (Team Leader and a major guffy) and myself drove about 5 hours to Eilat. The view on the way was nice but I’m not a big desert landscape fan so you won’t get me excited about that. We got to the hotel at 15:00 and took our stuff to our rooms (nice, big, comfortable rooms, I might add). From there we went to the kick-off meeting which was kind of sad; too much folks, too much noise, and a poor lecturer who had to suffer from all of that. There I met my good friends Shani Raba (aka human debugger), Alex Iagovsky and Yossi Ganot and said hello to a few colleagues from MS. After mingling around I went to my first lecture. Oh, on the way to my first session I took a pic of this cute parrot:


                                                     Cute parrot – speaks C# 2.0 for living

Session 1: Introduction to WinFX, by Payam Shodjai

This was a great lecture and really served it’s purpose. Payam is a great speaker, one of those guys that makes you feel comfortable sitting 1.5 hours and listen to some high-ground material and still have a smile on your face (I’m one of those geek that loves the bit & bytes stuff). This session gave me the order I need to the new technology Microsoft is about to deliver in the following year. Payam presented the 4 wheels of WinFX: WPF (windows presentation framework), WCF (windows communication framework), WWF (windows workflow framework) and (4) InfoCard (a huge progress to the real deal – Identity 2.0). I guess you wonder “so what can you tell me about those 4 features ?! come on, I’m dying here! ” (if not, something is really messed up with you :)), so here is a short summary about the 3 magic beans:

WPF – You can throw Javascript to the garbage. No, I’m just kidding, wait … !!!
WPF (or in it’s old name – Avalon) is the new GUI framework from MS and damn they did a fine job in this hot-spot topic. No more drawing with GDI+ or DirectX, it’s time for vectors to kick-in. Imagine develop an application which will look beautiful on 1024*768 resolution but at the same time it will be as smooth and clear on 640*480 with no need to change CSS or images ! The name is XAML (pronounced ZAML) and it’s a descriptive way to create your forms (web or windows). In addition, you can really change the way SelectList, Radio-Buttons, Grids and other controls rendered. A quick example of a vectorial clock can be found here; Just enter this link and I promise you will be amazed by the simplicity of this technology. Superb!

Our CTO, Roee Dalyot, which is a Javascript master and in general a GUI extreme programmer is gonna lead this technology in our company and I’m sure you’ll hear from him on this topic. I can’t wait for his posts (and hopefully, some lectures) about this topic.

WCF – We all had the pleasure(?) to write WebServices, to enhance them via WSE (1.0, 2.0 and 3.0), to use Remoting, Windows Services, Transactions, MSMQ and many other communication API providers. It’s time to make some order and to unite all this technologies together – WCF ! This new API will help you communicate between you apps with ease, and it’s about time…
Oh, it almost got away: WCF(new name) is equal to Indigo(old name).

Ken, our talented (but still guffy) guy will take this one. I can bet that his going to do magic with it, just hold on to your sit.

WWF – This is the real deal (I’m biased). This puppy can make you Business Logic describe itself. Image a drawing (kind of UML) which describe the set of actions you perform according to a set of logic conditions. This workflow engine allows you, the developer, to write a set of “Activities” and connect to via a logic process diagram.  Each activity is just a simple class which implements Execute method. You can obviously create “sequence” workflow and pass arguments between the steps in the flow. You can change the steps order or the logic conditions (sometimes without re-compilation, depends on the change) with a simple drag-and-drop around the screen. Creating some “template” activities can make some of your application’s flow a drag, drop and to-production. All in 5 minutes.

I will be the one that takes charge on this beauty. Prepare to be WWF spammed !

My grade for payam’s lecture (1-10): 9.

Session 2: Deep relfection – What’s new and important in .Net 2.0 Reflection, by Roy Osherove

This one really blew my mind away. I’ve learned a bunch of new stuff and got really excited about DynamicMethod and ReflectionOnly-*. This two immediately got me thinking about some implementations I can use today. Roy sent the message loud and clear and the lecture was smooth and fun. Let me elaborate on the things you should know about:

DynamicMethod – This is the fastest way to create code on-the-fly and inject it into memory. I’ll use Roy’s sample: Let’s say you want to clone object from type A to a new object, something like:

A a = new A();
a.Name = “Oren”;

A a1 = a.Clone();

a.Clone() will perform a (deep\shallow) copy of a. So you can say – OK, let’s create a Clone method in each of our custom objects and implement it, something like:

class A
   public A Clone()
      A newA = new A();
      newA.Name = this.Name;
      return newA;

Well, if you have a lot of custom classes (and each custom class has more than one property, most of the time), this could be quite exhausting. The idea with DynamicMethod is to generate the IL code which will copy the object on the first time you call it; meaning, on the first call to a.Clone() you’ll probe the object and create, dynamically, the Clone method and save it into memory. Roy will upload his presentations and examples so you could view some nice usages of this new great feature. One thing though, this feature requires knowledge of understanding IL which can be quite hard for novice programmers, but I see some great usages if you’re an infrastructure guy: Serialize, Deserialize, Cloning, Attaching methods to events (like Handles keyword in VB.NET), Formatting objects (to xml for example) and many other things I’ll leave under my sleeves for the moment (I’ll implement and upload, in time).

ReflectionOnly-* – If you ever reflect some of the assemblies or types in your system (e.g Plugins system), this one is for you. See, the minute you ask questions like GetCustomAttributes() you actually running the constructor of each one of the attributes. Now let’s say that the attribute is a Custom Attribute which you’ve wrote and you want to upload (to memory) all the classes with that attribute. This could be unsafe. The reason is that I(hacker) can inherit from your custom attribute and put some malicious code in the constructor which will be run in the context of your application (the one that called GetCustomAttributes) !!
With ReflectionOnly-* you can be with and feel without – this is a safe way to probe your assemblies\types. This is something I’ll take advantage of immediately so thanks Roy !

My grade for Roy’s lecture (1-10): 9.

End of the day – Cocktails “party”:

This was nice although I hate standing while I eat. Good drinks, nice food, a lot of gifts (if you give your name, email and phone number to the devil – the spamming machine). Nice.

Some pics:


                              Myself and Shani Raba                                                


         A look from above (Hey! I’m 1.70m guy, what can I do ?!)


End of day 1.


Presenting about advance use of delegates & generics in the next C# group

I’m going to give a deep insight presentation about advanced usage of delegates, generics and anonymous methods at the next C# group meeting.

Please let me know if you’re planning to come(drop me a comment), it will be nice to see some of my co-workers\readers\friends at my first lecture at Microsoft user groups.

The original excrept can be found here. (don’t forget to register, free of charge, by sending an email to: ivcug at comconix dot com)

The Details:

Date:    Wednesday, May 17, 17:00 – 20:00

Place:   Microsoft Israel 

            Hapnina 2  (Amdocs Building)

            Ground Floor


+972 (9) 762-5100         


Parking available at the Kurkar parking lot. Proceed straight past the traffic circle and the parking lot will be on your right.

Topic: Advanced Use of Delegates and Generics

Lecturer: Oren Ellenbogen

 This lecture will not be just about Delegates or Generics, but it will combine those topics to show you how you can leverage to usability of those semi-new features. Oren will discuss the receiving of delegates as parameters and the implementation of abstraction in this methodology. He will tie the two topics together by refactoring(live!) existing code using a principle he calls “Code Templating”;  a coding method that allows running unique logic within recurrent code.


  1. Looking at a “simple” scenarios of recurrent code

    1. Check if a value exists in a collection.
    2. Get the item index in a collection.
    3. Filtering a collection (get only some of the items based on a condition).
    4. Manipulating every item in the collection (string concatenation for example).

  2. Looking at “advanced” scenarios of recurrent code

    1. Querying the database.
    2. Exception handling.

  3. Discuss solutions for further abstraction in those scenarios.
  4. Introduce “Code Templating” – separating the unique code from the recurrent code.
  5. Before we start, getting to know our toolbox: generics & delegates

    1. What are they?
    2. Calling a delegate which was given as parameter – understand the benefits.
    3. Anonymous delegates\methods – how & why
    4. What’s going on under the hood?

  6. Examples of Code Templating in .Net 2.0

    1. Handle those “simple” scenarios via List<T>.Find, List<T>. FindAll, List.<T>.Exists etc…

  7. Refactor (live!) the “advanced” scenarios, step-by-step.
  8. Code Templating – What do we gain? What can we lose?
  9. Q & A


Oren Ellenbogen is a Team Leader at SQLink’s R&D Department. Oren’s responsibilities and areas of expertise span from Analyzing and Designing Web Applications to developing innovative coding enhancement tools. Oren’s project leading at SQLink involves all stages and forms from team leadership to high level consulting.

 Oren’s years of developing experience cover a variety of languages including PHP, C++, VB6 and C#.

 Oren published a series of articles at, publishes a programming oriented blog and is an active member of several .Net architects forums.

 As always, although admission is free and you may attend without reserving a place, we kindly request that you notify us if you plan to attend so that we can be sure to have enough chairs and FOOD!


Amazing presentation, I’m still a little dazzled !

Pasha sent me a great presentation about Identity 2.0, presented by Dick Hardt, which all of you presenters out there ought to see !

Even if you don’t understand what’s the presentation is all about, you must listen to the presenter and check his stylehe’s amazing speaker and a great performer.

Here it is:


Interesting Israeli .NET Architects Group meeting yesterday

Yesterday the Israeli .NET architect group met at HP(Raanana) for a lecture about GAT and LINQ which was presented by Roy Osherove.

If you haven’t heard about GAT & LINQ before, here is a (really) terse summary about them and my comments about the presentations:

  1. Guidance Automation Toolkit (aka GAT): this is Microsoft way to take a piece from the “automation” utilities cake. See, MS finally got the idea that there are too many folks out there using CodeSmith, O/R Mappers, RapTier etc; Now they’re integrating a tool in the Visual Studio which will able us to automate everything directly through the studio itself. With GAT, you can build packages, or as I like to call them – “well defined and well presented(GUI) processes”, to automate for example a build of an entity(\data) class based on a given table in the DB, just like you can do it today with 3rd party softwares. But you can do much more with this tool basically because it’s so well integrated with the studio. Now, creating full controlled wizards straight out from the VS.NET which will able you to automate creating VS.NET solutions\projects\items is even easier than developing an Add-in for the VS.NET 2005. The main reason I don’t think this will take off immediately is the GAT lack of easy configuration, but this will be fixed in the following year, and then, man, I think that the current Code Generators and O\R Mappers softwares will have to really take the next step and start running after MS (like we used to). Roy’s presentation was nice, but I think he made a mistake by given us some general info & demos without really pointing the real deal – integration, integration, integration and Microsoft money & time = something we’ll use later on, one way or another.
    Presentation TIP: IMHO, the first slide in every technical presentation should contain the phrase:
    “At the end of my presentation you will all know ____” or something like it.
    I would start with something like: “hey folks, we’re going to talk about GAT, and before I’ll begin, let me assure you, each and every one of you will use this tool one way or another, not tomorrow, but in the next 6-10 months so pay attention to MS new baby; Good, now that I have your attention, this tool is not quite ready for immediate use, and that’s why I’ve told you 6-10 months, BUT, let me give you some general info about the new product and some demos, (after all, every presenter must challenge the “god of demos”) and at the end of my presentation I promise you’ll all understand the big step Microsoft did to ease our life’s as architects. Please keep in mind that this is only a 1 hour presentation so I rather show you the big picture and the why-you-should-use-it instead of getting deeper into the code, does it sound right to you ? (everybody will node anyway)”
    After that said, I would concentrate more on the amazing integration with the VS.NET, the ability to use wizards to build wizards, the ability to control everything you need in the studio while using the studio itself rather than talking about the recipes\actions and “deep level” demos. If In 1 hour presentation you can’t really teach me how to create a working Guidance Automation wizard, don’t start to and stop in the middle after you see the material is to complex for such a short time limit, concentrate on the big picture and give me a list of links to read later on. The most important thing is to let the audience know the main goal of your lecture and what will they gain from it straight from the beginning, so at the end of it, they’ll be really able to tell you if you did a good job.

  2. Language Integrated Query (aka LINQ): This is one of the coolest shit you’ll ever see, I promise you that, but it will be released only with C# 3.0 so I won’t elaborate much on it now and just say that this technology ables you to run queries on collection. I won’t even give samples, there are plenty right here. This presentation by Roy was much better because it was clearly understood that the presentation will be focused on the new abilities LINQ will give us – pure “introduction” presentation (and to extract some “wowwww”,”aaahh”, “hhooo” comments which is great to have in any presentation ;-)).

So, it was a nice meeting and I even got the chance to see some folks from the army I haven’t seen for a lot of time (Effie, Gabi and the rest of the team) so I’m glad I went.

Oh, Two things before I’m out of here –

  1. I’ve registered to Microsoft Sql Server 2005 convention in November, will I see you there ?
  2. A very good friend of mine, Amir Markowitz, has turned 32 yesterday (sorry for the late post Markowitz!) so happy birthday dude !

OK, time for me to go, until next post.