A question for OOP experts. - page 48

 
Artyom Trishkin:

There is a new operator. This operator allows you to create a new object at runtime.

There are arrays of pointers to objects. These arrays allow you to put a pointer to any object into them.

Pointer arrays are themselves objects.

Now think about it and answer, is it possible or not to add properties to the objects on the fly?

Read my post carefully. I immediately agreed with the possibility of adding new properties, but then recognised the pointlessness of doing so. New properties "on the fly" - does not mean updating the structure of the Object. Its hereditary relations, and therefore - the whole system will remain unchanged. Consequently, the Object will acquire a property that will be useless,because there will be no integration of that property without constructing new algorithms working with it .
 
Реter Konow:
Read my post carefully. I agreed with possibility of adding new properties right away, but then I recognized the senselessness of it. New properties "on the fly", - does not mean updating the structure of the Object. Its hereditary relations, and therefore - the whole system will remain unchanged. Consequently, the Object will acquire a property that will be useless, because there will be no integration of that property without constructing new algorithms working with it .

There is a basic property object that is endowed with an event handler. This object-property performs the primitive function of comparing its state with its previous state and keeps the result of comparison - more/lower/no change. It does this continuously during its lifetime.

Any property of any other object is that object-property. And the other object itself is the heir of the object-property.

Thus any object constantly lives by checking its state, and the state of its properties, and those in turn check the state of all its properties (if they themselves are descendants of the object-property).

Each property has a unique identifier.

Thus every object knows which property has changed.

Every object has a handler that reacts when the properties change in one direction or another. This is where the "creator" needs to specify how the object reacts to a property change.

And you want a program to "mutate" itself to where it needs to go without your involvement? Create new property change handlers by itself?

Well, here's a hint at the DNA. It doesn't just describe an object and its properties. It also encodes its behaviour. So, in essence, you need to code the behaviour of properties when certain external factors change. And start small and gradually work your way up to more complex interrelationships. Learn all about DNA, and start creating your own genetic code todescribe objects. Each object has its own strand. I'm afraid there's not enough life to surpass the Creator.
 

Once upon a time, there was a computer game that was very cool - Snake Fights. You had to program a snake, but the programming method was so weird that it wasn't obvious how it would behave. It was quite a fun entertainment.

Has anyone played it?

 
Dmitry Fedoseev:

Once upon a time, there was a computer game that was very cool - Snake Fights. You had to program a snake, but the programming method was so weird that it wasn't obvious how it would behave. It was quite a fun entertainment.

Has anyone played it?

I programmed one for Spectrum in assembler. Not exactly like that, though. At first I made cells that could interact with themselves and the external environment, and could reproduce themselves. And then I decided to make battles between two creatures - each of the two users could enter the behavioural code of their creature, and then watch as the two creatures took over the territory and each other.

It was funny.

 
Artyom Trishkin:

There is a basic property object that has an event handler. This object-property performs the primitive function of comparing its state with its previous state and stores the result of comparison - more/lower/no change. It does this continuously during its lifetime.

Any property of any other object is that object-property. And the other object itself is the heir of the object-property.

Thus any object constantly lives by checking its state, and the state of its properties, and those in turn check the state of all its properties (if they themselves are descendants of the object-property).

Each property has a unique identifier.

Thus every object knows which property has changed.

Every object has a handler that reacts when the properties change in one direction or another. This is where the "creator" needs to specify how the object reacts to a change of property.

And you want a program to "mutate" itself to where it needs to go without your involvement? Create new property change handlers by itself?

You have described adding a new variable in a block of algorithms, where a "universal" handler controls the value of the variable and what happens to it. The handler does not handle the value of the property by itself. It only performs its change"at the prompt" of the algorithms and fixes this event.

The algorithms themselves implement the idea of how exactly the properties determine the operation of the Object. A new property, is new algorithms describing new behaviour (relationship of events and parameter values) and they cannot be done "on the fly", in a standard way.

 
Artyom Trishkin:

...

Well, here's a hint at the DNA. It doesn't just describe an object and its properties. It also encodes its behaviour. So, in essence, you need to code the behaviour of properties when certain external factors change. Start small and work your way up to more complex interrelationships. Learn all about DNA, and start creating your own genetic code to describe objects . Each object has its own strand. I'm afraid there's not enough life to surpass the Creator.
You can't beat that. You can try to create a faded shadow, but it's worth it.)
 
Реter Konow:

You have described adding a new variable to a block of algorithms, where some "universal" handler controls its value and the events that happen to it. The handler does not control the value of the property itself. It only performs its change " at the prompt" of the algorithms and fixes this event.

The algorithms themselves implement the idea of how exactly the properties determine the operation of the Object. A new property, is new algorithms describing new behaviour (relationship of events and parameter values) and cannot be done "on the fly", in a standard way.

The value of a property is "controlled" by the external environment. Each property object is endowed with the ability to check that property and store the result of the check.

An entire object can see the values and states of all its properties. Including newly born properties.

But how it should react to changes in its properties is written in its genetic chain.

 
Gee, Peter's become a whole OOP guru, just like that, juggling verbose, clever twaddle in his head and on the forum. Bravo, I didn't think anything could eclipse the feeling of elation from the spinner, but it bloody well happened.
 
Vict:
Gee, Peter's become a whole OOP guru, just like that, juggling verbose, clever twaddle in his head and on the forum. Bravo, I didn't think anything could eclipse the feeling of elation from the spinner, but it bloody well happened.
Just being able to build abstract models of other people's concepts, sort them out without going into details, extrapolate and create symbioses with my own concepts. Easy.)
 
Artyom Trishkin:

The value of the property is "managed" by the external environment. Each property object has the ability to check this property and store the result of the check.

The whole object has the ability to see the values and states of all its properties. Including newly created properties.

But how it should react to changes of its properties is written in its genetic chain.

I didn't expect you to understand the structure of the Subject so well. In other words, my thoughts are parallel, although there is something I am not telling you in these matters. It's still early days.