Posted on January 14th, 2009%
[Digression] This post has been sitting in a somewhat unfinished state for a long time. It feels good to finally post it!
In rewriting my baseball game, CSFBL, I made the decision to use Castle ActiveRecord (built on top of NHibernate) to handle the persistence of my domain model. As a result, I needed to find a simple but effective way to unit test this implementation.
The unit tests needed to accomplish the following:
- Test the initialization of ActiveRecord (which validates the database schema against the object mappings).
- Test object validation (since I am using Castle’s Validation component and the
ActiveRecordValidationBase<T> base class).
- Ensure that a domain object can be persisted to the database.
- Ensure that a domain object can be retrieved from the database.
- Ensure that multiple instances of an object with the same persisted primary key are equal.
How, then, do we do this? . . . → Read More: Unit testing an Activerecord domain model with NUnit
Posted on August 24th, 2007%
For the past seven years, I’ve been maintaining an online baseball game, CSFBL (Computer Simulated Fantasy Baseball League). It’s gone through many changes over the years, but its core is in many ways unchanged since 2002 — and therein lies a problem.
Back in 2002, CSFBL was getting about 50,000 to 100,000 page views per month. By the end of 2003, we were simulating about 1,500 games per day. Today, we get about 4 million page views per month, simulate up to 10,000 games per day, and have over 80GB of historical data (roughly 6 million games spanning 2,700 seasons). That’s significant growth — and the game is suffering as a result. It wasn’t built to scale this far – a victim of its own success and my own limitations as a programmer circa 2002.
I realized long ago that a rewrite from the ground-up was necessary. I’ve done extensive work rewriting the database schema to maximize efficiency, but that’s only . . .
→ Read More: ComputerSims Baseball: Powered by MonoRail and ActiveRecord
Recent Comments