Introducing Maria: The Real MVC

3 min read Original article ↗

In December 2011, James Ladd (@jamesladd) and I were chatting about JavaScript, its dynamic nature, and program design. During the discussion, James asked detailed questions and I needed to illustrate a few points about MVC. I created a GitHub repository with code we could discuss.

Fast forward 1.5 years, through many more conversations, much more research, testing, and refining, and the Maria framework for building MVC application in JavaScript is 1.0.0!

Over the past several years, the JavaScript community has been inundated with MV* frameworks. In the wake of the one-page app explosion, many JavaScript developers searched for ways to structure their larger browser applications more manageably. You can see in the source code of the frameworks that the authors were struggling away on their own attempting to solve the same problems. I’m willing to bet they went through a similar process I did trying to find discussions tailored to JavaScript about this famous MVC that was supposed to solve all their problems and more.

Why no one else chose to write an true MVC framework, I cannot figure. There is no doubt that the early Smalltalk MVC architecture inspired today’s MV* frameworks for JavaScript. My take on it was straight forward. The MVC architecture has withstood a 30 year test. It has passed that brutal test. It is still used for application programming. It is very useful for browser programming. Why not take this time-tested architecture and make a JavaScript framework true to the MVC that is implemented in Squeak Smalltalk and written about in Design Patterns? My experience with Maria has shown it was a good choice.

How true is Maria to the real MVC? Somewhere along the way, I downloaded the Smalltalk Squeak implementation, found the model, view, and controller classes, and started porting lines of Smalltalk to JavaScript. In places, the two really are that close. And it wasn’t like pounding a square peg in a round hole. It was a natural fit. As my detailed understanding of the Smalltalk implementation improved, more of my “creative” lines of code in the growing Maria were deleted and in their place appeared more ported lines from Smalltalk. Every single time it was an improvement. The Squeak classes have been around a long time. They are some of the best lines of code in all the world’s aggregate of software. They are a solid foundation on top of which to build an important application.

So if you want to build your applications on a solid foundation, I recommend you check out the Maria framework.