Live data from Hacker News

Alan Kay and OO Programming

ovid.github.io

61–70 of 141 posts

Re: Alan Kay and OO Programming

#61
What is late binding of everything ?

To me it's a bit like doing the opposite of what macros in Lisp do, but to do it during run-time rather than compile-time.

Take Ruby for instance (which is interpreted in its standard implementation). You can define methods at runtime and 'keywords' that allow you to define new methods are methods as well.

As a result you can extend the more "static" part of the language, adding new ways to declare methods and other "quasi-syntactic" sugars because this static part has been moved close to run-time and is executed like any other part of code. There are still a few things you can't do, like building a new way do declare classes or changing the superclass they point to.

Edit: this interpretation is driven by the notion of PHP's Late Static Bindings[1].

[1] https://php.net/manual/en/language.oop5.late-static-bindings...

Re: Alan Kay and OO Programming

#62
post #4
post #2

I have a ton of respect for Alan Kay and think he's a genius. But why does it seem like every time he talks about OO it's always painting an apocalyptic picture like we're in some kind of twilight zone alternate nightmare reality of broken patterns and models? Surely our concept of objects and OOD can't be that bad, but his apparently contrary outlook is just so persistent...

> I have a ton of respect for Alan Kay and think he's a genius. But why does it seem like every time he talks about OO it's always painting an apocalyptic picture like we're in some kind of twilight zone alternate nightmare reality of broken patterns and models? Because we are? Have you seen most OOP code-bases, they are a train wreck!

I think one of the biggest issues is that languages such as Java account for large percentages of existing OOP in the wild and Java is a "kitchen sink" language with too many supported paradigms and styles.

For example, look at class attributes and methods. I'm not sure they're needed but in a language like Java the semantics often leads to wildly different programming styles within the same code base. And it's hard to enforce consistent styles using conventions.

That said, I've seen/read Kay asked directly, on more than one occasion to elaborate on his notion of a real OOP language implementation and his answers are always to coy and slippery for my taste.

Re: Alan Kay and OO Programming

#63
post #38

Earlier quoted context omitted.

Why next week? Why not use the integration tests as part of your debug cycle now? The kinds of integration tests that I write only take a few milliseconds to run so if they fail I can just make a code change (or add a new breakpoint or log), then run again, then repeat. The flow should not be any different from doing TDD with unit tests. Note that integration tests don't necessarily have to be end-to-end; the point i…

> Why next week? I think pleasecalllater's point is that without unit tests, you'll spend a lot of time just pinpointing the bug, since it could be anywhere in your module (which unit tests would cover), not just at the interface to other modules (which integration tests cover).

If your tests:

- run fast (- run on your local machine

- run on your local code (including uncomitted diffs)

... whether they're called "integration" or "unit" tests doesn't matter, as they will detect regressions at the earliest possible time.

Unit tests might guarantee smaller code search area (because maybe the failing test only executed 1% of the code), but if running "git stash" makes all the tests pass again, I have a pretty good confidence about where the error lies.

Re: Alan Kay and OO Programming

#64

>> Extreme late-binding is important because Kay argues that it permits you to not commit too early to the "one true way" of solving an issue (and thus makes it easier to change those decisions), but can also allow you to build systems that you can change while they are still running! >> Binding can also refer to binding a variable type to data. As someone who has over 15 years of experience going back and forth betw…

> Why does the new generation so easily discard this vast amount of wisdom?

If you are actually looking to have some input from people who prefer statically typed languages about their reasons, you might want to write your comment in a way that does not presuppose that these people are obviously wrong (and, apparently, unwise).

Re: Alan Kay and OO Programming

#65

What is late binding of everything ? To me it's a bit like doing the opposite of what macros in Lisp do, but to do it during run-time rather than compile-time. Take Ruby for instance (which is interpreted in its standard implementation). You can define methods at runtime and 'keywords' that allow you to define new methods are methods as well. As a result you can extend the more "static" part of the language, adding n…

Rather than seeing "late binding of everything" as a specific implementation or bits and pieces of a particular implementation, I find it is much more clear to see it as a general self-referential idea. Why then would one _go against it and try to constrain it_ ?

Taken in that light, as the article does a really good job of explaining, late binding of everything is a modeling process (or a process of thinking about things). It means that I should try and keep parts of the structure that I'm building up as flexible as they can be so that they match the model in my mind. One benefit of doing that is that I can later revisit and rework them. Another benefit that is seldom talked about, is that _the object I'm working on no longer constrains my thinking_.

In other words, only specify in detail that which is crystal-clear in my mind model, and get away with fuzzier representations elsewhere. Tools and languages that fall inline with that process, not only empower one to work in this way but make it _ultra-efficient_ by triggering short feedback-loops and allowing the programmer to mesh with the modeled object.

Re: Alan Kay and OO Programming

#66

>> Extreme late-binding is important because Kay argues that it permits you to not commit too early to the "one true way" of solving an issue (and thus makes it easier to change those decisions), but can also allow you to build systems that you can change while they are still running! >> Binding can also refer to binding a variable type to data. As someone who has over 15 years of experience going back and forth betw…

I really don't agree with your point. The analogy Kay uses with biology is very telling :

Cells (co-)evolved for billions of years, they were not "designed" to accomplish certain tasks. Just survival and reproduction. And still, even with those billion of years, we still have cancer (as in bug in the reproduction process).

We design software. We evolve software. Software doesn't build itself, or decide for itself what's the best way to accomplish some task. We maintain software, we need guarantees, as much as we can get.

Dynamic languages let you think a problem you haven't thought of at design time will somehow solve itself magically at runtime, using components designed weeks before, with knowledge of that time.

It just doesn't work. It's an ideal vision that explodes as soon as your software gets any kind of commercial success and longevity, and you need to maintain it, and evolve it.

Re: Alan Kay and OO Programming

#67
post #8

Earlier quoted context omitted.

Sending messages asychronously and not knowing who (or even if anyone) will handle it is pretty desirable. Like a holy grail of writing maintainable software. (think of async communication via a queue) Isn't always possible, but it's worth the constant vigilance to drive each feature towards that type of architecture.

OK, I must be missing something fundamental, then. Let's say you want to take payment and ship a product. You send a message that payment of X is needed. And... nothing happens because the component that handles that isn't listening for whatever reason. Do you wait for a message saying payment was posted? How long do you wait? What about the UI? How long does the customer wait? It seems like a messaging system like t…

If I'm the service that needs a payment, then it is up to me to make sure it happens. If it doesn't, then I need to deal with that, because that's something that can happen with a payment.

So if I don't hear from the payment that it has been initiated, then I have to go on the basis that I can't get a payment.

But I also don't get to tell the payment how to deal with its internal activities, I don't want to know about it retrying, or working out which payment provider to use etc.

Objects arent FiniteStateMachineManagerFactories. They're actual things that your system is built to handle. If an object needs an FSM, it'll get one, just like cells have mitochondria.

Re: Alan Kay and OO Programming

#68
post #8

Earlier quoted context omitted.

Sending messages asychronously and not knowing who (or even if anyone) will handle it is pretty desirable. Like a holy grail of writing maintainable software. (think of async communication via a queue) Isn't always possible, but it's worth the constant vigilance to drive each feature towards that type of architecture.

OK, I must be missing something fundamental, then. Let's say you want to take payment and ship a product. You send a message that payment of X is needed. And... nothing happens because the component that handles that isn't listening for whatever reason. Do you wait for a message saying payment was posted? How long do you wait? What about the UI? How long does the customer wait? It seems like a messaging system like t…

> It seems like a messaging system like this would require all calling components to micro-manage...

I think that's part of the trick, actually. When every component of a system behaves in similar ways, it's easier to extract that behavior into re-usable patterns.

Rather than each component worrying about handling failure and micromanagement, that job is delegated to an another component, a supervisor or orchestrator. Supervision trees, automatic service discovery, and elastic resource managers all come to mind.

What payment systems don't send messages to communicate with the credit card company, or the eCheck service, or Venmo/PayPal/Apple pay? Websites and native apps alike have spinning graphics and loading bars, messages that say "please don't refresh the page while we do this". These systems are fundamentally asynchronous to begin with. By uniformly applying the practices you get consistency, in exchange for a higher low-bar of complexity (which you're likely to exceed anyway).

Re: Alan Kay and OO Programming

#69
Language features: it depends on what you need.

I am a huge fan of Lisp (started using professionally in 1982) and to a lessor degree Smalltalk (I wrote a nifty little NLP library for Pharo). That said, sometimes I really like the strict typing of Haskell, which I am using right now to develop a commercial product.

Smalltalk, especially with the increasing good modern Pharo system, is a great platform for some application, especially for getting close to data and flexibility in trying UI ideas.

In any case, Alan Kay has always been an inspiration to me.

Re: Alan Kay and OO Programming

#70
I always wonder what exactly did he mean. I'm not quite familiar with Smalltalk and CLOS though I have tried them. But after work with Erlang for a while made me think I'm slowly getting what he said. I found these ideas are really fascinating.

Try to think about the following pieces:

1. A bee dies, the hive won't explode. Millions of cells die every minute within you.

In Erlang, usually, processes (object) are mostly organized as a bureaucratic structure, which has supervisors letting other objects doing the actual job. If someone dies or fails, the supervisor could just kill and replace them. This really looks like biological systems or human society. Not in a world that the boss let someone do some work, then the boss and the worker along with a whole world explodes if the worker fails (99% of OOP languages exception handling are not OOPish at all, it's totally imperative instead of modeling the relation between objects).

These correspond to the biological metaphor in the talk from Alan Kay in OP's article.

2. You can find and talk to someone alive if you know his address, email or phone number.

Java has object reference but it's not transparent to other systems, there is always the 'outside world' concept in this kind of reference or pointer system, similar to ST monad in Haskell. For a normalized database, there are transparent addresses for entity records, but they are dead and cannot talk to anyone until every time you need it, you sort of revive then interact with it for a short period, then you kill it and take its guts back to the database.

In Erlang, you can register any process (object) with an address like {user,42}, any other object can talk to it if they know the address, even from other servers. Just like how URL works mentioned in Alan Kay's talk.

3. The world is concurrent.

You have approximately a thousand audiences in a room. In order to count them, you let them all stand up. You tell everyone needs to get a number '1' in their mind. Then everyone finds another person, add their '1's, one person sits down, another person remains to stand, takes the former guy's number, then repeat the process. The last person stands has the count.

Usually, you only need to count very few times to get the answer. And this is what computer science is about. The problem is, that's not the way most computer program works. Because for most programs, even if you modeled 1000 people in Java, there's still only one person doing one thing at a time. Everyone runs on a monolithic thread. If you call libraries, you are giving them the most important thing you have -- the thread. And they don't promise they will return it to you.

Contrastly, in Erlang, every process (object) must have its own resource, no one can stop other people from doing things, no one can use up all the resources. The real world is a concurrent world where everyone is an isolated individual who can do things at the same time.

Post reply on HN