The Power of MVC: Binary Clock Mod

When I created my digital clock, one of the things I wanted to show was how OOCSS and MVC could be used to provide a clean, clear separation of concerns between the View, i.e. HTML and CSS, and the View Controller, i.e. Javascript. Along those lines, I had always intended for it to be possible to slap a different View onto the clock with no mods to the View Controller, but the proof is in the pudding, right?

Along came Daniel Lamb, who put that to the test, and created his spiffy binary clock mod.

He created a slightly modified View structure for the binary clock display in his HTML, and then cleverly applied OOCSS principles to inherit from my original OOCSS. Most interestingly, though, notice that he didn’t change a single line of code in the JS View Controller. In fact, he referenced my JS View Controller directly in his script tag. Because CSS classes are used as a message passing mechanism, and his View responds to the same messages, the binary clock works perfectly.

I’d like to thank Daniel for creating such a cool mod and perfectly illustrating the powerful separation of concerns that OOCSS and MVC can provide.