Are Qt signals and slots a publishing-subscription form?

I donโ€™t think I saw this comparison anywhere, but will they be considered the same? If not, why not?

+6
source share
2 answers

subscription publication matches signals and slots ... check this out ...

http://en.wikipedia.org/wiki/Observer_pattern

http://doc.qt.nokia.com/qtmobility/publish-subscribe.html

+1
source

They are very similar, but there is a slight difference:

  • signals / slots implement the observer pattern, where the manufacturer has a link to his subscribers and is responsible for notifying them

  • the publication / signing paradigm is inserted by an additional intermediary, i.e. a topic handler that separates producers and consumers (manufacturers do not know who will consume messages)

The main consequence is that in the p / s paradigm, you can have several producers on the same topic.

This is (possibly) the most cited p / s article: Many publishing / subscribing people

+14
source

Source: https://habr.com/ru/post/911839/


All Articles