<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>programming &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>Thing to Know About PHP Arrays</title>
		<link>/2011/10/19/thing-to-know-about-php-arrays/</link>
		<comments>/2011/10/19/thing-to-know-about-php-arrays/#respond</comments>
		<pubDate>Wed, 19 Oct 2011 15:18:47 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[C programming language]]></category>
		<category><![CDATA[Comparison of programming languages]]></category>
		<category><![CDATA[Computer programming]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Data structures]]></category>
		<category><![CDATA[Data types]]></category>
		<category><![CDATA[Foreach]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[interpreter]]></category>
		<category><![CDATA[PHP arrays]]></category>
		<category><![CDATA[PHP micro tutorial]]></category>
		<category><![CDATA[php tutorial]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[webdev]]></category>

		<guid isPermaLink="false">/?p=2390</guid>
		<description><![CDATA[Consider the following case. We have an array with identical keys. $arr = array(1 => 10, 1 => 11); What happens when the interpreter reaches this line of code? This is not a syntax error and it is completely valid. Very similar, but more interesting case is when we have an array of identical keys, &#8230; <a href="/2011/10/19/thing-to-know-about-php-arrays/" class="more-link">Continue reading <span class="screen-reader-text">Thing to Know About PHP Arrays</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2010/08/31/php-what-is-more-powerful-than-list-perhaps-extract/" rel="bookmark" title="PHP: What is More Powerful Than list() &#8211; Perhaps extract()">PHP: What is More Powerful Than list() &#8211; Perhaps extract() </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
<li><a href="/2010/05/19/php-associative-arrays-coding-style/" rel="bookmark" title="PHP Associative Arrays Coding Style">PHP Associative Arrays Coding Style </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Consider the following case. We have an array with identical keys. </p>
<pre lang="PHP">
$arr = array(1 => 10, 1 => 11);
</pre>
<p>What happens when the interpreter reaches this line of code? This is not a syntax error and it is completely valid. Very similar, but more interesting case is when we have an array of identical keys, where those identical keys are represented once as an integer and then as a string.<br />
<figure id="attachment_2404" style="width: 640px" class="wp-caption aligncenter"><a href="/wp-content/uploads/2011/10/php.code_.jpg"><img src="/wp-content/uploads/2011/10/php.code_.jpg" alt="Keys in PHP arrays are not type sensitive, so pay attention when using them!" title="PHP Code" width="640" height="480" class="size-full wp-image-2404" srcset="/wp-content/uploads/2011/10/php.code_.jpg 640w, /wp-content/uploads/2011/10/php.code_-300x225.jpg 300w" sizes="(max-width: 640px) 100vw, 640px" /></a><figcaption class="wp-caption-text">Keys in PHP arrays are not type sensitive, so pay attention when using them!</figcaption></figure></p>
<pre lang="PHP">
$arr = array(1 => 10, "1" => 11);
</pre>
<p>Now several questions arise. First of all, how many elements have this array? Two or one. This can be easily verified by checking what count() will return.<span id="more-2390"></span></p>
<pre lang="PHP">
echo count($arr);
</pre>
<p>The correct answer is 1. This simply means, that there&#8217;s no difference between string keys and integer keys. What would happen if we had a &#8220;normal&#8221; array with different keys?</p>
<pre lang="PHP">
$arr = array(1 => 10, "2" => 11);
echo count($arr);
</pre>
<p>As expected this returns 2. </p>
<p>Next thing to check is what&#8217;s in the array after this initialization line.</p>
<pre lang="PHP">
$arr = array(1 => 10, "1" => 11);
</pre>
<p>Is there something in the first element $arr[0], or there&#8217;s something in the second element $arr[1]? What is the value of the single value?<br />
As it appears the second element replaces the first one. We&#8217;ve seen that the array has only one value, but where&#8217;s that value? The only way to check this is to dump both elements:</p>
<pre lang="PHP">
var_dump($arr);
</pre>
<p>Here we can see that $arr[1] contains &#8220;11&#8221; and it is the only value, and $arr[0] is not set.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2010/08/31/php-what-is-more-powerful-than-list-perhaps-extract/" rel="bookmark" title="PHP: What is More Powerful Than list() &#8211; Perhaps extract()">PHP: What is More Powerful Than list() &#8211; Perhaps extract() </a></li>
<li><a href="/2012/07/24/php-arrays-or-linked-lists/" rel="bookmark" title="PHP: Arrays or Linked Lists?">PHP: Arrays or Linked Lists? </a></li>
<li><a href="/2010/05/19/php-associative-arrays-coding-style/" rel="bookmark" title="PHP Associative Arrays Coding Style">PHP Associative Arrays Coding Style </a></li>
<li><a href="/2010/06/11/friday-algorithms-quicksort-difference-between-php-and-javascript/" rel="bookmark" title="Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript">Friday Algorithms: Quicksort &#8211; Difference Between PHP and JavaScript </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2011/10/19/thing-to-know-about-php-arrays/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How Do You Estimate Your Project?</title>
		<link>/2010/08/04/how-do-you-estimate-your-project/</link>
		<comments>/2010/08/04/how-do-you-estimate-your-project/#respond</comments>
		<pubDate>Wed, 04 Aug 2010 14:46:58 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[estimate]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">/?p=1836</guid>
		<description><![CDATA[How do you estimate your work? Do you rely on a previous similar tasks or simply by some intuition? It will be interesting to share your experience.<div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>How do you estimate your work?</p>
<p>Do you rely on a previous similar tasks or simply by some intuition? It will be interesting to share your experience.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/04/08/flash-doesnt-load-in-div-with-display-none-style/" rel="bookmark" title="Flash doesn&#8217;t load in div with display:none style">Flash doesn&#8217;t load in div with display:none style </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2010/08/04/how-do-you-estimate-your-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event driven programming with jQuery &#8211; (part 4). Simple event driven app.</title>
		<link>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/</link>
		<comments>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 07:47:58 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[event driven]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">/?p=764</guid>
		<description><![CDATA[The sample app In my last post from the event driven programming with jQuery series, I simply will post a sample application. In my previous post I showed up the use case for a tab panel, which can be done typically with no custom events, and almost every developer would do it that way, but &#8230; <a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" class="more-link">Continue reading <span class="screen-reader-text">Event driven programming with jQuery &#8211; (part 4). Simple event driven app.</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>The sample app</h2>
<p>In my last post from the event driven programming with jQuery series, I simply will post a sample application. In my previous post I showed up the use case for a tab panel, which can be done typically with no custom events, and almost every developer would do it that way, but however just for the purpose of this series I&#8217;ll separate the logic into two modules. One for the tabs and one for the content. Thus you can separate the application into two simple apps into two different pages, and they will continue to work correctly.</p>
<p>In fact most of the large JavaScript applications use that technique and I was inspired to write these posts from one <a title="Design and build scalable javascript applications" href="http://video.stoimen.com/2009/09/18/design-build-scalable-javascript-applications/" target="_blank">talk</a> of <a title="NZOnline - Nicholas Zakas" href="http://www.nczonline.net/" target="_blank">Nicholas Zakas</a>, a Yahoo! front end developer, where he uses YUI, of course. But anyway this technique can be done with everyone of the major JS libraries like jQuery.</p>
<p>You can see the <a title="Event Driven Programming with jQuery example" href="http://www.stoimen.com/event.driven.jquery/" target="_blank">demo</a> and the source here.</p>
<p>If there are any questions about it, don&#8217;t hesitate to post your questions and I&#8217;ll be glad to help.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2010/02/01/writing-a-jquery-plugin-part-2-sample-plugin/" rel="bookmark" title="Writing a jQuery plugin &#8211; (part 2). Sample plugin.">Writing a jQuery plugin &#8211; (part 2). Sample plugin. </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Event driven programming with jQuery &#8211; (part 3). What is a module?</title>
		<link>/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/</link>
		<comments>/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/#respond</comments>
		<pubDate>Thu, 22 Oct 2009 14:58:48 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[event driven]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">/?p=762</guid>
		<description><![CDATA[What is a module in one web page is may be not the correct question. Everything depends on how you understand the module. Let&#8217;s assume there is a tab panel on the page. This can be implemented simply by one UL and one DIV. In a sample app just clicking on a LI the the &#8230; <a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" class="more-link">Continue reading <span class="screen-reader-text">Event driven programming with jQuery &#8211; (part 3). What is a module?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>What is a module in one web page is may be not the correct question. Everything depends on how you understand the module. Let&#8217;s assume there is a tab panel on the page. This can be implemented simply by one UL and one DIV. In a sample app just clicking on a LI the the DIV content changes with appropriate content. Such tab panels can be seen almost on every site. See the homepage of Yahoo!. There are at least two tab panels, and to be exact every simple menu is like that, right? You click on an item and something on the page changes.</p>
<p>So a simple tab panel can be a single module and most often it is. But for this example let say the tab panel is composite of two modules. One for the UL &gt; LI tabs and one for the DIV containing the dynamically loaded content.</p>
<p>And now comes the tricky part. What these two modules do, and what they are supposed to do. In one hand the main strategy is to think about them if they must work on a separate pages. If there is one page only with the UL and another with the DIV. They must continue to work correctly.<span id="more-762"></span></p>
<p>The one and only task of the UL is to change the style of the selected, currently clicked, LI item and to say to everybody &#8220;I was clicked&#8221;.</p>
<p>In jQuery the most simple way to say that is by adding some event listeners to the UL &gt; LI part, like so:</p>
<blockquote>
<pre>$('ul &gt; li').click(function() {
   $(this).addClass('active');
   LoadTheContent()
});</pre>
</blockquote>
<p>But that&#8217;s simply not so event driven for this example. If the DIV is not on the same page this will throw an error. And in a large application this is absolutely possible. There you may have huge modules, each of which make his own things, loads his on data and just sends messages.</p>
<p>So I&#8217;m about to change a bit the above code like this:</p>
<blockquote>
<pre>$('ul &gt; li').click() {
   $(this).addClass('active');
   $(document).trigger('i-was-clicked', [idOfTheLi]);
});</pre>
</blockquote>
<p>Of course if not everything is clear up to now, don&#8217;t worry, this is only pseudo code. In my next post I&#8217;ll show the full working sample app with custom event listeners.</p>
<p>For now is OK just to mention that in jQuery there are functions like .bind and .trigger that do the work. The only developer part is to add some code like:</p>
<blockquote>
<pre>$(document).bind('tab-clicked', <em>callback</em>);
$(document).trigger('tab-clicked');</pre>
</blockquote>
<p>You can bind and trigger events from whatever DOM element you want, and they act just as if you attach a click or any mouse event.</p>
<p>To clear up things, let&#8217;s simulate the click event like so:</p>
<p>in plain jQuery:</p>
<blockquote>
<pre>$(document).click(callback);</pre>
</blockquote>
<p>That binds the click event on the document and of course it can be triggered with a simple mouse click, but to finish the example let&#8217;s say there&#8217;s a function, or AJAX call that after load triggers this callback:</p>
<blockquote>
<pre>$.ajax({
   success : function() {
       // on success simulate the document click
       $(document).trigger('click');
   }
});</pre>
</blockquote>
<p>That was all pseudo code and the real working example will be in my next post.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/07/29/cancel-bubbling-on-element-click-with-jquery/" rel="bookmark" title="cancel bubbling on element click with jQuery">cancel bubbling on element click with jQuery </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event driven programming with jQuery &#8211; (part 2). Events in jQuery.</title>
		<link>/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/</link>
		<comments>/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/#respond</comments>
		<pubDate>Wed, 21 Oct 2009 06:40:58 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[event driven]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">/?p=760</guid>
		<description><![CDATA[Well the &#8220;native&#8221; events in JavaScript are &#8216;onlick&#8217;, &#8216;onmouseover&#8217;, etc. I&#8217;m pretty sure that the term &#8216;native&#8217; is not quite descriptive. OK. However even this can be called event driven programming. The jQuery as usual simplifies the usage of this events and their handling. If you&#8217;ve some DOM with id &#8216;a&#8217;, i.e.: document.getElementById('a').onclick = func(); &#8230; <a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" class="more-link">Continue reading <span class="screen-reader-text">Event driven programming with jQuery &#8211; (part 2). Events in jQuery.</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Well the &#8220;native&#8221; events in JavaScript are &#8216;onlick&#8217;, &#8216;onmouseover&#8217;, etc. I&#8217;m pretty sure that the term &#8216;native&#8217; is not quite descriptive. OK. However even this can be called event driven programming.</p>
<p>The <a title="jQuery" href="http://jquery.com/" target="_blank">jQuery</a> as usual simplifies the usage of this events and their handling. If you&#8217;ve some DOM with id &#8216;a&#8217;, i.e.:</p>
<blockquote>
<pre>document.getElementById('a').onclick = func();</pre>
</blockquote>
<p>In jQuery this comes with no browser dependencies, like:</p>
<blockquote>
<pre>$('#a').click(func);</pre>
</blockquote>
<p>That normally means that on click of that element, with id &#8216;a&#8217;, calls the func() method.</p>
<p>The need of event driven programming with JavaScript and jQuery is because in large scale applications you don&#8217;t need only click events. You&#8217;d like to call some method to be called on array change, or on style change or whatever! Than you can start using custom events, where jQuery again helps you a lot.</p>
<p>I&#8217;ll demonstrate in my next post how this can be implemented in a short example application.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 1). What is event driven?">Event driven programming with jQuery &#8211; (part 1). What is event driven? </a></li>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Event driven programming with jQuery &#8211; (part 1). What is event driven?</title>
		<link>/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/</link>
		<comments>/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/#respond</comments>
		<pubDate>Tue, 20 Oct 2009 06:24:11 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[event driven]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">/?p=758</guid>
		<description><![CDATA[What is event driven? Actually the real power of JavaScript libraries and in particular in jQuery is the usage of custom events. There you have the full power to implement what is called event driven programming. This of course is not a must. You can simply make a small js application with no usage of &#8230; <a href="/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/" class="more-link">Continue reading <span class="screen-reader-text">Event driven programming with jQuery &#8211; (part 1). What is event driven?</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>What is event driven?</h2>
<p>Actually the real power of JavaScript libraries and in particular in jQuery is the usage of custom events. There you have the full power to implement what is called event driven programming. This of course is not a must. You can simply make a small js application with no usage of custom events at all. The problem is that in large scale js applications the development becomes really hard and difficult to maintain.</p>
<p>In fact all the major JavaScript libraries come with built in mechanisms to develop apps with custom events. And if you plan to make very large website, i.e. entirely on AJAX, whatever js library you use, you better start with making your app event driven.</p>
<p>That in very breve means that the different modules of the page must interact between themselves <strong>only by firing and listening for events</strong>. So you can fully change your page layout with no need to rewrite the code again and again. <span id="more-758"></span></p>
<h2>What is a module?</h2>
<p>Well this is kind of difficult to decide. But however you must do this segmentation in the beginning of the project, and I&#8217;ll cover it later in this series.</p>
<h2>&#8220;Native&#8221; events in JavaScript / jQuery</h2>
<p>Just to start from somewhere, let&#8217;s say that almost every JS programmer is a bit familiar with event driven programming, because of the native events, such as &#8220;onclick&#8221;, &#8220;onmouseover&#8221; etc. However this is not enough in a large scale app and I&#8217;ll demonstrate within a simple app how to implement the basics of the event driven model.</p>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/10/26/event-driven-programming-with-jquery-part-4-simple-event-driven-app/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 4). Simple event driven app.">Event driven programming with jQuery &#8211; (part 4). Simple event driven app. </a></li>
<li><a href="/2009/10/21/event-driven-programming-with-jquery-part-2-events-in-jquery/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 2). Events in jQuery.">Event driven programming with jQuery &#8211; (part 2). Events in jQuery. </a></li>
<li><a href="/2009/10/22/event-driven-programming-with-jquery-part-3-what-is-a-module/" rel="bookmark" title="Event driven programming with jQuery &#8211; (part 3). What is a module?">Event driven programming with jQuery &#8211; (part 3). What is a module? </a></li>
<li><a href="/2009/12/30/jquery-live-vs-bind-performance/" rel="bookmark" title="jQuery live() vs bind() performance">jQuery live() vs bind() performance </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/10/20/event-driven-programming-with-jquery-part-1-what-is-event-driven/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
