<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Publish/Subscribe on Minko Gechev&#39;s blog</title>
		<link>https://blog.mgechev.com/tags/Publish/Subscribe/</link>
		<description>Recent content in Publish/Subscribe on Minko Gechev&#39;s blog</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Wed, 24 Apr 2013 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://blog.mgechev.com/tags/Publish/Subscribe/feed.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Why I should use publish/subscribe in JavaScript</title>
				<link>https://blog.mgechev.com/2013/04/24/why-to-use-publishsubscribe-in-javascript/</link>
				<pubDate>Wed, 24 Apr 2013 00:00:00 +0000</pubDate>
				<guid>https://blog.mgechev.com/2013/04/24/why-to-use-publishsubscribe-in-javascript/</guid>
				<description>&lt;p&gt;This post is inspired by &lt;a href=&#34;http://stackoverflow.com/questions/13512949/why-would-one-use-the-publish-subscribe-pattern-in-js-jquery/13513915#13513915&#34; target=&#34;_blank&#34;&gt;my answer at StackOverflow&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So why we should use publish/subscribe? Why it is useful? Is it making our work harder or it makes our application better?&lt;/p&gt;&#xA;&lt;p&gt;And the answer&amp;hellip;&lt;/p&gt;&#xA;&lt;p&gt;It’s all about loose coupling and single responsibility, which goes hand to hand with MV* (MVC/MVP/MVVM) patterns in JavaScript which are very modern in the last few years.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Loose_coupling&#34; target=&#34;_blank&#34;&gt;Loose coupling&lt;/a&gt; is an Object-oriented principle in which each component of the system knows it’s responsibility and don’t care about the other components (or at least tries to not care about them as much as possible). Loosing coupling is a good thing because you can easily reuse the different modules. You’re not coupled with the interfaces of other modules. Using publish/subscribe you’re only coupled with the publish/subscribe interface which is not a big deal – just two methods. So if you decide to reuse a module in different project you can just copy and paste it and it’ll probably work or at least you won’t need much effort to make it work.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
