UCU: better than MVC

I propose a replacement for the MVC (Model-View-Controller) model for software design. The problem with MVC is primarily that View and Controller both address the same concern: the user experience. After well over a decade, software developers now know better. My new model keeps the model, but all the words are changed to avoid confusion with MVC.

UCU: Utility — Connector — User Interface

  • A Utility provides a well-defined service. For example, accessing a file or storing a collection of items. It has a contract which defines what it does, and its correctness is measured against the contract. That contract is some combination of documentation, code (method signatures, interfaces, etc.), and a test suite.
  • A Connector is how components are discovered and constructed. Thus this category includes constructors, factory methods, and dependency injection. Connectors should be simple, since a program consists of a rat’s nest of interconnected components. Bad connections are hard to test, and even harder to debug, so the only recourse is to make them hard to be buggy. Constructors should do no extraneous work, except for checking for illegal arguments. When there’s an illegal connection, the program should fail immediately. For example, a constructor for a database utility which takes a database URL should check the syntax of the database URL, but it should not try to connect to the database. (If the database is inaccessible, that’s a problem with the database, not with the program trying to access it.)
  • The User Interface (UI) is the part of the program that relates to how the user perceives and interacts with the program. Its correctness is measured against the user’s experience. (Many practitioners prefer the term UX, User eXperience. In this case, because you can program an interface but not an experience, I am using UI to refer to the software.) Humans have different perspectives, and their expectations may change over time. As a result, UIs are developed using rapid prototyping techniques. Like a Broadway stage, the UI should be designed for frequent and rapid changes. UI components that get reused frequently are really utilities, thus classes tend to migrate from UI status to utility status.

For more reading, here are my earlier thoughts, before UCU gelled. And here’s a Google Tech Talk on writing clean, testable code which influenced UCU.

Advertisements

Education gaps

A NY Times story on education disparities explains that the gap between lower income and higher income families has been increasing at an alarming rate.

There are a lot of things going on here. Wealthier families are spending nine times as much on their kids as lower-income families, up from five times in 1972. They’re also spending more time with their kids, particularly before Kindergarten. And I suspect that’s the crucial factor.

There are a lot of single-parent families out there where the parent is working multiple part-time jobs just trying to pay the bills. Compare that with my family, where we have a stay-at-home mom and both parents read to kids every day. It’s just not fair. Don’t get me wrong: I don’t feel guilty that I don’t deserve it. I think everyone deserves to have the same opportunities.

The NY Times article says it’s not just about money, but I think that would be a fine place to start. Labor protections have been eroding as full time jobs have given way to less regulated part time jobs. And the free market isn’t going to fix that—not when the jobs can migrate to other countries.

The inequalities can be solved through services. My family has benefited from parent training and pre-K services (ECFE, for Early Childhood and Family Education), which the school district provides at little or no cost. (Not counting taxes.) Studies have found negligible difference in education between stay-at-home parenting and high quality day care. (What they’ve found is that good parents are better than bad day care, and good day care is better than bad parents.) If parents work, they need affordable, high-quality day care that will prepare kids for Kindergarten.

Some people will call this Socialism, and claim that it will loose to capitalism in the long run. Well, now we have long term data. If you look at countries that do take care of their kids—such as the Scandinavian countries—they’re doing fine. At best, they’re doing much better than the US; at worst, it’s hard to argue that they’re being held back.

There are those who say we can’t afford this. I say we can’t afford not to. For every Steve Jobs or Bill Gates, there are thousands of micro-entrepeneurs who have the drive to build businesses that employ a few people, but collectively do just as much innovation. We need both kinds of entrepreneur. Both exist right now because of quality, affordable, available education. We as a society need to stop penny-pinching away the investments that pay for themselves. Parents understand this for their own kids. Why can’t we agree on it for all kids?