<?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>LivingMachines.net &#187; Methodology</title>
	<atom:link href="http://livingmachines.net/category/methodology/feed/" rel="self" type="application/rss+xml" />
	<link>http://livingmachines.net</link>
	<description>Test-driven development of a JavaScript MVC library, from the ground up...</description>
	<lastBuildDate>Thu, 04 Jun 2009 04:33:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Where to Begin in the MVC Triangle?</title>
		<link>http://livingmachines.net/2009/05/where-to-begin-in-the-mvc-triangle/</link>
		<comments>http://livingmachines.net/2009/05/where-to-begin-in-the-mvc-triangle/#comments</comments>
		<pubDate>Fri, 01 May 2009 19:52:34 +0000</pubDate>
		<dc:creator>Jason S. Kerchner</dc:creator>
				<category><![CDATA[Methodology]]></category>

		<guid isPermaLink="false">http://livingmachines.net/?p=369</guid>
		<description><![CDATA[Now that the JavaScript extensions are released, I have spent some time debating on where to begin with the main core of the library.  That is, the MVC portion.  I want to make sure that I have time to contribute to this blog on a regular basis (something I am struggling with already) [...]]]></description>
			<content:encoded><![CDATA[<p>Now that the <a href="/tag/javascript-extensions">JavaScript extensions</a> are released, I have spent some time debating on where to begin with the main core of the library.  That is, the MVC portion.  I want to make sure that I have time to contribute to this blog on a regular basis (something I am struggling with already) while at the same time not losing focus on my other projects.  Hence, I need to find a balance.</p>
<p>My decisions of what to blog and what code to share will be based on the needs of my current project.  Hopefully, this project will proceed in a logical, orderly manner (ha, ha, ha), and so the JavaScript library can be built at the same time and also in a logical, orderly manner (getting that dreamy look in my eyes just thinking about it).  More importantly, and perhaps more difficult, I must resist the urge to use already existing libraries which might make my project go faster.</p>
<p>Of course, in this I have already failed.  I am already using the<a href="/2009/02/test-driven-development-with-screencast/"> YUI Testing Tools</a>.  But, at least that&#8217;s only on the developer side, and not the end-user side.</p>
<p>Anyway, I finally decided that since the View is where it all starts (user input) and stops (system output) in an MVC architecture, that it would be a good place to begin.  Also, I typically develop with the user interface first, since the UI really describes how the application should function, so it makes sense to begin with the View.  With all that said, I do want to point out that my first and foremost priority is to get the &#8220;plumbing&#8221; in place.  Therefore, I&#8217;m not going to spend a whole lot of time on fancy animations and other visual icing.  And I&#8217;m sure I&#8217;ll be delving into Controllers and Models fairly quickly, since a View without them won&#8217;t really do anything useful.</p>
<h4>What is this MVC of which you speak?</h4>
<p>So, how about an MVC review before we get started, eh?  MVC stands for Model-View-Controller, and represents the holy triad of application design.</p>
<p>The Model is the representation of the real-world data that makes up the application.  The model is typically a database model, but could be any internal representation of real data.</p>
<p>The View is the visual presentation of the Model, and its the only portion of the MVC architecture that the user will interact with.  Typically, the view is associated with the computer screen, but it could be just a small section of the computer screen or some other representation of the data, such as a printout.</p>
<p>The Controller is responsible for application state.  It handles the communication between the View and the Model.  When a user makes a gesture on a View to save data, by clicking on a &#8220;Save&#8221; button for example, the Controller passes that request and the data that was submitted to the Model.  The Model then saves the data and passes the results back.</p>
<h4>The MVC rules of engagement</h4>
<p>That&#8217;s the MVC in a nutshell.  But to be more specific, here are the rules I will follow when implementing MVC in this library:</p>
<p><strong>Model Rules</strong></p>
<ol>
<li>Can read and write data directly to the underlying store (i.e. the server).</li>
<li>No interaction with the user.</li>
<li>Does not directly change the application state, but can change application data.</li>
<li>Does not listen to any events (it is told what to do, then it fires events to report results).</li>
</ol>
<p><strong>View Rules</strong></p>
<ol>
<li>No direct access to underlying data store.  Can only read data through a Model (cannot request the Model to update any data).</li>
<li>Heavy interaction with the user (user gestures are fired as events to Controllers).</li>
<li>Does not change the application state (but can change its own state, for example to show visual cues to the user).</li>
<li>Listens to events from Models (application data changes) and Controllers (application state changes).</li>
</ol>
<p><strong>Controller Rules</strong></p>
<ol>
<li>No direct access to the underlying data store.  Can read and write data through requests to a Model.</li>
<li>No interaction with the user.</li>
<li>Controls and directs all application state changes (makes requests to the Model to change application data).</li>
<li>Listens to events from Models (application data changes), Views (user gestures) and other Controllers (application state changes).</li>
</ol>
<p>Here is the short version of those same rules:</p>
<ol>
<li>A Model does NOT alter the state of the application, and does NOT interact directly with the user or format data for display.</li>
<li>A View does NOT change application data and does NOT change the state of the application.</li>
<li>A Controller does NOT change application data, and does NOT interact directly with the user or format data for display.</li>
</ol>
<p>So there you have it, the basic rules for the library.  I&#8217;ll try to post code often, even if it is incomplete, so you can see not only what I&#8217;m doing, but also why I&#8217;m doing it.  Look for the first installment next week (I recommend subscribing to the <a href="http://feeds2.feedburner.com/livingmachines">RSS feed</a>)!</p>
]]></content:encoded>
			<wfw:commentRss>http://livingmachines.net/2009/05/where-to-begin-in-the-mvc-triangle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test-driven development (with screencast)</title>
		<link>http://livingmachines.net/2009/02/test-driven-development-with-screencast/</link>
		<comments>http://livingmachines.net/2009/02/test-driven-development-with-screencast/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:43:12 +0000</pubDate>
		<dc:creator>Jason S. Kerchner</dc:creator>
				<category><![CDATA[Methodology]]></category>

		<guid isPermaLink="false">http://livingmachines.net/?p=49</guid>
		<description><![CDATA[View Screencast &#124; Download code
Before I begin posting code for this library, I just wanted to say a few words about how I develop software.  I generally follow a test-driven development (TDD) methodology when writing code.  For those not familiar with TDD, it is an automated unit testing method where you write a single [...]]]></description>
			<content:encoded><![CDATA[<p><a onclick="window.open('http://livingmachines.net/screencasts/001/viewcast.html','screencast','width=680,height=540,resizable=yes,scrollbars=no,toolbar=no,menubar=no,status=no'); return false;" href="http://livingmachines.net/2009/02/test-driven-development-with-screencast/">View Screencast</a> | <a href="http://livingmachines.net/screencasts/001/source-code.zip">Download code</a></p>
<p>Before I begin posting code for this library, I just wanted to say a few words about how I develop software.  I generally follow a <a href="http://en.wikipedia.org/wiki/Test_driven_development" target="_blank">test-driven development (TDD)</a> methodology when writing code.  For those not familiar with TDD, it is an automated unit testing method where you write a single test that describes a feature you are attempting to implement.  You then write code and run your test to verify that the feature has been implemented successfully.  As development progresses, you continually add tests for each feature that you want to implement.  Each time you retest your code, you are also regression testing previously implemented features.  And at the end of it all, assuming you have written good tests, you should have a very well unit-tested code base.</p>
<p>As a single developer, it is vitally important for me to be able to test code quickly and repeatedly without having to spend a lot of time manually testing or reviewing test outputs.  Regression testing to make sure new code hasn&#8217;t broken old code, can take a particularly long time to test.  Automated test-driven development results in a single pass or fail result, and points to the exact feature that failed.  You can go back to your code months later, add a new feature, and fully test the whole code base again.  TDD is thorough and efficient.</p>
<p>I use <a href="http://developer.yahoo.com/yui/yuitest/" target="_blank">YUI Test</a> for automated test-driven development.  Perhaps I&#8217;ll create my own testing suite at some point (as part of this new library), but that&#8217;s not a wheel I want to re-invent right now.  <a onclick="window.open('http://livingmachines.net/screencasts/001/viewcast.html','screencast','width=680,height=540,resizable=yes,scrollbars=no,toolbar=no,menubar=no,status=no');" href="#">Watch the screencast</a> to see a basic overview of how I use the YUI Test library to unit-test my code.</p>
]]></content:encoded>
			<wfw:commentRss>http://livingmachines.net/2009/02/test-driven-development-with-screencast/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome, here&#8217;s what its all about</title>
		<link>http://livingmachines.net/2009/01/welcome-heres-what-its-all-about/</link>
		<comments>http://livingmachines.net/2009/01/welcome-heres-what-its-all-about/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 00:35:44 +0000</pubDate>
		<dc:creator>Jason S. Kerchner</dc:creator>
				<category><![CDATA[Methodology]]></category>

		<guid isPermaLink="false">http://livingmachines.net/?p=3</guid>
		<description><![CDATA[Welcome.  My name is Jason Kerchner.  I’ve been developing software for nearly twenty years, with much of my focus lately on web development.  Most recently, I’ve been getting more and more involved in using JavaScript to create rich internet applications.  As these web-based applications have become more complex, I began looking into many of the [...]]]></description>
			<content:encoded><![CDATA[<p>Welcome.  My name is Jason Kerchner.  I’ve been developing software for nearly twenty years, with much of my focus lately on web development.  Most recently, I’ve been getting more and more involved in using JavaScript to create rich internet applications.  As these web-based applications have become more complex, I began looking into many of the JavaScript libraries that are out there.  And to be sure, there are quite a number of them.</p>
<p>Nevertheless, I have decide to code an entire JavaScript library online, through this blog.  This means you will see my code in all its ugliness as development progresses.  All the mistakes, all the in-line comments, all the theories and logic behind what I am doing.  Not just code snippets, not just clean releases, but the code that I am actively working on.  Most of the code will be my own, but some might be adapted from others who have made their libraries public.  Maybe I can bring some of the best implementations together in a single code base.  And where there is no good implementation (in my opinion) maybe I can create something better.</p>
<p>Do we really need another JavaScript library?  Probably not.  Most developers seem happy with what’s out there, and I’ve certainly had success using existing libraries.  Do I think it will be fun?  Yup.  Do I think it will be educational, for me and others?  Yup.  Those are the reason I’m doing this, and doing it all online.  My hope is to get a decent following, and hear the opinions and suggestions of other developers.  Hopefully we can all learn some useful programming techniques together.</p>
<p>And yes, the library will be released under an open source license.</p>
<p>So what kind of library will I be building, exactly?  Well, I see two basic types of JavaScript libraries out there right now.  The first basically uses an existing HTML page and manipulates it.  These are libraries like <a href="http://jquery.com/" target="_blank">jQuery</a> and <a href="http://www.prototypejs.org/" target="_blank">Prototype</a>.  The other kind takes a (mostly) empty page and uses JavaScript to build the HTML, something like <a href="http://www.extjs.com/" target="_blank">ExtJS</a> and <a href="http://developer.yahoo.com/yui/" target="_blank">YUI</a>.  There is, of course, overlap between these libraries, I’m just talking about the primary manner in which they are typically used.  The library I’m going to build will be more like the latter type.</p>
<p>Most of these libraries, I think, focus on rich GUI controls and fancy animations.  My focus, at least initially, will be on creating a good foundation with all the necessary plumbing to make the library work.  My intent is to create code that is minimal, efficient, and easy to work with.  The last things to be implemented will be the fancy GUI controls and DOM element animations.</p>
<p>So, stay tuned.  The first installments will be coming soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://livingmachines.net/2009/01/welcome-heres-what-its-all-about/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
