Source Code

XML RSS feed for this category.
[Valid RSS]


Practical Testing: 28 - Finishing the timer wheel Posted by Len at 4 Aug 2010 12:54 PM
Previously on "Practical Testing"... I'm writing a timer wheel which matches the interface used by my timer queue. This new implementation is designed for a particular usage scenario with the intention of trading space for speed and improving performance of...


Practical Testing: 27 - Fixing things... Posted by Len at 3 Aug 2010 05:53 PM
Previously on "Practical Testing"... To deal with some specific usage scenarios of a piece of general purpose code I'm in the process of implementing a timer wheel that matches the interface to the timer queue that I previously developed in...


Practical Testing: 26 - More functionality, more refactoring and a new bug Posted by Len at 23 Jul 2010 09:56 AM
Previously on "Practical Testing"... To deal with some specific usage scenarios of a piece of general purpose code I'm in the process of implementing a timer wheel that matches the interface to the timer queue that I previously developed in...


Practical Testing: 25 - Nothing is free Posted by Len at 21 Jul 2010 02:13 PM
I'm in the process of implementing a timer wheel that matches the interface to the timer queue that I previously developed in this series of articles. The idea being that for certain specific usage scenarios the timer wheel will perform...


Practical Testing: 23 - Another new approach: timer wheels Posted by Len at 19 Jul 2010 09:01 AM
The most recent articles in the "Practical Testing" series have been discussing the performance of the timer queue that we have built. As I hinted when I first brought up the performance issues, the particular use case that I have...


Practical Testing: 22 - Performance: Some you win... Posted by Len at 15 Jul 2010 09:29 PM
The previous article in the "Practical Testing" series set things up so that we can measure the performance of the code under test with the intention of trying to improve performance for a specific set of use case scenarios. This...


Practical Testing: 21 - Looking at Performance and finding a leak Posted by Len at 15 Jul 2010 11:43 AM
Back in 2004, I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to...


Practical Testing: 20 - Mind the gap Posted by Len at 12 Aug 2008 12:44 PM
Back in 2004, I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to...


Practical Testing: 19 - Removing the duplicate code Posted by Len at 3 Aug 2008 09:28 PM
The code in the last two articles in the "Practical Testing" series have contained a considerable amount of duplication. This came about for a couple of reasons. Firstly part 17 was a bit rushed and secondly it was useful to...


Practical Testing: 18 - Removing the potential to deadlock Posted by Len at 2 Aug 2008 12:15 PM
Back in 2004, I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to...


Practical Testing: 17 - A whole new approach Posted by Len at 9 Apr 2008 06:54 PM
The comments to my last practical testing entry got me thinking. The commenter who had located the bug in part 15, which was fixed in part 16, suggested a new approach to the problem and I've been investigating it. The...


Practical Testing: 16 - Fixing a timeout bug Posted by Len at 4 Apr 2008 10:28 AM
Back in 2004, I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to...


Latest release of socket server code Posted by Len at 14 Feb 2006 08:40 AM
This is the latest release of the free version of my asynchronous, windows, IOCP based, socket server framework. The previous release is here. The latest release is really just a bug fix and compiler compatability release. The code now supports...


Practical Testing: 15 - Testing payback Posted by Len at 1 Nov 2005 12:50 PM
Last year I wrote a series of articles called "Practical Testing" where I took a piece of complicated multi-threaded code and wrote tests for it. I then rebuild the code from scratch in a test driven development style to show...


Practical Testing: 14 - Bitten by the handle reuse problem Posted by Len at 7 Mar 2005 01:53 PM
A long time ago, on Practical Testing: I mentioned that there was a small chance that the way that ResetTimer() operated could mean that you could pass in a handle that you no longer owned and affect someone else's timer...


Practical Testing: 13 - Missing functionality Posted by Len at 22 Oct 2004 08:54 AM
Previously, on Practical Testing: we added a multi-threaded version of our timer queue that manages timeouts automatically. This time we'll integrate our new timer queue into an application that uses the old version of the code and, along the way, discover some functionality that the original version requires but that the new version currently doesn't.


Practical Testing: 12 - Threading is orthogonal Posted by Len at 9 Oct 2004 10:51 PM
Previously, on Practical Testing: we finished our reworking on the code we were left with a simpler timer queue that passed all of our tests, but was single threaded and needed manual intervention from client code to manage timeouts. Today we'll add back the multi-threaded functionality so that the queue manages timeouts automatically.


Practical Testing: 11 - Moving away from the simplest thing Posted by Len at 21 Aug 2004 01:59 PM
Previously, on Practical Testing: having decided to rework the code from scratch in TDD style we fixed the tick count bug for the second time - this time the solution was cleaner and simpler. At the end of that episode we were left with a failing test. The test was for multiple timers and it failed because our TDD route was taking a 'simplest thing that could possibly work' approach and that design only supported a single timer. Today we'll fix that problem by moving nearer to a real world solution.


Practical Testing: 10 - Fixing the tick count wrap bug, again Posted by Len at 24 Jul 2004 08:24 AM
Previously, on Practical Testing: having bolted on some tests to an existing piece of code we're now doing some "agressive refactoring" ;) and rewriting the code from scratch using the testing ideas we developed earlier. The whole point of this exercise was to fix a known bug, we did that in the existing code here, now we have a test that forces us to address the issue in the new code.


Practical Testing: 9 - More tests, more development, notice the order? Posted by Len at 21 Jul 2004 11:35 PM
Previously, on Practical Testing: we fought through the pain of writing tests for hard to test code and then we decided to see what it could have been like if we'd developed the code test first... Now we'll add some more tests and some more code, still keeping it all nice and simple...


Practical Testing: 8 - Once more, with tests first Posted by Len at 21 Jul 2004 09:58 PM
I've been writing some blog entries about a piece of code from my 'back catalogue' that didn't have tests and that had a known bug that was reasonably hard to test for. Right at the start I commented that the code was a tad over complicated due to the way it had been developed using HITIW (Hack it till it works). The complexity in the code itself made writing tests for it harder than it should have been and, well, I wouldn't write code like that these days (honest). So, here we are in part 8 and I'm about to throw the first version away and write a new version of the code and this time we'll do it test first and take a look at how the desire to be able to test the code shapes the design. I know you're probably thinking that this is just a bit contrived but I really did just sit down with an empty file and the tests that I had from last time and write the simplest thing that could work to pass the first test...


Practical Testing: 7 - Fixing the tick count wrap bug Posted by Len at 21 Jul 2004 08:45 PM
Previously on Practical Testing: After far too much work we finally got to the point where we had a test for the tick count wrap bug. Now that we have a failing test we can fix the bug.


Practical Testing: 6 - Tests refactored Posted by Len at 25 May 2004 06:10 PM
Previously on Practical Testing: The last entry ended with us having two tests, both of which were in need to a good refactoring. The second test had uncovered an unexpected bug... This time around we'll refactor the tests, fix the bug and finally write the test for the tick count wrap bug...


Practical Testing: 4 - Taking control of time Posted by Len at 19 May 2004 10:49 PM
I'm writing some blog entries that show how to write tests for non trivial pieces of code. This is part 4.


Practical Testing: 3 - Test 2, Enter The Mocks Posted by Len at 18 May 2004 11:30 PM
I'm writing some blog entries that show how to write tests for non trivial pieces of code. This is part 3.


Practical Testing: 2 - The first test Posted by Len at 17 May 2004 08:42 PM
I'm writing some blog entries that show how to write tests for non trivial pieces of code. This is part 2.


Practical Testing: 1 - Introduction Posted by Len at 17 May 2004 07:51 PM
I'm writing some blog entries that show how to write tests for non trivial pieces of code. This is part 1.


Bluetooth sockets Posted by Len at 22 Jun 2003 08:34 PM
This morning I decided to investigate the Windows XP SP1 Bluetooth support. I played with the BluetoothXXXX API and quickly became disapointed. I then moved on to looking at how to access the Bluetooth hardware using Winsock and decided...


More socket server code updates Posted by Len at 15 Jun 2003 12:21 AM
I've updated the code for two more of the socket server articles. More merging, project file updating, and testing... [NOTE: This code leaks when adjusted to build with Visual Studio 2005. This seems to be due to a bug in...


Socket Server code updates Posted by Len at 13 Jun 2003 03:08 PM
For some time I've been promising to update the socket server articles to use the latest version of my code. Today I finally updated the code for the first article. I'm going to update the article itself soon, but in...


Using OpenSSL with Asynchronous Sockets Posted by Len at 4 Nov 2002 01:08 PM
OpenSSL is an open source implementation of the SSL and TLS protocols. Unfortunately it doesn't play well with windows style asynchronous sockets. This article - previously published in Windows Developer Magazine - provides a simple connector that enables you to...


Sinking connection points in C++ objects. Posted by Len at 30 May 2002 01:00 AM
Sometimes it would be nice to be able to use a simple C++ object as a sink for Connection Point notifications. This article shows you how....


Designing asynchonous COM components for VB Posted by Len at 11 Apr 2002 01:00 AM
This example COM component provides three COM objects for using the Win32 Mailslot IPC mechanism. The component may be useful if you need to communicate from VB using Mailslots. However, the reason I wrote it was to demonstrate creating a...


AVL Tree Posted by Len at 7 Aug 2001 11:31 AM
A "generic" AVL Tree, from the dark days before templates... The code here is some of my first C++. Back in 1991 C++ was still pretty new. Looking back at my early C++ is better than looking back at my...


Rooms 1.7 Posted by Len at 2 Aug 2001 11:25 AM
In 1989 I taught myself C to write an adventure game, the code's fairly bad, but 10 year's later, the game's still quite cool!...


Java caches in the middle tier Posted by Len at 26 Jul 2001 08:18 PM
A common way to improve the performance of Java code is to cache objects rather than repeatedly create and destroy them. This is especially true when you're writing middle tier servers that service client requests and return results objects. Implementing a flexible caching scheme in Java is relatively easy, but there are a few things to watch for.


The CORBA Evictor Pattern in Java Posted by Len at 23 Jul 2001 01:00 AM
When a CORBA server allows its clients to create and destroy objects one of the recommended ways to handle the object lifetime issues is using the Evictor Pattern. In The Evictor Pattern we solved the problem for C++ servers, here...


CORBA - Keep Alive Posted by Len at 17 Mar 2001 01:00 AM
One way of making a reference counted implementation more robust is to run the keep-alive protocol yourself. We demonstrate this option here....


CORBA - The Evictor Pattern Posted by Len at 15 Mar 2001 01:00 AM
Since CORBA doesn't really support reliable reference counting implementations we'll compare one of the recommended methods of servant life-time management with our reference counted iteration interface....


CORBA - Iteration Posted by Len at 9 Feb 2001 02:00 AM
A CORBA style method of enumeration can be seen in the iteration interfaces on the CORBA Naming Service. Given the code we've already written for the enumeration interface we can easily implement an iteration interface as well as (or, more...


CORBA - Enumeration Posted by Len at 9 Feb 2001 01:00 AM
CORBA provides sequences as a way of returning collections of items from an method call. The problem with just using unbounded sequences is that the client has no control over how many items it receives as a result of the call. COM gets around this problem using the IEnum style interfaces that allow a client to control how it accesses the items in a collection.


CORBA - More Reference Counting Posted by Len at 6 Feb 2001 01:00 AM
Although we managed to develop a working solution in the first CORBA reference counting article the results were ugly and fragile. In this article we attempt to clean things up a little and, in doing so, get intimate with the Portable Object Adapter and its Servant Managers.


CORBA - Reference Counting Posted by Len at 6 Feb 2001 12:00 AM
We've been developing code on Windows and Unix for quite some time, but most of the distributed component work we've been involved in has been done using COM. That's changing now as clients have more requirements for Unix based component solutions. We're currently evaluating CORBA ORBs and learning how the CORBA way of doing things differs from the COM way. The first difference that we came across was the way that CORBA servers deal with object lifetime issues. Adding reference counting to CORBA objects isn't as easy as it first seems Please note that these articles initially explore COM concepts implemented in CORBA, some of the early implementations, whilst working examples, aren't at all production quality... If you want something reliable, that works, skip forward to the Evictor Pattern.


COM+ Administration Posted by Len at 29 Jun 2000 01:00 AM
COM+ applications can be complex to configure and there's no standard way to save that configuration in a form that can be placed under version control. Luckily the COM+ Catalog is accessible by a set of completely scriptable COM objects....


OLEDB - Disconnected Recordsets Posted by Len at 21 May 2000 01:00 AM
If you are going to use the client cursor engine then often it's a good idea to disconnect your recordset......


MFC - Include/Exclude list boxes Posted by Len at 26 Feb 2000 01:00 AM
How to package lots of standard functionality into a CListBox derived class....


OLEDB - Client Cursor Engine updates Posted by Len at 2 Jan 2000 01:00 AM
Making the ADO Client Cursor Engine believe that your rowset is updateable involves jumping through a few extra hoops......


OLEDB - Updating data through an ADO recordset Posted by Len at 2 Jan 2000 01:00 AM
The ATL OLE DB Provider templates only seem to support read-only rowsets, and making them support updating of data isn't as easy as you'd expect!...


OLEDB - IRowsetLocate and Bookmarks Posted by Len at 16 Oct 1999 01:00 AM
Adding bookmark functionality is relatively easy and it enables our ADO recordset to be used with a greater number of data bound controls....


OLEDB - Custom Rowsets Posted by Len at 15 Sep 1999 01:01 AM
The ATL OLE DB Provider templates appear to rely on the fact that your data is kept in a simple array, but that's not really the case at all!...


OLEDB - Objects via ADO Posted by Len at 15 Sep 1999 01:00 AM
ADO seems to be the ideal way to expose tabular data from your own COM objects and the ATL OLE DB Provider templates can help!...


MFC - Templates Posted by Len at 30 Sep 1998 01:01 AM
Templates are a great way of reusing code, unfortunately MFC makes it hard to write MFC friendly template classes......


IEnumXXXX Posted by Len at 30 Sep 1998 01:00 AM
COM objects generally provide access to sequences using an IEnumXXXX style interface, this class wraps that with an STL style iterator...