<?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>modules &#8211; Software, Fitness, and Gaming &#8211; Jesse Warden</title>
	<atom:link href="https://jessewarden.com/tag/modules/feed" rel="self" type="application/rss+xml" />
	<link>https://jessewarden.com</link>
	<description>Software &#124; Fitness &#124; Gaming</description>
	<lastBuildDate>Mon, 08 Jul 2013 14:40:58 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://jessewarden.com/wp-content/uploads/2016/08/cropped-Lambda2-32x32.png</url>
	<title>modules &#8211; Software, Fitness, and Gaming &#8211; Jesse Warden</title>
	<link>https://jessewarden.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Why Multiple Files Using RequireJS vs. 1 Big One</title>
		<link>https://jessewarden.com/2013/04/why-multiple-files-using-requirejs-vs-1-big-one.html</link>
		
		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Sat, 13 Apr 2013 13:53:59 +0000</pubDate>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[dependencyinjeciton]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[inversionofcontrol]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[require]]></category>
		<category><![CDATA[requirejs]]></category>
		<guid isPermaLink="false">http://jessewarden.com/?p=3530</guid>

					<description><![CDATA[A YouTube watcher of my channel regarding my Basics of Require JS Part 1 writes: &#8230; main.js is a concatenated and minified version of all the js. Just wondering why do you still need requirejs if you concatenate and minify your js in a single file [via r.js]. Is there an advantage of using requirejs [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A YouTube watcher of <a href="http://www.youtube.com/user/jesterxl">my channel</a> regarding my <a href="http://www.youtube.com/watch?v=urt81zwHDlI">Basics of Require JS Part 1</a> writes:</p>
<blockquote><p>&#8230; main.js is a concatenated and minified version of all the js.  Just wondering why do you still need requirejs if you concatenate and minify your js in a single file [via r.js].</p>
<p>Is there an advantage of using requirejs in this instance?  Or can you just straight target main.js?</p></blockquote>
<p>I&#8217;ve seen 2 clients now who put all of their JavaScript into a single, large file vs. using classes, modules, and packages; traditional computer science concepts that <a href="http://requirejs.org/">Require</a> does its best to enable in JavaScript.</p>
<p><span id="more-3530"></span>There is a development build: load a bunch of js files, sometimes on the fly.</p>
<p><b>Development vs. Production Build (or deployment)</b></p>
<p>There is a production build: a single, minified, js file, up front.</p>
<p>Production allows me to have a small file with a single http request which can possibly lead to a faster app. However, it&#8217;s next to impossible to debug. If there is a problem, I cannot set a breakpoint in the code, nor identify what line, nor what file the issue is in.</p>
<p>In development, I can (sometimes) identify what file and on what line the issue is. I can also change the variables value at runtime to test things, see their current values, and run other console statements at runtime or while the code is paused to verify. Using Chrome you an even edit the code while it&#8217;s running to test. Finally, require allows loading classes on the fly. For some mobile apps where you don&#8217;t want to load everything at once, this leads to a faster app.</p>
<p><b>Concurrent Development With a Team (also called RAD or Rapid Application Development)</b></p>
<p>Development is actually a rabbit hole of reasons, though. For example, when you are working on a team who are all working on the same code base, I can be inside of the deviceEditView.js while another developer is handling all the data in the getAffiliateCDNService.js. When we go to check into source control, it&#8217;s highly unlikely we&#8217;ll have conflicts or have to merge because they are 2 separate files. As long as you communicate, this scales pretty well for larger applications and teams.</p>
<p><b>Relevant Encapsulation and Organization</b></p>
<p>Additionally, it&#8217;s easier to find code that&#8217;s relevant. If it&#8217;s one big-ole file, it&#8217;s harder to find the function or &#8220;area of functionality&#8221; you&#8217;re looking for whereas if it&#8217;s in a class, you know that that particular class is for a specific piece of functionality. This becomes even more relevant as your application gets larger and you start to utilize packages to organize &#8220;all of your services&#8221; and &#8220;all of your models&#8221; and &#8220;all of your models that just deal with user authentication and management&#8221;.</p>
<p><b>Unit Testing and Continuos Integration via Mocks/Fixtures</b></p>
<p>Yet another example is when you&#8217;re dealing with unit testing / mocking. It&#8217;s easier to mock a use of a class vs. a whole chunk of code in a large file. For example, if you&#8217;re trying to run some unit tests against parts of your application offline (check out <a href="http://zombie.labnotes.org/">Zombie JS</a>), then you can write mocks or fixtures; basically mock services so your app &#8220;thinks&#8221; it&#8217;s hitting a Ruby on Rails back-end but in reality, it&#8217;s just making a function call to a class that returns fake data it needs after a timer of 3 seconds. You can then use require or some Dependency Injection framework to full fill those dependencies with Mocks vs. Reals. Without using classes, or separate files, it becomes challenging to do that.</p>
<p><b>Compensating for Pathetic/Non-existent Tooling</b></p>
<p>Also, the currently tooling in the market, namely Chrome, struggles to debug 13,000 lines of code or more. When they are in smaller class files of 300 lines or less, it&#8221;s more responsive. It&#8217;s also easier to tell a fellow developer &#8220;check line 102 of the DeviceItemRenderer&#8221; vs. &#8220;12,456&#8221;. </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Video: Basics of Require JS</title>
		<link>https://jessewarden.com/2012/11/video-basics-of-require-js.html</link>
					<comments>https://jessewarden.com/2012/11/video-basics-of-require-js.html#comments</comments>
		
		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Mon, 26 Nov 2012 17:21:00 +0000</pubDate>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[backbone]]></category>
		<category><![CDATA[handlebars]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[require]]></category>
		<category><![CDATA[requirejs]]></category>
		<guid isPermaLink="false">http://jessewarden.com/?p=3487</guid>

					<description><![CDATA[I&#8217;ve posted a new video, the basics of Require JS. &#160; Intro Jesse Warden Software Consultant at Web App Solution growing software firm Require JS why, what, and some examples basic, not covering optimizations/compiling for production ActionScript, java, python, ruby, C#, Lua classes packages libraries scope Why? code organization code scalability optimize code multi-developer teams [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I&#8217;ve posted a new video, the basics of <a href="http://requirejs.org/">Require JS</a>.</p>
<p><iframe src="http://www.youtube.com/embed/urt81zwHDlI" frameborder="0" width="640" height="360"></iframe></p>
<p>&nbsp;</p>
<p><span id="more-3487"></span><strong>Intro</strong></p>
<ul>
<li>Jesse Warden</li>
<li>Software Consultant at <a href="http://webappsolution.com">Web App Solution</a></li>
<li>growing software firm</li>
<li>Require JS</li>
<li>why, what, and some examples</li>
<li>basic, not covering optimizations/compiling for production</li>
<li>ActionScript, java, python, ruby, C#, Lua</li>
<li>classes</li>
<li>packages</li>
<li>libraries</li>
<li>scope</li>
</ul>
<p><strong>Why?</strong></p>
<ul>
<li>code organization</li>
<li>code scalability</li>
<li>optimize code</li>
<li>multi-developer teams</li>
<li>nested dependencies</li>
<li>ease of use vs. compilation</li>
<li>asynchronous</li>
</ul>
<p><strong>What?</strong></p>
<ul>
<li>define</li>
<li>require</li>
<li>config</li>
</ul>
<p><strong>Examples</strong></p>
<ul>
<li>unit tests</li>
<li>router example</li>
<li>handle bars example</li>
<li>typescript</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://jessewarden.com/2012/11/video-basics-of-require-js.html/feed</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>How to Use RobotLegs On Top of Gaia: Part Deux</title>
		<link>https://jessewarden.com/2010/05/how-to-use-robotlegs-on-top-of-gaia-part-deux.html</link>
					<comments>https://jessewarden.com/2010/05/how-to-use-robotlegs-on-top-of-gaia-part-deux.html#comments</comments>
		
		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Tue, 18 May 2010 19:07:26 +0000</pubDate>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Gaia]]></category>
		<category><![CDATA[modules]]></category>
		<category><![CDATA[robotlegs]]></category>
		<guid isPermaLink="false">http://jessewarden.com/?p=2196</guid>

					<description><![CDATA[Robotlegs has been released for awhile, and things have changed over the past 7 months for the better. Â A major discovery at how the Flash IDE can compile metatdata has recently come to light, so it&#8217;s time for an update to this topic which hopefullyÂ supersedesÂ both my old way of using Robotlegs in the Flash IDE, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Robotlegs has been released for awhile, and things have changed over the past 7 months for the better. Â A <a href="http://www.patrickmowrer.com/2010/03/03/compiling-custom-as3-metadata-flash-professional">major discovery</a> at how the Flash IDE can compile metatdata has recently come to light, so it&#8217;s time for an update to this topic which hopefullyÂ supersedesÂ both <a href="http://jessewarden.com/2009/10/how-to-use-robotlegs-on-top-of-gaia-part-1-of-3-quickstart.html">my old way</a> of using Robotlegs in the Flash IDE, and <a href="http://www.helmutgranda.com/2009/12/02/robotlegs-and-flash-ide-cs4-injection/">Helmut&#8217;s way</a>.</p>
<p>The following article describes what Gaia and Robotlegs are, why you would use them, and how you go about using them together.</p>
<p><span id="more-2196"></span><strong>What?</strong></p>
<p><strong><a href="http://gaiaflashframework.com/">Gaia</a></strong>: A framework for building Flash websites with built-in deep linking, modules, and code generation.</p>
<p><strong><a href="http://www.robotlegs.org/">Robotlegs</a></strong>: AÂ <a href="http://joeberkovitz.com/blog/reviewtube/">MVCS</a> framework for Flex, Flash, and pure AS3 applications.</p>
<p><strong>Why?</strong></p>
<p>Gaia is great for building websites, but it&#8217;s just a platform for you to build on, a bunch of helpful scaffolding; it doesn&#8217;t prescribe a way to build your applications. Â Specifically, you have to write your own code forÂ <a href="http://stackoverflow.com/questions/360860/what-is-domain-logic/362746#362746">Business logic and Application/Domain logic</a>. Â You still have to write code to hit back-end services, parse the returning XML/JSON/AMF, and act on that data. Â You can do this just fine for smaller websites in Gaia; Gaia doesn&#8217;t get in your way, nor prescribe how to build your site. Â However, for larger sites, it may get confusing on who does what, where that code goes, and how to work with other developers.</p>
<p>This is where an application framework like RobotLegs comes in. Â You&#8217;re domain model goes in the Model classes, your Business logic goes in the Service classes, and your Domain/Application logic goes in your Commands &amp; Mediators.</p>
<p>Examples: If a logged in User object needs to be persisted globally across pages in your site, put it on the Model. Â If you have a large amount of web services to get dynamic data from, and each is different, some requiring parameters, create Services out of them. Â If you need to do different things depending upon which user is logged in, and what permissions they have, utilize a Medaitor/Command for such code. Â Gaia can just handle the state of your application and what it looks like.</p>
<p>Gaia builds your site, and RobotLegs makes it work with dynamic data.</p>
<p>While you can utilize this combination on smaller websites, it is recommend for larger, Enterprise sites. Â Metrics include more than 12 pages each requiring dynamic data from a live middle tier, more than 10 web services, and/or a significant amount of application logic that the server doesn&#8217;t handle.</p>
<p><strong>How?</strong></p>
<ol>
<li><a href="http://www.gaiaflashframework.com/wiki/index.php?title=Getting_Started#Creating_A_Gaia_Project">Setup</a> your Gaia project.</li>
<li>Drop your <a href="http://downloads.robotlegs.org/">Robotlegs SWC</a> into the &#8220;libs&#8221; folder.</li>
<li>Check &#8220;Export SWC&#8221; under File &gt; Publish Settings.</li>
<li>Add the Robotlegs SWC to the Library Path (File &gt; Publish Settings, Flash tab, Settings Button, Library Path tab, Browse To SWC button).</li>
<li>Open Main.as and instantiate your Robotlegs Context in the overridden &#8220;onAddedToStage&#8221; before it calls super, passing it &#8220;stage&#8221; as the first and only parameter.</li>
</ol>
<pre lang="actionscript3">override protected function onAddedToStage(event:Event):void
{
	stage.align = StageAlign.TOP_LEFT;
	stage.scaleMode = StageScaleMode.NO_SCALE;
	mainContext = new MainContext(stage); // notice before super
	super.onAddedToStage(event);
}</pre>
<p>For Mediator&#8217;s, instead of a View reference, create an interface, and use a String for the class in mapMediator (more info below).</p>
<p><strong>Mediator&#8217;s</strong></p>
<p>Mediator&#8217;s are little tricky since Gaia is built on top of <a href="http://www.google.com/search?hl=en&amp;source=hp&amp;q=actionscript+module&amp;aq=f&amp;aqi=g3g-m1&amp;aql=&amp;oq=&amp;gs_rfai=">modules</a>. Â Since you don&#8217;t want to defeat the purpose of using modules in the first place, having separate SWF&#8217;s each containing unique content to save download/initialization time/memory usage, you need to utilize Robotleg&#8217;s built in support of this workflow.</p>
<p>Mediator&#8217;s can be created for Gaia Page classes, or View children of a Gaia Page class. Â Not all Gaia pagesÂ necessarilyÂ need Mediator&#8217;s, only those that wish to interact with Robotlegs.</p>
<ol>
<li>Create an interface for whatever View you wish to have a Mediator for; put the functions your Mediator needs for the View to have in the interface.</li>
<li>Have your View implement this Interface.</li>
<li>When registering your Mediator in the Context, do it like so:</li>
</ol>
<pre lang="actionscript3">mediatorMap.mapView("yourViewClass", YourMediator, IInterface);</pre>
<p>First, notice the 1st parameter, the class name, is a String instead of a strongly-typed class name. Â This ensures that your main.fla does not compile your View code into your main.swf. Â It is only downloaded, initialized, and loaded into memory once the user navigates to that page.</p>
<p>Second, notice the 3rd optional parameter is the interface you created. Â This ensure&#8217;s Robotlegs know&#8217;s what class to look for to be Mediated when the Gaia page is navigated to and your View comes onto the DisplayList, and thus create your Mediator with it&#8217;s injected View. Â This also ensure&#8217;s you can still get strong-typing while talking with your View in your Mediator.</p>
<p><strong>Conclusions</strong></p>
<p>For larger applications, I would encourage the use of Flex. Â However, for multimedia heavy sites, it&#8217;s a lot easier to utilize Gaia since it already has modules built in, they are easier to work with and unload than Flex modules, as well as all the other media centric features that Gaia comes with. Â Also keep in mind that just because you utilize Robotlegs doesn&#8217;t shield you from dependencies like Flex does via <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=modular_4.html">-load-externs</a>. Â If you have a Gaia page class that imports a class that has dependencies, that Gaia page will import them, either negating the positives that modules give you or causing your application not to work/compile.</p>
<p>When building Flash websites, it&#8217;s a given you&#8217;ll probably utilize Gaia. Â For larger sites, though, you may wish to utilize a framework to help manage the large amounts of code you&#8217;ll accrue for hitting a variety of services, as well as managing application logic (if the user is logged in, do this, else do this). Â Robotlegs is a fine choice because of it&#8217;s support for dynamic Mediators through the use of Interfaces shown above.</p>
<p>Questions about Gaia? Â <a href="http://www.gaiaflashframework.com/wiki/index.php?title=Main_Page">Documentation</a> | <a href="http://www.gaiaflashframework.com/index.php?action=forum">Forum</a></p>
<p>Questions about Robotlegs? <a href="http://knowledge.robotlegs.org/">Documentation &amp; Forum</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://jessewarden.com/2010/05/how-to-use-robotlegs-on-top-of-gaia-part-deux.html/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
