Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

How does the GC handle circular references?

I am a little curious about how the garbage collector cleans up CLR objects. From what I understand, it will wait until objects are de-referenced and then will go through a couple of generations (as required) to release objects from memory.

The following is a simple scenario of GC:

Object A that has a reference to B that has a reference to C. When A goes out of scope, the GC can collect it. When it removes A, B is has a reference count of 0 and can also be removed and then likewise for C as B is removed.

Side question: does this happen in the same GC cycle or is this over three GC cycles?

Ok, simple enough. But how does the GC handle the following scenario:

Object A has a reference to B which has a reference to C. C has a reference back to B.

When A goes out of scope, is B available for the GC as it is still referenced by C? How does the GC handle these circular references?

Read More

Shane helps to shape the future

We just had Shane Morris come to my work to spend some time with us talking about UX. There was a statement he made that really stood out. It was something like:

Usability is the natural enemy of functionality. A successful application is usually one with features left out.

Hope I’m not misrepresenting him, but I think this is a really important point, especially when UX is normally a developer responsibility. Developers tend to cram in functionality because that is what the business spec told them to do.

From the developer community, and their managers, I think there needs to be more of a focus on what the final product will become (good or bad) rather than just ticking the boxes to say that we covered all the use cases. I think the key here is to have a change of perspective.

I have often thought that if you have developed the greatest software on the planet, but the UX is terrible, then you really missed the point (and wasted a lot of money/time). UX is just as important as every other piece of the software puzzle. I’m glad that this is becoming a bit more accepted in the industry.

Read More

WF rules and bitwise OR

I have been doing some WF development this morning and came across something interesting. I had a PolicyActivity in which I was trying to assign a bitwise enum value on an object instance. The rules editor gave be an error saying that I couldn’t use a bitwise OR operation on the types of operands I was using. It seems to me that CodeDom doesn’t correctly parse bitwise OR.

From what I have googled this morning, is looks like the WF rules engine is supposed to support it. I wasn’t however able to find any code examples or screenshots of where people have successfully implemented bitwise OR. So at this stage it looks like it is just documented, not actually used.

My workaround was to modify the enum to include a definition of the bitwise value that I require so that the operator isn’t in the rule definition. While this covers this particular scenario, what happens when the enum that I need to use is defined in an assembly that I don’t control?
Read More

Are singletons evil?

This is a very well written post from one of the Readify boys about the overuse of the Singleton pattern. Food for thought. I should look at whether the places I have used singletons is appropriate.

Read More

PC vs Mac

It seems like the blogsphere is getting very busy of late with PC vs Mac (or Mac vs PC, whatever your pleasure) arguments, adverts and mud-slinging. It reminds me of the following video which I originally got via email about three or four years ago.


Read More

Frozen Five -

As my wife and I were traveling through New Zealand last year, we were fortunate enough to met a great Swedish couple (Anna-Lisa and Mats) who we were able to travel with for a few days. On the 29th of March, Mats is going to start a Svalbard Skiing Expedition with a group of other geoscience students from around the world.

As I am in drought ridden Australia with dead grass all around my house, city and state, I find this absolutely fascinating. Anyway, check out their site and blog.

Read More