The Core Abstraction is the Plain Old Class

Accepted

Created

Context

Ruby provides a lot of ways to share code and methods. Ruby can create powerful DSLs, however these tend to make it hard to understand where code originates from or what it's going to do at runtime. When maintaining an app, it's often more important to be able to quickly understand what it's actually doing than it is to have a compact fluent-English-style set of code.

Concerns or Issues

Brut's abstractions should be largely simple and easy to understand. It should be easy to figure out what class defines a method and where that method comes from. Even if there exists helper methods or other DSL-style APIs, these should be sugar on top of an easy-to-understand core that relies on as few complications as possible.

Decision

All features should have their core implementation as a basic class that minimizes mixins and delegation. The majority of Brut's internals, as well as an app created with Brut, should be possible by creating objects from classes, and calling methods on those objects.

Options Considered, but Not Chosen

Mixins and metaprogramming can reduce the number of characters required to implement something. This is to be avoided and is not considered good. Code that is designed to some sort of aesthetic quality is not valued. Excessive use of functional constructs is not valued when a class/object would suffice.

System Qualities or Desired Consequences

Brut's internals—and apps made with Brut—should be comprised of objects that have explicitly defined methods and explicitly defined arguments. RDoc should provide an accurate view of what is available without too much need for method_missing and other DSL-esque constructs.

Downsides

The primary downside of this approach is that there will be more characters involved in any given code. Creating DSLs or shorthands will always allow for fewer characters to be typed or read. We accept that our approach will be more verbose and more explicit.

Additional Rationale

A system that can be understand by its generated documentation will be easier to follow, learn, and extend. Having to grep for every incantation of a symbol, method, or class creates friction toward that end.