Show more talks about Programming

Are we there yet?

Rich Hickey

Are we there yet?

Rich Hickey

1h 10min Share on twitter

00:32 Are we being well served by object orientation as commonly embodied?

01:00 Ruby, Java, Scala etc. are all single dispatch, stateful object oriented languages.

01:42 They are superficially different.

02:02 They have more to do with the sensibilities of the programmer than they have to do with significant differences in the programming model.

02:17 Are we done? Are we gonna keep making languages that are just very slight incremental differences to the things that we know?

02:29 One thing is undeniable: people like object-orientation.

03:20 What drives us to makes changes?

03:28 What things should drive us to that?

Expectations of people for software will only ever increase.

Hickey 05:01

05:05 The complexity I want to talk about today is the incidental complexity: The complexity that arises from the way our tools work, from the ideas that embody our tools, from the ways our tools don’t work, from the ways our approaches don’t work.

05:22 We have a certain number of hours in the day. We have to solve problems.

05:24 Are the problems you are solving the problems of the application domain or the problems you set in front of yourself by choosing a particular language or tool or development strategy?

The worst kind of incidental complexity is the kind that’s disguised as simplicity.

Hickey 05:57

08:25 I think people that moved from C++ to Java did so in no small part due to the fact that they were no longer willing to bear this implicit complexity. I don’t wanna do manual memory management. It’s not part of the problem I’m trying to solve at all.

09:19 Is this a mutable thing or not? When will I see a consistent value?

09:37 This isn’t just a concurrency problem.

09:47 This is a big source of incidental complexity in programs, because we don’t know when we have a stable value.

10:16 If you hand a mutable thing to somebody and they may hand it to other people and then you need to change it. Who is gonna be affected by that? You have no idea.

10:37 This is every mutable language I’ve listed (Java, Ruby, Scala, JS etc.). There is no way to fix it.

10:43 We don’t have any standard time management.

Familiarity Hides Complexity.

Slide 10:52

11:00 Because we are so familiar with this, we are absolutely completely blind to it.

11:08 When people choose different languages, a lot of times they make the decisions on very superficial differences like syntax or perhaps sort of “this makes me feel good” expressivity differences, which I admit completely are real and valid, but are somewhat emotional.

11:26 In the meantime our systems are getting very hard to build, maintain and correct. In no small part that’s due to the incidental complexity.

11:39 We have these giant test suites and we run them every time we change any little thing, because we don’t know if we change something over here, it’s not gonna break something over there. And we can’t know.

12:17 We want to hide chunks of stuff, name them, encapsulate them, get them out of our way, so that we do not have to think about them and we can build something on top of that.

12:40 And I think it’s one of the selling points of object orientation, that this is the way to make these kind of units, that we can combine to make programs that are easier to understand.

12:54 It ends up that they are really not the best unit for that. The best unit for that are functions, in particular pure functions.

If you want something, you do not have to worry about, you should love the pure function.

Hickey 13:06

13:10 The pure function takes immutable values. It does something with them. The stuff it does has no effect on the world and no connection to the outside world. Then it returns another immutable thing.

13:24 So the entire scope of its activity is local. It has no notion of time.

14:06 In contrast objects and methods don’t have this property.

14:19 As great as functions are as building blocks, our programs in general are not functions. There are programs that are functions: compilers and theorem provers etc.

14:30 But a lot of programs run indefinitely long and people have an expectation of being able to see their behaviour, to have inputs as the program runs and get something different every time.

Most programs are processes.

Hickey 15:22

15:50 Object orientation was a way to say: How do we take our mental modal for the processes we see in the world and embody them in some kind of programming model?

16:15 Any programming model that tries to model the real world is essentially gonna be a simplistic thing.

16:48 Even though objects putatively are about process, there is no concrete notion of time in objects. No more so than there are in functions, but at least functions aren’t pretending to play with time. Functions say: there is no time.

17:07 Objects are pretending to deal with time and yet our objects systems don’t have any reified notion of time. There is nothing you can talk about explicitly.

17:17 Because most of them were born in the days when your program ruled the computer. You had a single monotonic execution flow. There was a single universal process controlling everything.

17:32 Now that that’s not longer true, we try to use locks to restore that vision of the world, but that vision of the world was never correct.

17:44 And you can tell in one key way, because we still don’t really have a concrete representation we can use for perception or memory. These objects are all live. They are time-bound.

The object orientated model has gotten time wrong.

Hickey 18:09

18:27 We’ve left out any concrete notion of time and there is no proper notion of values.

18:50 We’ve conflated two things: we’ve said the idea that I attach to this thing that lasts over time is the thing that lasts over time.

19:38 Time must be atomic and move in chunks. Time isn’t a real thing you can touch, but it’s something you derive from seeing these epical transitions.

20:08 There is no river. There is water there at one point in time and at another point in time there is other water there. River is all in our head.

21:08 There are no changing values. There are values at points in time and all you ever gonna get is the value for a point in time.

21:33 In Whitehead’s model (simplified) there is this immutable thing, then there is a process in the universe that’s gonna create the next immutable thing.

21:55 Entities that we see as continuous are a superimposition we place on a bunch of values that are coarsely related.

22:38 Actual entities are immutable.

The future is a function of the past.

Hickey 22:50

22:51 Process is what creates the future from the past.

22:57 Identities are mental constructs. It’s an extremely useful psychological artefact. that’s why we have object-oriented languages. It helps us understand things.

23:12 But we have to make sure we understand that objects are not things that change over time. We superimpose object on a set of values we saw over time.

23:44 Time is strictly a derivative if this series of events.

There is a becoming of continuity, but no continuity of becoming.

Alfred North Whitehead 23:56

25:32 A state is a snapshot. This entity had this value at this point in time. This concept of mutable state makes no sense.

25:53 Time is a completely relative thing. All time can ever tell you is this thing happened before or after that other thing or at the same point. It’s not a measurable thing, it doesn’t have dimension.

26:18 You can’t have logic on top of rivers, that can change. You can only have logic on top of values.

26:50 I do think we need identity. I think that the appeal of object orientation is valid. We care about this because it’s the way we are thinking about the world.

27:26 But we can’t screw up time and state the way we have and have it still be easier.

28:14 We don’t make decisions about the world by direct cognition. There is a disconnect between our logical system and the actual world. It’s not live.

28:44 The other thing we don’t get to do in the real world is to stop the world. Especially not to observe it.

29:50 Perception is uncoordinated. It’s massively parallel. It’s not message passing.

We are always considering the past. We are never perceiving the present.

Hickey 30:19

31:07 Our sensory systems are incredibly oriented around discrete events.

31:42 You cannot do logic if everything you are trying to consider is moving around.

32:02 We discretise things and then we have simultaneity detectors.

32:24 Making things happen and perceiving things are completely different. They shouldn’t be in the same construct. (methods)

33:22 Action has to be sequential.

33:33 This is a model for how to think about time:

33:46 A point in time is a value. It can’t be changed.

33:50 We will still probably organise our programs by identities. As long as you remember that the identity is a derived notion. It isn’t a thing that’s doing stuff.