Am Dienstag, dem 06.01.2026 um 16:18 -0500 schrieb Mark Bratcher: > > On 1/6/2026 4:04 PM, Wolfgang Dann wrote: > > But why are you saying first, temperature is an attribute of an > > object, > > and then you are making it the object itself? > > For me this looks counter intuitive. > > > I didn't say Temperature is an attribute of Object. I said that the > scale used for temperature is an attribute of temperature. > > I didn't say anything about where Temperature lived. I just mentioned > deriving it from Number instead of Object. > > > But I think > > > > Object() > > temperature: number. > > temperature.Celsius?: number > > temperature.Fahrenheit?: number > > > > would be more intuitive. > > > > That way you could have myRoom: Object. > > myRoom temperature.Celsius? > > Temperature is a Number, so I made it a subclass of number. You can > make > it a subclass of Object, but it would not really serve any additiona > benefit. > > If you want a Room, then ask yourself: is temperature an attribute of > a > Room or vise versa? I believe the former. So temperature is an > attribute > of a room. It's a member. Room can be a subclass of Object and > Temperature would be an attribute, not a subclass, or room. If you > want > the temperature of the room, you'd call (using pseudo code here) > something like: myRoom.temperature.asF() or myRoom.temperature.asC(). > >
Your base of thought object hierachy is "data" whereas my base is "object". Of course you can use object programming simply as an abstraction layer for data, and this does make sense to some extend. But you can also take it as modelling reality. And in reality temerature is not an object, it is an attribute of every object. You have the temperature OF the CPU. The CPU is the object, the temperature is an attribute of it. And if you get that attribute in degrees celcius or degrees fahrenheit does not make it an object. And temperature is not a number. If you have something like the old times thermometer it is a kind of distance. For me it looks like you are turning it upside-down. regards Wolfgang
