1. 7

  2. 1

    I enjoyed this read.

    I wonder whether objects might be the simplest things that can maintain an internal state and update itself in response to messages. That is, if an object might be a function from a pair of state and messages to messages. This would be nice, because then objects would be Mealy machines.

    And, of course, I’m thinking categorically. There’s a category Aut of Moore machines; if we add state transformations to simulations, then we get a category Mealy whose objects are Mealy machines. This category’s abilities depend on its underlying state-transition formalism; when we put the category on top of set theory, then I think that we get a Cartesian closed category.

    In simpler words, we should be able to compile object-based languages to networks of Mealy machines.

    1. 1

      an object might be a function from a pair of state and messages to messages

      Reminds me of Objects as Closures:

      We have described the semantics of object-oriented languages by treating objects as closures. Specifically, we interpret an object as a message environment (binding messages to methods) with a hidden local environment (binding instance variables to values or locations).

    2. 1

      Consider an object… What is an object? Philosophers are always saying, “Well, just take a chair for example.” The moment they say that, you know that they do not know what they are talking about. Atoms are evaporating from it from time to time; dirt falls on it and gets dissolved in the paint; so to define a chair precisely, to say exactly which atoms are chair, and which atoms are air, or which atoms are dirt, or which atoms are paint is impossible…

      There are not any single, left-alone objects in the world—every object is a mixture of a lot of things, so we can deal with it only as a series of approximations and idealizations.

      The trick is the idealizations. One may prefer a mathematical definition; but those can never work in the real world. A mathematical definition will be good for mathematics, in which all the logic can be followed out completely, but the physical world is [too] complex. When we try to isolate pieces of it, to talk about one mass, the wine and the glass, how can we know which is which, when one dissolves in the other?

      A system of discourse about the real world must involve approximations of some kind. This is quite unlike the case of mathematics, in which everything can be defined.

      The Feynman Lectures on Physics, Vol. 1: p. 12-2; some phrases omitted for concision.

      1. 3

        The idea that ordinary objects are impermanent or unreal goes back a long way in philosophy. That line was a bit silly.

        1. 3

          Indeed! The philosophy of identity is literally ancient, and that includes its poster-child thought experiment, the ship of Theseus. However, I believe that despite his silliness, Feynman provides an excellent and approachable introduction to the abstract concepts of objects and identity for the modern-day programmer; hence why I shared the above excerpt.

      2. 1

        Parts of this essay fit with my personal axe to grind: I don’t think modeling objects on real world objects is particularly helpful. It may be useful as a way of getting intuitions working in an OO 101 tutorial, but I’m not even sure about that.

        Objects are a way or organizing code to achieve the goals of understandability, maintenance, extensibility, etc. It’s a further hypothesis that modeling them based on real world objects is generally a good way to achieve those goals, and I’ve never seen anyone really try to demonstrate that hypothesis, as opposed to assuming it.