2005-09-25

This is the seventh article in my mini series about object pooling. Be sure to read part 1, part 2, part 3, part 4, part 5 and part 6 first. As some of you may have noticed, I introduced a bad bug in the last article about growing and shrinking, specifically in the code that would call the ExtendPoolBy and ShrinkPoolBy methods. The amount by which to grow or shrink the pool was calculated as the difference between two percentage figures and passed in to the two methods, which really expecte …


2005-09-22

This is the sixth article in my mini series about object pooling. Be sure to read part 1, part 2, part 3, part 4 and part 5 first. It took me a while to find the time for the next article, but here it is. Now we’re finally going to deal with the topic of growing and shrinking the pool. One of the first questions we have to ask when it comes to this is, when are we going to do it? We have one mechanism for growing the pool implemented already, which takes place when, during a call to the `GetObj …


2005-09-14

This is the fifth article in my mini series about object pooling. Be sure to read part 1, part 2, part 3 and part 4 first. This part is going to make some modifications to the code in the GetObject method to implement various alternative behaviours there. Think about it: what do you want to happen if there’s no free object to be had in the pool? I came up with the following possible options:

  1. Return null. In this case, the caller would have to deal with the problem further if it can’t ge …

2005-09-14

Just to pass on another piece of news from PDC, here’s a list of information resources about LINQ, which is a fantastic extension to common programming models that we have today. Problem is, it seems to be quite a while away :-)


2005-09-12

This is the fourth article in my mini series about object pooling. Be sure to read part 1, part 2 and part 3 first. This part will be about automated object creation. To begin with, we need a way for the object pool to have additional objects created at all. One way to do that would be to just call new on the object type — and to use the new constraint on the generic class definition, of course. But that’s an unnecessary restriction, and it would imply that poolable classes always need to …


2005-09-11

This is the third article in my mini series about object pooling. Be sure to read part 1 and part 2 first. In this part I’m going to put some of the infrastructure in place that’s needed to handle the list of pooled objects, to make objects available and to allow for them to be put back into the pool.

Initializing the pooled object list

As I don’t want to look at automated object creation just yet, I’ll create a constructor for my pool that allows for a list of pooled objects to be passed …


2005-09-09

This is the second article in my mini series about object pooling. You can find the first part here. Now I want to get going by defining an interface for the pool — I don’t mean a C# interface, but rather a framework for the methods and properties that the implemented class is going to have. I’ve also given some thought to the internal organization. One thing’s clear: the pool needs to have a list of objects that it currently holds. This list will have to be extendable, but there aren’t any ot …


I’ll be at DeveloperDeveloperDeveloper Day 2 and also at the geek dinner that’ll hopefully take place afterwards. If you can make it to Reading on the 22nd of October, make sure you sign up! Session voting is now open and there’s a Taxi/Car sharing wiki available for those who don’t know how to get there or want company on the way. …