Mostly const

I’m writing a simple maze program in Silverlight, as a way of getting used to the platform.  Once the maze is generated, it’s effectively constant, but while it’s being generated, there’s some tricksy interactions.  What I really want is to have an object that’s modifiable during generation, and locked-down afterward.

The Java way to do this is to have a restricted interface for the locked-down users, and a broader interface/class definition for the generation.  The dynamic language way to do this is to ignore the issue altogether.  I’m probably going to do this the Java way, but I wonder if there’s an idiomatic C# way to do this, or if this is another area in which C# and Java are content to be close siblings.  I also wonder if there’s a language-design way to move this pattern wholely into the responsibility-space of the compiler.

Tags: ,

Leave a Reply