Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Real World Objects

Real World Objects

Explore a better digital representation for real-world objects

Minori Yamashita

December 26, 2013
Tweet

More Decks by Minori Yamashita

Other Decks in Programming

Transcript

  1. “Software objects are conceptually similar to real-world objects: they too

    consist of state and related behavior” (What is an Object — The Java Tutorials) オブジェクトの概念は現実世界の物と似ている。それ (オブジェクト)も状態と、関連する振る舞いでできてい る。
  2. “Simula is considered the first object- oriented language. As its

    name implies, Simula was designed for simulation” (Simula — Wikipedia, Free Encyclopedia) Simulaは世界初のオブジェクト指向言語だと考えられている。その名前の通り、 Simulaはシミュレーションの ためにデザインされた。
  3. No!

  4. Things I used to point out which I do no

    longer • RWOs have no knowledge about their usage ◦ A book can be used to hit people • RWOs do not respond to messages ◦ Boxes do not answer when we ask them its heights ◦ Instead, an external intelligence has to measure them These mismatch become trivial if we imagine a city that everything has a micro computer embedded into it.
  5. History-preserving objects seem like a natural transition from traditional objects.

    • Make every instance variable immutable • Make every method return a new object with a reference to the current object
  6. A problem: Q: Won’t this model eat up memory? A:

    Not as much as you would think but Yes. Since every object is immutable, it can be made persistent. ∴ a new state would require a lot less space than a full-copy. However, memory usage grows linearly over time. A more compact representation is needed.
  7. History of an object (i.e. snapshots of the past) doesn’t

    have to be contained within itself (i.e. current snapshot) ... if we could express a 4D object directly
  8. In practice, what gets folded would be a stream of

    events instead of ticks of a clock.
  9. • Event Stream = Blocking Queue • Folding function writes

    to its neighbors’ event stream Side-effects propagate through various MOs’ event streams Modifications to make MOs practical
  10. (fold (^ e s s’) brain [...]) (fold (^ e

    s s’) cup [...]) (fold (^ e s s’) mouth [...]) (fold (^ e s s’) fisher [...]) (fold (^ e s s’) stomach [...]) (fold (^ e s s’) fish [...]) (fold (^ e s s’) toilet [...]) (fold (^ e s s’) river [...]) Minkowski Object Oriented Programming fill coffee drink coffee fill coffee fill pee add water provide oxygen catch fish eat fish get smarter get excited
  11. Conclusion • Mutable objects aren’t representing anything in real-world 破壊可能なオブジェクトは現実世界のなにも表現していない

    • Functional programming can provide a more concise analogy for real-world objects 実は関数型の方がより正確に物体を喩える事ができる • OOP probably is too weak to make SciFi come true オブジェクト指向はSFを現実にするには弱すぎるのかもしれない