date: 2018-12-20
tags: awsimcock-dreams
subject: VO models

VO models - 2018-12-20 - Entry 1615 - TOGoS's Journal

I was walking along a river with a friend. There were oil spills and algae blooms and it was generally kind of a mess. There was a sandy beach and we walked up to the top, which brought us to Hammersley kitty-corner across from my parents' house. I saw Becky in the window. She was looking at us through binoculars.

In another dream I was at work. At first I was naked, but then I decided that remaining that way might make my coworkers uncomfortable, so I started putting on my single-piece pajamas on. I had them about halfway on when I realized they were inside-out and there was a poop stain on one pocket. Then Adam walked in and started talking to me about some project.

Then I was in a meeting with a couple of other programmers. One of them was talking about this technique they were using where all operations were written in terms of small easily-overridable methods on an object associated with (but not encapsulating) a piece of data. You would instantiate one of these processing objects per piece of data, even for small things like a single floating-point number. "It's like Scott's VO and VO model objects!" I said. "We tried that and it made the code very confusing!" They looked at me like I was an asshole for dismissing their idea so quickly. And then I felt bad because I realized I could have taken more time to learn about the approach and how it was useful before telling them it was bad.

(I've found that this kind of approach actually does make some sense in some cases in C++, due to RAII and the fact that there is no run-time cost for encapsulating things in objects. E.g. a constructor for a type that's specific to one situation, but that causes e.g. unit conversion to happen automatically. The Factorio codebase is full of this kind of thing (e.g. the different Position classes), though when used on common types (instead of introducing a new type for the occasion) it can lead to an annoying diversity of constructors, and then you don't know which one you should be calling.)