Click here to Skip to main content
15,896,912 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionis there any relation object states control and encapsulation? Pin
nig3D19-Jan-19 8:05
nig3D19-Jan-19 8:05 
AnswerRe: is there any relation object states control and encapsulation? Pin
phil.o19-Jan-19 9:41
professionalphil.o19-Jan-19 9:41 
AnswerRe: is there any relation object states control and encapsulation? Pin
CPallini19-Jan-19 10:34
mveCPallini19-Jan-19 10:34 
JokeRe: is there any relation object states control and encapsulation? Pin
Peter_in_278019-Jan-19 10:51
professionalPeter_in_278019-Jan-19 10:51 
GeneralRe: is there any relation object states control and encapsulation? Pin
nig3D20-Jan-19 4:23
nig3D20-Jan-19 4:23 
GeneralRe: is there any relation object states control and encapsulation? Pin
Peter_in_278020-Jan-19 10:49
professionalPeter_in_278020-Jan-19 10:49 
GeneralRe: is there any relation object states control and encapsulation? Pin
nig3D27-Jan-19 10:25
nig3D27-Jan-19 10:25 
AnswerRe: is there any relation object states control and encapsulation? Pin
leon de boer19-Jan-19 18:47
leon de boer19-Jan-19 18:47 
What you are dealing with is called reaction programming .. your object needs to react to things .. anything from collisions to just communicating when asked.

It's well described here along with the usual 3 ways to deal with it
Reactive programming - Wikipedia[^]

Now take care Object-oriented Reactive Programming is not Reactive Object-oriented Programming there is a big difference between those two you need to decide which you are doing and the difference between them.

From what you said I think what you are after is
Observer pattern - Wikipedia[^]
The Observer pattern addresses the following problems:

    - A one-to-many dependency between objects should be defined without making the objects tightly coupled.
    - It should be ensured that when one object changes state an open-ended number of dependent objects are updated automatically.
    - It should be possible that one object can notify an open-ended number of other objects.

Now in programmer jargon speak we call observer pattern programming as "Omnipotent god programming" because there will exist an object or function that observes and controls everything. It is often used in games programming but it is not well suited to real world situations where you can't encapsulate all options and you need to "think" about what is going on.

As an example DNS attacks on websites work because they break the observer pattern of the internet standards .. to deal with the attack you need to know past history and apply some logic Smile | :)
In vino veritas


modified 20-Jan-19 1:05am.

QuestionWhat are the programmers' opinions about Plain English Programming? Pin
Quantum Robin18-Jan-19 8:04
Quantum Robin18-Jan-19 8:04 
QuestionRe: What are the programmers' opinions about Plain English Programming? Pin
David Crow18-Jan-19 16:21
David Crow18-Jan-19 16:21 
AnswerRe: What are the programmers' opinions about Plain English Programming? Pin
leon de boer19-Jan-19 2:48
leon de boer19-Jan-19 2:48 
GeneralRe: What are the programmers' opinions about Plain English Programming? Pin
Stefan_Lang20-Jan-19 22:08
Stefan_Lang20-Jan-19 22:08 
AnswerRe: What are the programmers' opinions about Plain English Programming? Pin
Alan Balkany22-Jan-19 5:45
Alan Balkany22-Jan-19 5:45 
QuestionHow to recognize a MutliTouch Input Event ? Pin
Member 1406801918-Jan-19 3:11
Member 1406801918-Jan-19 3:11 
AnswerRe: How to recognize a MutliTouch Input Event ? Pin
Victor Nijegorodov18-Jan-19 5:14
Victor Nijegorodov18-Jan-19 5:14 
AnswerRe: How to recognize a MutliTouch Input Event ? Pin
k505418-Jan-19 5:18
mvek505418-Jan-19 5:18 
QuestionToolbar for bottom split window - CSplitterWnd Pin
Anu_Bala15-Jan-19 23:31
Anu_Bala15-Jan-19 23:31 
AnswerRe: Toolbar for bottom split window - CSplitterWnd Pin
Victor Nijegorodov15-Jan-19 23:44
Victor Nijegorodov15-Jan-19 23:44 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Anu_Bala16-Jan-19 0:09
Anu_Bala16-Jan-19 0:09 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Victor Nijegorodov16-Jan-19 1:02
Victor Nijegorodov16-Jan-19 1:02 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Anu_Bala16-Jan-19 1:39
Anu_Bala16-Jan-19 1:39 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Victor Nijegorodov16-Jan-19 3:41
Victor Nijegorodov16-Jan-19 3:41 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Anu_Bala16-Jan-19 17:26
Anu_Bala16-Jan-19 17:26 
GeneralRe: Toolbar for bottom split window - CSplitterWnd Pin
Victor Nijegorodov17-Jan-19 8:47
Victor Nijegorodov17-Jan-19 8:47 
QuestionAre there programmers that are currently using machine code and Assembly? Pin
Quantum Robin13-Jan-19 7:53
Quantum Robin13-Jan-19 7:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.