What's hot ? (and I mean really ...) - scroll down for more
1).  Code Templating - advanced usage of delegates & generics: my slides & demos are available for download! CodeProject article is also available.

2).  My series "TDD in the eyes of a simpleminded" is in progress(including code!): preface, part1, part2, Q&A 1, Manual Stub .vs. Mock Stub

3).  TDD Workshop: SeeCompass v0.1 and v0.2 are out.
# Saturday, February 03, 2007

http://urikalish.blogspot.com/2007/02/beam-me-up-scotty-copy-and-paste-human.html

Talking about building solid, trustable enterprise applications...
gosh, this makes you think about real-time applications in a different perspective right?.

After you're done wiping, read *this dude's blog.
He is a good friend of mine and a teammate at Mercury, and by god, he knows how to write and he's never boring!

* I call him T-Bag(no physical similarity, just a private[for now] joke), but he's also known as Uri Kalish ("the man and the legend").

Posted by Oren Ellenbogen 
03/02/2007 09:06, Israel time UTC+02:00,     Comments [0]  | 
# Tuesday, January 16, 2007

After digging in into BitArray with Reflector, I saw that this class, in its current state, is simply unusable; Here is why:

1.  The class does not override Equals (and ==, !=, GetHashCode). We use BitArray because bitwise comparison is relatively very fast. I don't want to perform reference comparison on bitwise array. I use bitwise structure to perform bitwise operation and bitwise comparison.

2.  This class is sealed.  Reading the first section can give you the idea why this is a mistake built on top of another mistake.

3.  The exposed bitwise operations change the state of the object. Meaning doing bitArrayInstance.And(anotherBitArray) actually change the state of bitArrayInstance. I really don't understand why this was made by design. It is very common to perform several bitwise operations on a BitArray object and perform some comparison afterwords.

We decide to disassemble the code into a new class named BitArray2 and I refactored the code so it would fit the "normal"(in my book) usage of BitArray.
The code:

BitArray2.zip (4.19 KB)
Posted by Oren Ellenbogen 
16/01/2007 10:33, Israel time UTC+02:00,     Comments [1]  | 

I have to following code:

BitArray arr1 = new BitArray(200);
BitArray arr2 = new BitArray(200);

arr1[2] = true;
arr2[2] = true;

if (arr1.And(arr2) == arr2)
   Console.WriteLine("good");
else 
   Console.WriteLine("bad");

It returns "bad" for some unknown reason.
My guess is that Equals implemented a reference comparison and not bitwise comparison.
It seems like a strange behavior as BitArray is classic for bitwise operations on it.

Am I missing something?

update: I've refactored Microsoft orginal BitArray and named it BitArray2. You can find it here.

Posted by Oren Ellenbogen 
16/01/2007 12:11, Israel time UTC+02:00,     Comments [2]  | 
# Sunday, January 14, 2007

After writing about "Build your weekly reading stack and frame it", I thought to share some of the blogs\articles I read lately about Personal Development. I call them my "content fillers".

  • Paul's Tips - You can find here real pearls among the huge content Paul has to offer. He talks about life, creativity, productivity, time management, leadership. I love reading his stuff because it's an easy read and you can pick up a lot of great life practices(for example: Just being smart isn't enough if you want to get ahead and A neat trick for dealing with anxiety).
  • ProductivityGoal - Great stuff about Work and Time management (I recommend the category "one question interview").
  • Steve Pavlina - One of the greatest in the "Personal Development" area. I really recommand reading his old posts. Notice: Almost each and every one of his articles and even most of his blog posts are a great potential for your weekly reading stack (more than 4000 words per article).
  • Scott H Young - I just started to read his stuff about a month ago. So far I'm very impressed by his level of knowledge and his original ideas for life.
  • The practice of leadership - One of my favorites. You will have to look around this site, but investing 1 hour of wandering around in this site can fill your stack for a good couple of years.
  • I will teach you to be rich - Great stuff about money. Facts, numbers, ideas, links.
  • Get Money Online - if you have a site(or even better - a blog) and you want to make money out of it - read it!

These sites can easily provide enough content for a 5-10 years of weekly reading. I'll publish more during the next couple of weeks.
If you've got interesting sites to share - please drop a comment.

Posted by Oren Ellenbogen 
14/01/2007 09:14, Israel time UTC+02:00,     Comments [0]  | 
# Saturday, January 13, 2007

For those of you who know me, I can spend about 15-20 hours a week reading blogs\articles about various of topics (which means 1-2 days of work a week!). Sometimes, I prefer sinking into a set of articles instead of doing my chores. Though "free" reading is very important and educational, some tasks must get done. I tend to forget it and then feel uncomfortable about it. I feel like I have an elegant excuse to avoid critical tasks. "Hey", I say to myself, "It's important to read about managing my time better or the new features in .Net 3.0, so I'll read a few more articles and then I'll complete my Math homework". The reality is that I finish my Math homework the night before class which is bad for several of reasons: (1) I don't sleep well the night before, (2) I feel uneasy - "maybe I should have invest more time in it" and (3) It's "life smell" (the older brother of "code smell") meaning I know it's wrong and yet I carry on with this paradigm.

Reading blog posts or articles in "free style" may cause a huge wast of time. It happens to me all the time. I jump from post to post, from article to article and start reading until I'm tired.  About 30% of the information I read I don't remember an hour later as it wasn't all that interesting to begin with (but hey, "I can't stop in the middle right?" says the stupid voice in my head). I enjoy reading technical stuff, but I also learned to appreciate my time. It was time to come up with a system to control my reading and make the most out of my time.

Stack your reading on weekly basics

I managed to lower my wander around posts and articles. For big posts\articles, I read 1-2 paragraphs at the beginning and the last one and decide if it's important enough to get inside my weekly reading stack. If it's a small interesting post, I read it all the way (avoiding reading the first & last paragraph again later from my stack) and throw it away(of my mind). How can you save your post\article into your stack? My system is very easy. I've created a directory named "Reading Stack" on my desktop, there I use the browser's "Save As..." menu item in order to save an offline copy of the post\article.

This directory must fill just enough data to read for one week. No more and no less. I don't want to carry my reading material from one week to the next one as it will decrease my motivation in time ("damn, I can't seem to overcome the amount of data I want to read" syndrom). I read about 7 big(~3000-5000 words) articles a week and about 50-80 small ones(from my SharpReader). I pick my articles very carefully and thus using my time wisely as opposed to before where I've read a lot of useless data and wandering around blogs.

Frame it (with time)

As I've mention, packing the data is hard but not as hard as finding the time reading it. You must find some time in your schedule to invest for reading (it takes about 5 years of 1 hour reading a day to become an expert in a given field). Try to find some "delta" time that you're currently not using. For me, it was the time before my university classes and during some of the breaks. I usually arrive to my class(with my laptop) about 20 minutes before the lesson starts. This is ideal for reading almost 1 big post\article. I sometimes read during the lesson itself (watch out for this one, I won't recommend it for anyone, but it works for me) and read a few paragraphs during the breaks(while talking to folks at my class). I usually manage to finish about 2 big posts\articles during one class. Luckily I have 2 of them during my week so that 4 big posts\articles. The remaining reading I do in the weekend, but I have only 3 left so it would be much easier to finish (Weeoow! one more tasks is done!). Try to figure out your "dead" time (waiting for a doctor, watching a game(read along if it's not that important game), if you use the train - it's a perfect dead time) and add to it the amount of time you need in order to be happy with your weekly reading.


That's it. I'm now reading about 25-30 big articles a month which means around 200-250 articles a year! This is a number I can easily live with while still have time for my chores. I feel easy to start reading something and then save it to my articles stack. I _know_ I'll read it later this week so I'm not afraid of losing this information. I'm still investing a large amount of hours (~10-15) for my weekly reading, but most of these hours are taken from "dead" time I've got anyway.

Posted by Oren Ellenbogen 
13/01/2007 03:01, Israel time UTC+02:00,     Comments [3]  | 
# Thursday, December 28, 2006

I'm working with Visual Studio .Net for about 4 years now. To be honest, it's one of the greatest IDE I've ever worked with but the amount of memory it consumes simply knocks the best of my computers. I'm currently using VS.NET 2005 with SP1 and the average memory allocation is ~200MB-~500MB. Now, I usually need to see a few solutions in front of me in order to work so from the total of 2G of memory I have, about ~1G is taken by Visual Studio instance(s). That is just too much, developer need some memory for other application you know (aka Outlook).

One of the obvious suggestions in this scenario is to create some sort of "master" solution and thus working with one instance of VS.NET that contains all the projects I need (from all the solutions). That is a good suggestion unless it was so boring to do and simply took too long(let's face it, no one wants to waste about 5 minutes to create some sort of _temporary_ "master" solution each time he needs to see 2-3 solutions in front of him).


I came up with the idea to develop some sort of automatic solution builder with the following logic:

Let’s say I have an open solution X.sln.

Now I’m trying to open Y.sln.

 

The user will be asked if he wants to join X & Y into a temporary "master" solution (Z.sln) and if so:

1). The current open instance of VS.NET will save X.sln.

2). Generate a new solution: Z.sln

   2.1) This solution will contain 2 “Solution Folder” (a new feature in VS.NET 2005):

X solution directory

   Contain all the projects from the original X.sln.

Y solution         

   Contain all the projects from the original Y.sln.

 

The user will have the option to select a “Solution Folder” and set it as the “active solution” (just like you select "active project"). Only the "Active Solution" will be built. I am not sure how useful this feature is, but I believe we do _not_ want to compile all of our projects in this master solution each and every time we build the solution. If you think about it, we usually need the other solutions open just to look at them while we're trying to develop a feature or solving a bug.

  

This will decrease VS.NET memory usage and let me see all of the required data _without_ switching VS.NET instances and most important - no need to "build" the puzzle by hand.

 


Thinking about the constant time usage trade-off, I want to hear from you guys. Would you use this sort of utility? Do you really need it? Do you need any other functionality? Want to help me build it?

Posted by Oren Ellenbogen 
28/12/2006 11:01, Israel time UTC+02:00,     Comments [2]  | 
# Tuesday, December 19, 2006

(Before you start - give a look at C# and XML Source Code Documentation)

So you build up a nice API that everyone can use but you want to provide nice, IntelliSense-enabled comments along with your magical code right?
Let's say I have the class Logger in my "Infrastructure" dll:

/// <summary>
/// Our logger....
/// </summary>
public class Logger
{
   /// <summary>
   /// Log the given message...
   /// </summary>
   /// <param name="messageToLog">The message to log.</param>
   public void Log(string messageToLog)
   {
   }
}

Now, my clients(e.g other teammates) want to use this logger. Adding a quick "File Reference" to the dll and they are good to go. This is great _but_ they also want to see the comments I provided as they type (IntelliSense in action baby). Surprisingly enough, they will _not_ see it "by default":

NoCommentOnLogger.gif

As you can see (well, not see, but that's my case) - we don't see the class comment "Our logger...". The same goes for our Log method:

NoCommentOnLogMethod.gif

Where are my comments ?!!?

Well, it turns out that you should make a small change to make it alright. Say hello to "XML Documentation file". Open the Project Properties, under the "Build" tab there is a little checkbox named "XML Documentation file" - make sure it's checked and you're done!
All you have to do is to recompile the dll and add the reference again (e.g remove & add, Dumb, but works) or manually copy the generated xml file to your bin directory (if CopyLocal = true).

CommentOnLogger.gif     

CommentOnLogMethod.gif

 

Conclusions:

You should always make sure that "XML Documentation file" is checked!
Why providing comments if no one can see them (unless you have access to the code and you make a "Project Reference").

I'm not sure why Microsoft made this checkbox unchecked as default.
Am I missing something here?

Posted by Oren Ellenbogen 
19/12/2006 02:07, Israel time UTC+02:00,     Comments [2]  | 
# Friday, November 10, 2006

One of the keynote that my manager took from a clients tour in the US, jumped to my eyes: "100% of the users want to take actions in order to solve problems with the product. They are mad at us for giving them poor general error messages". He followed his sentence by "they don't know what to do after seeing a message 'two ways communication failure' or 'unable to retrieve results for X'". I took a pause and thought about this request and really started to think about how can we write better errors for our clients - errors that will ENABLE the users to solve bugs on their own!

After spending about 2 hours throwing ideas on my white board at the office, I came to the simple conclusion that its.... completely feasible!

Softwares contain bugs in it. You can hire the best programmers, the greatest QA guys, automate your testing, you name it. At the end of the day, your release will contain (more than one or two)bugs. So the problem is that the users can NOT do anything in order to solve those code-related bugs, right? Well, I really hope so because I really like my job. but how can we, the developers, give the user helpful error messages that will guide him to solve the bug that just happened or at least make him feel like one of the R&D team?

I decided to split the bugs into two categories:

  • Bugs that are solely code related: I'm sorry, but unless the user will have access to my source, he won't be able to make the fix. Now, who the hack wants to give the users access to their code? No matter what you show to the user, you know that he can't help you solving the problem right now. I believe that you can make him feel like he's helping solving the problem right now. here is my solution for that scenario:
    • Show the user a simple "We sorry but it seems that an error occurred in our engine. We managed to log the error and our best guys are working on it! BUT, we need your help in order to make this bug go away FAST, will you help us?".
    • After this message, show a little "form" with the title "Want to help us fix this bug quicker?" that will contains the following fields:
      • A short description of the form - just a label - "Please help us reproduce the actions you did so we will be able to fix this bug as soon as possible. We know that you have little time, if any, so we did most of the job for you by. It won't take more than 30 seconds starting now..."
      • Bug title (write the action the users tried to do as default - for example "Edit user's account").
      • How serious is this bug for you: a simple select-list from 1(it bothers me but it's not that important) to 5(I can't work!).
      • Bug description (leave it empty) - let the user know he can leave it blank.
      • How to reproduce this bug (here is the catch: you'll need to record the user actions in order to be able to do this) - write all the steps that the user did before he saw this bug. Let him edit the text with the flow (maybe he could add some value). Now, it's critical that you'll supply a good record mechanism as the user don't want to work for you. If filling this form will take more than half a minute, forget it, he won't help you.
      • BIG button - "I'm done, send it away".
    • The message will be sent to the system administrator if the network is local or to the support service if the network is connected to the Internet. Attached to the user's message you can add your personal log info (that depends on the application architecture of course, if you have Internet application you can log everything on the server anyway).
    • IMPORTANT: If the user sends the bug "help" form, and the bug solved quicker because of a good "how to reproduce" by the user and it was important to many users of your software - reward him and notify about it to the rest of the community (of your software). We want to let our "QA users" the incentives they deserve. I believe that letting the user "make some action" in order to help fixing bugs is better than just showing him "an error occurred, please contact your system administrator for further details". (btw - who came with that fucked up idea that the world adopted so quickly?!)
  • Bugs that are configuration related or business related: Hey! we have a chance here to make our users dream come true! there is a good chance that they CAN fix the problem by their own two hands. If the error happened due to Foreign Key issues, for example - the user is trying to delete a record that is referenced by other records, tell him that he needs to delete "X, Y and Z" (give him links that those records) before deleting the current one and explain why(the user's knows nothing about database or software "logic"). If it's something the user forgot to do, meaning the business flow is incomplete, tell him what he needs to do NOW and direct him (supply links or automatically direct him the the current place\position). If the current session of the user was ended so you can not save his form, try to save the user's time and save the form into the cache, let him log-in and then direct him to the previous page he was at and fill the page from the cache for him. Can you imagine how grateful he will be? If the user made a configuration mistake and gave bad data so now he can't send e-mails or run some process - analyze what went bad and give him a proper message. Avoid general messages on those scenarios like "SMTP error..." or "unable to delete the row" just because he forgot to fill some not nullable field. What you are required to do is analyze the StackTrace of the exception and to match it with the recorded flow (as I mentioned in the previous category) and try to provide a really good action items for the users. Let me tell you this, users will appreciate your effort in giving them a full details about what went bad and how they can play a part of the software developers and make the software better.

Most importantly, don't show developer errors to the user just so he could call you(or your service) and say "Hi, I'm a customer of yours and I've got a strange error 'SqlException: bad syntax in line 291 near ;'" ;-).

Posted by Oren Ellenbogen 
10/11/2006 04:48, Israel time UTC+02:00,     Comments [0]  | 
# Wednesday, November 01, 2006

My company, Mercury, is looking for sharp minds with endless passion for code and great creativity. If you consider yourself that sort of a guy and you're looking to work with the very best in the industry(my promise), please contact me(oellenbogen at mercury dot com) and send me your CV.

btw, I have no desire just to pass CVs between my site readers to my company. I would talk with each one of you(and ask you some interesting questions to see if you have the spark) that will pass me his CV before forwarding it to our HR. In addition, if you want to talk with me about "how is it to work there?" or any sort of question you might have about working at Mercury, feel free to drop me a note. I'm eager to join the best of you guys to our company.

Posted by Oren Ellenbogen 
01/11/2006 04:55, Israel time UTC+02:00,     Comments [0]  | 
# Friday, October 13, 2006

Wow, it's an Agile world we're living in isn't it ?

Could you guess how many hits you will get by searching "Good Agile" in google? about 12 million!! "Being Agile", "Agile principles", "Agile stories", "Agile practices", "Good Agile, "Bad Agile" - millions of books and articles out there for us to reach. Buzzwords addicted as we are, we try it all. We pair programming, we work in short iterations, we drop features early and receive early feedbacks, we combine our developers with our QA guys to create some sort of "Feature Team", we use cards, backlogs, big boards with colors, we Scrum, we XP. We practice. We succeed. We fail. We try. Still, a lot of people all over the world claim that Agile Development don't actually work and those methods cause more damage than good. Reading Stevey's post about Good Agile .vs. Bad Agile made me think about my definition for successful agile development. 

Do you ever seen StarGate? if not, it's really not too late to buy a DVD and catch up. In this great TV series, SG-1, the "main" team on StarGate, explore the galaxy through a series of Star-Gates, each one located on a different world, which allow them to move from one gate to another through some sort of wormholes that connect the gates together. Their job is to interact with other species, to establish alliances and to acquire new technologies. SG-1 is my definition for an agile team.

Let me introduce you to the team:

jack.jpg

Jack. A confident soldier and the ultimate manager - he will be the first one to take to bullet, always believing in his teammates and letting them do their job with full confidence. Improvise is his nature. His team are his family. He's the one that make the team glue together.

sam.jpg

Sam. The genius scientist of the bunch. Do you need someone that will write your Java paper for the university in alien dialect? Do you need to make your car a flying ship from two gums and a rope? Rummer has it that she wrote Skype in pure assembly just for the fun in it and that WCF was actually planned by her(Juval Lowey disagree, though). Never says no (I am naughty...) and always do her job in a professional matter, thinking two(thousands) steps ahead(the 100000 alien she killed concur).

daniel.jpg

Daniel. "I can talk 10293740447303^2 languages in 2827349*3 different dialects" guy. If you have a beloved dead uncle whom you're dying to talk with, page Daniel and he make it happen. Got a book from 1700BC in Chinese that you are really eager to read, he'll translate it into English in an hour. A passionate guy that manage to calm the team under fire an to make some sense of Jack's nonsense.

tealc.jpg

Teal'c. The muscles. Teal'c is an alien that joined the team after being slaved to the "gods"(high rank politician with some impressive gun power) in his home-world. He can kill a nation and shave simultaneously. Brave warrior that brings the confidence the team requires during hard times. If you are an AC Milan fan as I am, he is kind of Gatuso - you thank the lord that he's on your team.


You know why SG-1 is the ultimate agile team? because of the people in it and the way the complete each other. See, you can learn the tactics, get the right tools but without the right men in the right position, you are as good as dead. From my experience, there are bunch of actions you can do to make your development process as agile as possible:

  • Invest time in developing inner tools for your workers. You need tools to help you code(good IDE), to control your source, to set up a Continues Integration environment, to perform Daily Builds, automatic Unit Testing and Code Coverage, to run automatic UI and Sanity tests. You will want to easily create setup files and deploy them on various testing environments all in a single click. You want fast feedback that your product is stable each and every day.
  • Challenge your people on daily basis. Pair them together on tasks that they can teach&learn from each other.
  • Give your team members the "small" stuff they need (bigger space, another screen, better chair, more food, whatever!).
  • Praise your workers. Glorify them. If they give their best - they deserve that.
  • Treat each and every one differently.
  • Hire the best people and the best people only. yes, it is worth it. one superstar developer is better than 5 mediocre ones. Don't believe any book or any poor manager that claims otherwise. Hack, don't trust my words, what do I know anyway? Instead, let's all read 100 books of XP and Scrum, miss the deadlines, release crapy code and hate our jobs. We can always blame the management. Superstar developers will build tools that can replace 10 mediocre programmers, so let them do it and give them the stage they need. Superstar developers make your company a place worth working for. Best people bring the best with them. Now, isn't it worth paying some extra for those guys? Don't worry, you will get your $$$ back, I promise.

So agile, in my book, is the confidence you have in your teammates and the greatness of your people and your tools. Without the best people, don't bother doing the rest. at least don't expect for "agile" development. The best you'll get will be Agile Development and that's suck isn't it?

Posted by Oren Ellenbogen 
13/10/2006 04:41, Israel time UTC+02:00,     Comments [2]  |