Accidental MVC
So this app I’m writing and maintaining at my day job. It accepts requests over this painful legacy protocol, performs some action based on that request, encodes the result in the same painful legacy protocol, and returns it to the client.
The way it’s designed, it has an array of IMessageHandlers that are each bound to a particular request type. So if a GETPRT request comes in, it loads up the GetPartMessageHandler which processes it and returns a result to send back to the client.
I had an epiphany a while back. This is MVC. If I didn’t have to deal with the legacy network protocol and weird encoding scheme, I could drop all this custom message handling code stuff in the dumpster and drop in one of 800 MVC web app frameworks and be done with it.
The command type, say GETPRT, could be mapped to http://server/GETPRT, and we could use our handy dandy routing engine to say route $GETPRT^ to the GetPart action on the PartController.
So in essence, I think I grew an MVC framework. It’s actually a little Django-ish, because I don’t really use controllers. But neat.
I wonder if I could have saved time if I had realized this would fit so well with MVC from the get go.
Post a Comment