Talks - Bruce Eckel: Rethinking Objects
This presentation revisits two core concepts of Object-Oriented programming: encapsulation and code reuse. Using a series of examples, we'll ask whether these concepts have satisfied their promises, and how functional approaches can do a better job. We'll also see that objects still have value in making library use easy.
Пікірлер: 18
Great talk, one small amendment: you don't have to inherit from a protocol for a class to be considered an implementation of it - you just have to fulfill the API! It's called structural subtyping and is kind of the whole point of Protocols (if you want interfaces by inheritance, we've had the abc module forever). This will print True: ``` from attrs import frozen from typing import Protocol, runtime_checkable @runtime_checkable # this makes a Protocol work with isinstance() class Coord(Protocol): x: int y: int @frozen class Point: x: int y: int print(isinstance(Point(1, 2), Coord)) ```
@sfermigier
Жыл бұрын
Funny that Bruce is using attrs in his talk and you are using dataclasses in yours 😂
The audio seems messed up. On my 5.1 system, Bruce is coming from the rear speakers, and on my Bluetooth speaker, it's quiet, tinny, and has distortions that sound like sloshing water. My Nest Hub Max sounds similar to the Bluetooth speaker, but without the sloshing.
@cygn
5 ай бұрын
sounds like the sound is out of phase. I.e. the left and right channels almost cancel each other out. Sounds very unpleasant. It could be fixed with some tool like audacity that allows you to switch the phase of one channel.
Fantastic talk. This and Hynek's talk on object orchestration have been the best talks of Pycon 2023 for me.
@Ca1vema
7 ай бұрын
Got a link?
@sghosh4223
7 ай бұрын
m.kzread.info/dash/bejne/nWyBtpelmaa3Z8o.html
@jamesdow21
7 ай бұрын
@@Ca1vema kzread.info/dash/bejne/nWyBtpelmaa3Z8o.htmlsi=Iqqp1GjQ4ZrYAumr
I'd be interested to hear the full version of this talk from the universe where he had 45 minutes or an hour. Or maybe there would be a better format for it. PS, I learned C++ from Bruce's book years ago, so thanks for that!
Oh no! Audio is corrupted?!
@imrepub
6 ай бұрын
looks like on mono audio output the sound is scrambled
A small nit in the part talking about immutability. The integer `_n` was not updated had nothing to do with "primitives" which don't exist in Python. That is straight from Java. It is because the integer class is already immutable and the "+=" operator is already making a copy of it.
The discussion of protocols treats them like abstract base classes, but they are not. In Python that doesn't use type hinting, protocols are simply duck-typing: you are a file-like object if you implement the public attributes that a file does. PEP 544 added protocols to type-hinting with the explicit purpose of not requiring the protocol to be used as a parent class. Instead of "nominal" subtyping, like Abstract Base Classes, this is "structural" subtyping. This confusion extends to the comparison of protocols with Rust Traits. Rust structs must be declared to support a given trait. This is nominal subtyping, unlike protocols. As I understand it, a better comparison would be with Go's interfaces. As with Python's typing.Protocol, a Go value implements an interface if it implements the methods of that interface, without needing any declaration that it implements that interface. I haven't used Go extensively, but "A Tour of Go" says "A value of interface type can hold any value that implements [the interface type's set of method signatures.]"
Wait you jump from Smalltalk directly to C++? Objective-C anyone? Java was way way more influenced by Objective-C than Smalltalk! Sun was pretty much about to adopt OpenStep when Java won out internally.
Damn this defective sound level.
Not a very satisfying talk. The history part of the talk was mildly interesting, but it didn't feel like he actually had any strong points to make when it came to reconsidering when and how to use objects.
@Blaxter
7 ай бұрын
"Those who cannot remember the past are condemned to repeat it." Something very true in software development, knowing how things have evolved is something very important
@Lexaire
2 ай бұрын
I found the talk very informative. Try watching it again. He shows examples of constructing adapters and protocol-based functions instead of class methods.