Mimosas

Mimosas implements MVC’s original Smalltalk-80 architectural system. It is an honest attempt to disconnect from all the fancy modern development paradigms and reconnect with the basics of MVC. The aim is not to be a clone of Smalltalk MVC, but to capture its spirit, build upon its foundations, and possibly make something useful in the process.

Documentation

Documentation is included in HTML format in the docs/ directory. Things should do exactly what they say they will do and nothing more. In other words, the documentation should be just as DRY as the code, so there isn’t a lot of elaboration unless it is clearly necessary.

Installation

Mimosas doesn’t have any dependencies. The only file that is required for use in your project is mimosas.js. There are three options for obtaining this file:

Once you have the file, reference it in your project, then check out the Getting Started section.

Overview

As in Smalltalk, Mimosas divides an application into three parts, the model, view, and controller.

In Smalltalk-80 views were always heirarchies, with one single “top view”, and many child views. A single view could represent both single items, such as a checkbox, or more complex components, such as a list of selectable items.

In Mimosas, the top view and other views which can have children implement the ViewComposite class, which is the Composite in the Composite pattern. Views that do not have children implement the ViewLeaf class, which is the Leaf in the Composite pattern. Both classes inherit from the ViewComponent (Component), which in turn inherits from the ViewObserver (Observer).

Views and controllers are tightly coupled. They both maintain a reference to the other. Mimosas minimizes this coupling by forcing views to communicate with their respective controllers through the ControllerContext class, which is the Context part of the Strategy pattern and can be viewed as a sort of Facade in this scenario. This communication happens transparently.

Lastly, models can be strings, a single object, or a collection of objects. Smalltalk didn’t really care, as long as they inherited from a base object. In Mimosas that object is the ModelSubject.

Getting Started

You can use Mimosas in the browser with AMD and globals, or on the server using Node. This is accomplished with the returnExports UMD pattern. The controller/view event handling needs to be refactored to work without the DOM on the server side.

// Node
var Mimosas = require('libs/mimosas');

// Browser AMD
define(['libs/mimosas'], function (Mimosas) {});

// Browser Globals
window.Mimosas;

Next, create your Models, Views, and Controllers by extending Mimosas core classes. If you’re using plain JavaScript you’ll need to manage inheritance using the Mimosas.Class.extends method. Whenever there’s talk about “extending a class” use this pattern with your constructor functions:

var MyClass = (function(classToExtend) {
  Mimosas.Class.extends(MyClass, classToExtend);
  function MyClass() {}
  // ..prototypes
})(ClassToExtend);

Here’s a basic example:

var Model = (function(classToExtend) {
  Mimosas.Class.extends(Model, classToExtend);
  function Model() {}
  // ..methods
})(Mimosas.ModelSubject);

var View = (function(classToExtend) {
  Mimosas.Class.extends(NewSongView, classToExtend);
  function View() {}
  // ..prototypes
})(Mimosas.ViewLeaf);

var Controller = (function(classToExtend) {
  Mimosas.Class.extends(NewSongController, classToExtend);
  function Controller() {}
  // ..prototypes
})(Mimosas.ControllerStrategy);

If you’re using CoffeeScript it’s a little easier. For example:

class Model extends Mimosas.ModelSubject
  # ..methods

class View extends Mimosas.ViewLeaf
  # ..methods

class Controller extends Mimosas.ControllerStrategy
  # ..methods

Versioning

Mimosas is maintained under the Semantic Versioning guidelines. Releases will be numbered with the following format:

Given a version number MAJOR.MINOR.PATCH, increment the:

  1. MAJOR version when you make incompatible API changes,
  2. MINOR version when you add functionality in a backwards-compatible manner, and
  3. PATCH version when you make backwards-compatible bug fixes.

Development

If you want to work on Mimosas you need to have node and npm installed. Once you have got that taken care of, run npm install to update all the required dependencies.

To update a specific NPM package run npm install <name> --save-dev. This will install the latest version of the package and update the package.json file with the new version number.

Once the node modules are installed run bower install in the root directory to get the project-specific components. Each of the examples have their own components, which should be installed the same way, as needed.

  • Run npm start to build the project
  • Run npm test to run the unit tests

Contributors

License

Mimosas is free software. See the LICENSE file for more information.

Impeccable words

By on

In The Four Agreements, Don Miguel Ruiz discusses the impeccability of words:

…like a sword with two edges, your word can create the most beautiful dream, or your word can destroy everything around you.

But this example really drove the concept home for me (emphasis mine):

If I see you in the street and I call you stupid, it appears that I’m using the word against you. But really Im using my word against myself, because you’re going to hate me for this, and your hating me is not good for me. Therefore, if I get angry and with my word send all that emotional poison to you, I’m using the word against myself.

I’ve been ruminating on this concept for a little while now, and the thought that I keep coming back to is this: how many of the things I say are working against me? Even the smallest of remarks has the power to create ripples which could change my life. I am speaking with intention? Are you?

Grunt publishing

By on

I wrote this Ruby command line app to give Jekyll a better publishing workflow. Then I switched over to Hugo and couldn’t post anything at work1 because installing Ruby on Windows was crazy hard for this old Linux guy2.

So I decided to go low-tech and use Grunt to manage my publishing workflow. Why not use Hugo’s built in archetypes? They don’t have all the special values that I want. For example, I use a 3 byte hex string for my post URLs. Hugo doesn’t have that.

So now I just run grunt do:post:"Post name" and I’m done. Cross platform, easy to maintain, and no extra dependencies. Check out the source for the do task in my Gruntfile on GitHub for more info.


  1. I like to post about stuff I learn while it’s fresh [return]
  2. Ironic isn’t it? [return]

Arizona workhorses

By on

Arizona Makes Workhorses—Not Unicorns—and That’s a Good Thing - Pure Chat Blog

Here [in Arizona], we develop products and services that rock, but more importantly, they solve problems. And then we effectively price and market the hell out of them. Now, there are tech companies everywhere that do this. But there’s a big difference between the companies here and those in Silicon Valley: We have to focus on a solid business plan right from the beginning. Because there are little to no institutional investors here, tech companies worry about revenue from the beginning. We hone in on profitability and scale. And because it’s a struggle to get funded, businesses are forced to be scrappy and run lean. We don’t have the luxury of focusing only on top-line growth, and we could never be short-sighted enough to burn significant cash in the name of acquisition or IPO. Because of this environment, startups here have a patience, passion, and dedication unlike those found in Silicon Valley.

I’ve always looked at the Arizona tech scene as barely-there, mostly because we don’t produce many super shiny billion dollar tech companies. But I’m starting to come around to the idea that we just do things different. In fact, it seems a lot like the tech industry may be starting to embrace our approach, as it swings back toward the idea of simple, honest work.

Reconsider

By on

RECONSIDER – Signal v. Noise

There’s an incredible connection possible when you align your financial motivations with the service of your users. It’s an entirely different category of work than if you’re simply trying to capture eyeballs and sell their attention, privacy, and dignity in bulk to the highest bidder.

I’m going to pull out another trite saying here: It feels like honest work. Simple, honest work. I make a good product, you pay me good money for it. We don’t even need big words like monetization strategy to describe that transaction because it is so plain and simple even my three year-old son can understand it.

Simple, honest work. I love that. Personally, I don’t want to own the univerise, dominate the markets, or capture the customers. I just want to build software that people love to use enough to pay for it.

Tech books

By on

They say if you read a certain amount of books related to your industry that you’re an expert. I don’t know how many books you have to read to qualify for that, but here’s what I can remember reading over the past 15 years (excluding books from college). For the record, I still don’t feel like an expert.

General programming

Language-specific

Design related

Business and productivity

Tool-specific

The books that got me started