<?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>dndigital.net</title>
	<atom:link href="http://dndigital.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://dndigital.net</link>
	<description>Notes on Adobe Flash, Flex, AIR Development</description>
	<lastBuildDate>Tue, 07 Sep 2010 16:02:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>HTML5 Vs Flash</title>
		<link>http://dndigital.net/2010/09/html5-vs-flash/</link>
		<comments>http://dndigital.net/2010/09/html5-vs-flash/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 13:17:18 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=279</guid>
		<description><![CDATA[Nils Millahn, Technical Director of DN Digital in Shoreditch, London, shares his views on HTML 5, the future of web design, the death (or not) of Flash and much more.  This article was taken from an interview for a local magazine that will go to print in November. Is Flash Dead? That&#8217;s the question everybody [...]]]></description>
			<content:encoded><![CDATA[<p>Nils Millahn, Technical Director of DN Digital in Shoreditch, London, shares his views on HTML 5, the future of web design, the death (or not) of Flash and much more.  This article was taken from an interview for a local magazine that will go to print in November.</p>
<p><strong>Is Flash Dead?</strong></p>
<p>That&#8217;s the question everybody is asking. As a company specialising in complex Flash and Flex applications, the death of Flash would of course be a major blow! At the centre of our industry however, the picture looks very different. The market is extremely buoyant, demand is as high as ever and good developers are hard to find.</p>
<p>So what is really going on? The surge to replace Flash is taking place under the banner of open standards but the extreme positions of various parties suggest that there are different motivations at play. Flash has been tremendously successful for over a decade and I see current events as the natural rhythm of development styles, power games and business interests.</p>
<p><span id="more-279"></span><br />
<strong>Why is HTML5 significant?</strong></p>
<p>HTML5 may not yet be ready for mass-market consumer deployment but the mobile arena is very different. On devices guaranteed to have compatible browsers, HTML5 is a life-saver. And not because it replaces Flash but because it replaces the need to develop mobile apps for different platforms. While HTML is accessible to many, Objective-C and Java are a different kettle of fish.</p>
<p>So perhaps we should be asking “Is HTML5 going to be the death of mobile apps?”. Less likely when you see who is holding the purse strings&#8230; But it is in mobile that the main focus will remain and in mobile that key developments and innovation in HTML5 will occur.</p>
<p><strong>What should I learn next?</strong></p>
<p>For individuals, it&#8217;s very straightforward: First, pick an area that you enjoy. If you create fantastic animations at night, there is no point in working in a cubicle during the daytime. Second, focus on core skills. Learn your craft. Solid foundations and a deep understanding will always be sought after and can be transferred to other industry branches very quickly.</p>
<p>For companies, my advice would sound a little different. Identify the core technologies that your business will require over the next year. Now is the time to start training your in-house team, for example in HTML5. Stay slightly ahead of the curve at all times. It keeps your staff happy but can also save you money because you&#8217;re not forced to rely on expensive freelancers due to lack of in-house skills.</p>
<p>Also bear in mind that everybody learns differently – we offer external or in-house training courses for example but also supplement that with written and video tutorials (some available for free on our blog and YouTube) and this mix of training techniques seems to work well.</p>
<p><strong>We run a range of Actionscript and HTML5 training courses:</strong></p>
<p>Our next course is:<strong><br />
</strong><br />
HTML5 &#8211; The definitive Course- 20th/21st September.</p>
<p>Book now on :  <a href="mailto:training@dndigital.net" target="_blank">training@dndigital.net</a> or<a href="http://html5-september.eventbrite.com/" target="_blank"> http://html5-september.eventbrite.com/</a></p>
<p>Price: £399 (student price £198)</p>
<p>Location: London/Shoreditch</p>
<p>Hello: 020 7749 3770</p>
<p>Who is the course for? <a href="../../training/html5/" target="_blank">http://dndigital.net/training/html5/</a></p>
<p>What can you expect?<a href="../../training/html5/" target="_blank"> http://dndigital.net/training/html5/</a></p>
<p><a href="../../training/html5/" target="_blank"></a></p>
<p><a href="../../training/html5/" target="_blank"></a></p>
<p><a href="../../training/html5/" target="_blank"></a></p>
<p>WE KNOW WHAT YOU NEED.</p>
<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } 		A:link { so-language: zxx } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } --></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/09/html5-vs-flash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brand new HTML5 video tutorial!</title>
		<link>http://dndigital.net/2010/09/brand-new-html5-video-tutorial/</link>
		<comments>http://dndigital.net/2010/09/brand-new-html5-video-tutorial/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 10:27:55 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Free Tutorials]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=268</guid>
		<description><![CDATA[Hi everyone! Check out our new video for HTML 5 at: http://www.youtube.com/watch?v=hhTQPcqLWTI You can find all our free video tutorials on our YouTube Channel. Feel free to subscribe to keep up-to-date with our future video releases! http://www.youtube.com/DNDigital Feel free to ask questions, leave comments or request further material. Enjoy!]]></description>
			<content:encoded><![CDATA[<p>Hi everyone!</p>
<p>Check out our new video for HTML 5 at: <a href="http://www.youtube.com/watch?v=hhTQPcqLWTI" target="_blank">http://www.youtube.com/watch?v=hhTQPcqLWTI</a></p>
<p>You can find all our free video tutorials on our YouTube Channel. Feel free to subscribe to keep up-to-date with our future video releases!</p>
<p><strong></strong><span style="font-size: x-small"> </span></p>
<p><strong><a href="http://www.youtube.com/DNDigital" target="_blank">http://www.youtube.com/DNDigital</a></strong></p>
<p><strong>Feel free to ask questions, leave comments or request further material.</strong></p>
<p>Enjoy!</p>
<p><span style="font-size: x-small"><strong><br />
</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/09/brand-new-html5-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>London Advanced Actionscript 3 training course feedback</title>
		<link>http://dndigital.net/2010/09/london-advanced-actionscript-3-training-course-feedback/</link>
		<comments>http://dndigital.net/2010/09/london-advanced-actionscript-3-training-course-feedback/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 09:14:48 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Training Courses]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=256</guid>
		<description><![CDATA[Hi everyone! We&#8217;ve had a really successful summer, especially with our latest Advanced Actionscript 3 (OOP and design patterns) course. Take a look at some of our feedback! “Exactly what I had hoped for! Very pleased! Really liked the teaching style and the whole team have been very helpful, Thank you!” -  S.Perry &#8221; Fantastic! [...]]]></description>
			<content:encoded><![CDATA[<p><!-- 		@page { margin: 2cm } 		P { margin-bottom: 0.21cm } -->Hi everyone!</p>
<p>We&#8217;ve had a really successful summer, especially with our latest Advanced Actionscript 3 (OOP and design patterns) course.</p>
<p>Take a look at some of our feedback!</p>
<p>“Exactly what I had hoped for! Very pleased! Really liked the teaching style and the whole team have been very helpful, Thank you!” -  S.Perry</p>
<p>&#8221; Fantastic! It was great that the course was flexible to fit our skills, experience and needs. Relaxed fun environment with open frank discussions.&#8221; &#8211; R.Oliver</p>
<p>&#8220;A very good course. I would thoroughly recommend it.&#8221; &#8211; S.Hamilton</p>
<p><strong>We would love for you to join us on our next upcoming course:</strong></p>
<p>HTML 5 &#8211; The Definitive Course 20th &amp; 21st September 2010</p>
<p>Book now on :  <a href="mailto:training@dndigital.net" target="_blank">training@dndigital.net</a> or  <a href="http://html5-september.eventbrite.com/" target="_blank">http://html5-september.eventbrite.com</a></p>
<p>Or call: 020 7749 3770</p>
<p>For everything you need to know about the course just visit:<a href="../../training/html5/" target="_blank"> http://dndigital.net/training/html5/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/09/london-advanced-actionscript-3-training-course-feedback/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DN Digital has now reached MySpace!</title>
		<link>http://dndigital.net/2010/08/dn-digital-has-now-reached-myspace/</link>
		<comments>http://dndigital.net/2010/08/dn-digital-has-now-reached-myspace/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 14:15:11 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=248</guid>
		<description><![CDATA[Hi all, Just a quick update to let you all know that we are now on MySpace. Check out our new profile at: http://www.myspace.com/547819857 Also! Make sure to keep checking our YouTube channel for more free online video tutorials! http://www.youtube.com/dndigital]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>Just a quick update to let you all know that we are now on MySpace.</p>
<p>Check out our new profile at:</p>
<p>http://www.myspace.com/547819857</p>
<p>Also! Make sure to keep checking our YouTube channel for more free online video tutorials!</p>
<p><span style="font-size: x-small"> <a href="http://www.youtube.com/dndigital" target="_blank">http://www.youtube.com/dndigital</a><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/08/dn-digital-has-now-reached-myspace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DN Digital is now on Facebook!</title>
		<link>http://dndigital.net/2010/08/dn-digital-is-now-on-facebook/</link>
		<comments>http://dndigital.net/2010/08/dn-digital-is-now-on-facebook/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 09:49:19 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=243</guid>
		<description><![CDATA[You can now find us on Facebook! Look us up and find all the latest news and updates regarding our events, training courses and online tutorials. Don&#8217;t forget! You can still find all the information you need regarding our training courses at: http://dndigital.net/training/ For all our free online tutorials just visit our YouTube Channel: http://www.youtube.com/dndigital]]></description>
			<content:encoded><![CDATA[<p><strong>You can now find us on Facebook!</strong></p>
<p>Look us up and find all the latest news and updates regarding our events, training courses and online tutorials.</p>
<p><strong>Don&#8217;t forget! </strong></p>
<p>You can still find all the information you need regarding our training courses at: <a rel="nofollow" href="../../training/" target="_blank">http://dndigital.net/training/</a></p>
<p>For all our free online tutorials just visit our YouTube Channel:<span style="font-size: x-small"><a href="http://www.youtube.com/dndigital" target="_blank"> http://www.youtube.com/dndigital</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/08/dn-digital-is-now-on-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>London Advanced Actionscript 3 (OOP and Design Patterns) training course &#8211; 25th,26th and 27th August 2010</title>
		<link>http://dndigital.net/2010/08/london-advanced-actionscript-3-oop-and-design-patterns-training-course-25th26th-and-27th-august-2010/</link>
		<comments>http://dndigital.net/2010/08/london-advanced-actionscript-3-oop-and-design-patterns-training-course-25th26th-and-27th-august-2010/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 10:36:07 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Training Courses]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=230</guid>
		<description><![CDATA[Are you comfortable working in Actionscript 3 code but want to take your programming skills to the next level? We are running our new Advanced Actionscript 3 (Object Oriented Programming and Design Patterns) on the 25th, 26th and 27th August 2010. Who is the course for? This course requires an intermediate to advanced knowledge of [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Are you comfortable working in Actionscript 3 code but want to take your programming skills to the next level?</strong></p>
<p><strong> </strong></p>
<p>We are running our new Advanced Actionscript 3 (Object Oriented Programming and Design Patterns) on the 25th, 26th and 27th August 2010.</p>
<p>Who is the course for?</p>
<p>This course requires an intermediate to advanced knowledge of  Actionscript 3. You should be comfortable writing and using your own  custom classes, working with events (eg. addEventListener,  removeEventListener, custom events) and working with the display list  (eg. addChild, Sprite).</p>
<p>Although the course is based on Flash using an external code editor, it is also  suitable for Flex developers.</p>
<p><strong>Price:</strong> £420 incl VAT (student discount available)</p>
<p>For full details of the course please visit:<a rel="nofollow" href="../../training/advanced-as3-oop-patterns/" target="_blank"> http://dndigital.net/training/advanced-as3-oop-patterns/</a></p>
<p><a rel="nofollow" href="../../training/advanced-as3-oop-patterns/" target="_blank"></a></p>
<p>Book directly at:<span style="font-size: x-small"><a href="http://advanc3-london-aug2010.eventbrite.com/" target="_blank"> http://advanc3-london-aug2010.eventbrite.com/</a> </span></p>
<p>or call us on: 020 7749 3770 or email<a href="mailto:training@dndigital.net" target="_blank"> training@dndigital.net</a></p>
<p>We hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/08/london-advanced-actionscript-3-oop-and-design-patterns-training-course-25th26th-and-27th-august-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>London HTML5 training course &#8211; 20th &amp; 21st September 2010</title>
		<link>http://dndigital.net/2010/08/html5-training-course-20-21st-september-2010/</link>
		<comments>http://dndigital.net/2010/08/html5-training-course-20-21st-september-2010/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 13:47:01 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Training Courses]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=221</guid>
		<description><![CDATA[Come and learn everything you need to know to become production-ready for HTML5! We have a new HTML5 course running on the 20th &#38; 21st September 2010. Who is the course for? The course is aimed at web designers and web developers with a good understanding of HTML and CSS. A working knowledge of Javascript [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Come and learn everything you need to know to become production-ready for HTML5!</strong></p>
<p>We have a new HTML5 course running on the 20th &amp; 21st September 2010.</p>
<p>Who is the course for?</p>
<p>The course is aimed at web designers and web developers with a good  understanding of HTML and CSS. A working knowledge of Javascript is  useful for some parts of the course but not essential.</p>
<p>Price: £399 ( Students discount £198).</p>
<p>For all the information you need regarding the HTML5 course simply visit: <a href="../../training/html5/" target="_blank">http://dndigital.net/training/html5/</a></p>
<p>Book directly on :  <a href="http://www.eventbrite.com/event/783183523?utm_source=eb_email&amp;utm_medium=email&amp;utm_campaign=new_eventv2&amp;utm_term=eventurl_text" target="_blank">http://html5-september.eventbrite.com</a> or call us on : 020 7749 3770 or <a href="mailto:training@dndigital.net" target="_blank">training@dndigital.net</a></p>
<p>We look forward to seeing you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/08/html5-training-course-20-21st-september-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quick everyone! Only a few places left for HTML5!</title>
		<link>http://dndigital.net/2010/08/quick-everyone-only-a-few-places-left-for-html5/</link>
		<comments>http://dndigital.net/2010/08/quick-everyone-only-a-few-places-left-for-html5/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 15:58:18 +0000</pubDate>
		<dc:creator>Kat</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=217</guid>
		<description><![CDATA[Just a reminder for anyone who would like to learn more about HTML5! We are running a course on the 18-19th August 2010 and only have a few places left. Only £399 ( Students discount £198) incl. VAT. Who is the course for? The course is aimed at web designers and web developers with a [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Just a reminder for anyone who would like to learn more about HTML5!</strong></p>
<p>We are running a course on the 18-19th August 2010 and only have a few places left.</p>
<p>Only £399 ( Students discount £198)  incl. VAT.<br />
Who is the course for?</p>
<p>The course is aimed at web designers and web developers with a good  understanding of HTML and CSS. A working knowledge of Javascript is  useful for some parts of the course but not essential.</p>
<p>You can find out more about the HTML5 course at: <a href="../../training/html5/" target="_blank">http://dndigital.net/training/html5/</a></p>
<p>Book directly on : <a rel="nofollow" href="../../training/puremvc-introduction/" target="_blank">http://dndigital.net/training/puremvc-introduction/</a> or call us on : 020 7749 3770 or <a href="mailto:training@dndigital.net" target="_blank">training@dndigital.net</a></p>
<p><a rel="nofollow" href="http://www.youtube.com/dndigital" target="_blank"><br />
</a></p>
<p>Don&#8217;t forget we also have free online tutorials! Just visit  <a rel="nofollow" href="http://www.youtube.com/dndigital" target="_blank">http://www.youtube.com/dndigital</a></p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/08/quick-everyone-only-a-few-places-left-for-html5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Interns Wanted! Web Design, Web Development, Actionscript Development, Marketing</title>
		<link>http://dndigital.net/2010/07/web-interns-wanted/</link>
		<comments>http://dndigital.net/2010/07/web-interns-wanted/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 11:52:04 +0000</pubDate>
		<dc:creator>Nils</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=206</guid>
		<description><![CDATA[As part of our ongoing business development strategy, we have 4 internship positions open at the moment. We&#8217;d like to hear from passionate final-year and graduate students who are keen to work on cutting-edge digital campaigns and with seriously experienced industry professionals, in our relaxed office in the heart of Shoreditch. There are four positions [...]]]></description>
			<content:encoded><![CDATA[<p>As part of our ongoing business development strategy, we have 4 internship positions open at the moment. We&#8217;d like to hear from passionate final-year and graduate students who are keen to work on cutting-edge digital campaigns and with seriously experienced industry professionals, in our relaxed office in the heart of Shoreditch.</p>
<p>There are four positions open at the moment:</p>
<ul>
<li>Front end web developer (HTML, CSS, Javascript, WordPress, etc)</li>
<li>Actionscript developers (Actionscript, Flex, backend-development experience a bonus)</li>
<li>Marketing interns (excellent written and spoken English, social-media experience, innovative marketing ideas)</li>
<li>PHP developers (good PHP5, MySQL experience)</li>
</ul>
<p>I can only really provide a brief overview here &#8211; but we&#8217;ve got <a href="http://www.enternships.com/enternships/search/c/1703" target="_blank">full details online at enternships.com</a>. Please read them there and then get in touch if you are interested.</p>
<p><strong>This just in: </strong>I&#8217;ve just been told we&#8217;re also keen to meet talented web designers, so if you&#8217;re pretty hot with Photoshop and interactive design, please get in touch with a CV and samples of work.</p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/07/web-interns-wanted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Actionscript Tutorial &#8211; The Abstract Factory Design Pattern</title>
		<link>http://dndigital.net/2010/07/advanced-actionscript-tutorial-the-abstract-factory-design-pattern/</link>
		<comments>http://dndigital.net/2010/07/advanced-actionscript-tutorial-the-abstract-factory-design-pattern/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 11:17:58 +0000</pubDate>
		<dc:creator>Nils</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Free Tutorials]]></category>

		<guid isPermaLink="false">http://dndigital.net/?p=180</guid>
		<description><![CDATA[Although it wasn&#8217;t always the case, these days a good understanding of object oriented programming principles and the use of common design patterns are essential in order to become a successful Actionscript developer. When we&#8217;re working on projects, the Head First Design Patterns book is never far away &#8211; and one of the patterns that [...]]]></description>
			<content:encoded><![CDATA[<p>Although it wasn&#8217;t always the case, these days a good understanding of object oriented programming principles and the use of common design patterns are essential in order to become a successful Actionscript developer. When we&#8217;re working on projects, the <a href="http://www.amazon.co.uk/Head-First-Design-Patterns-Freeman/dp/0596007124/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1278608410&amp;sr=8-1" target="_blank">Head First Design Patterns</a> book is never far away &#8211; and one of the patterns that has been incredibly useful time and time again is the Abstract Factory and variations thereof, so I thought we&#8217;d dedicate a YouTube tutorial to it.</p>
<p>I&#8217;d love to hear about your own experiences in regards to object oriented programming in AS3 &#8211; please leave a comment!</p>
<p>The material in this blog post and in the video is an excerpt from our <a href="http://dndigital.net/training/advanced-as3-oop-patterns/">Advanced Actionscript 3 (Object Oriented Programming and Design Patterns) training course</a>.</p>
<p>You can watch the video and read up on the details after the break.</p>
<p><span id="more-180"></span></p>
<h2>Making Choices</h2>
<p>The Abstract Factory Design Pattern is all about choice. Not any kind of choice mind you &#8211; but very specifically choosing which class to instantiate given certain conditions. Whether you realise it or not, you are probably making these choices numerous times in your own programming code. Here are some examples:</p>
<ul>
<li>Which type of menu to display based on the admin privileges of the current user</li>
<li>Which type of skin to apply to your game characters, based on the selections made at the beginning of the game &#8211; and subsequently which types of weapons are available for that character</li>
<li>Which type of button graphic to use based on the size of a banner</li>
<li>Which type of XML parser to use based on the type of feed the user has loaded in</li>
</ul>
<p>and so on. Once you&#8217;re dealing with object oriented programming, most of those choices are going to result in a class being instantiated and the trick is to choose the correct class based on a set of circumstances.</p>
<p>No problem, right? You just whack an if-statement in there:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> user.<span style="color: #006600;">isAdmin</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">menu</span> = <span style="color: #000000; font-weight: bold;">new</span> AdminMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
    <span style="color: #0066CC;">menu</span> = <span style="color: #000000; font-weight: bold;">new</span> NormalMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h2>Weeds Everywhere</h2>
<p>Of course, using if-statements will work fine, however it spreads the choices throughout your application, like a weed taking a strong-hold in your garden, then your front lawn, then your walls&#8230;you get the picture. Suppose you introduce a third user privilege level? Time to revisit all those many if-statements (of course you&#8217;ll remember where they are!). The more complex your project, the more difficult, time-consuming and error prone such a change becomes.</p>
<h2>Factory Pattern to the Rescue</h2>
<p>It is in these cases that the Factory Design Pattern comes to your rescue, by moving the choice into a single, isolated piece of code. The resulting class that is instantiated &#8211; the factory &#8211; will then provide the application with the correct class instances. As a result, you only need to change the single point-of-choice and create a new factory class in order to make wide-ranging changes to your entire application.</p>
<p>In practice, it looks something like this:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// isolated choice code (eg. after user logs in)</span>
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> user.<span style="color: #006600;">isAdmin</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    factory = <span style="color: #000000; font-weight: bold;">new</span> AdminUserFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
    factory = <span style="color: #000000; font-weight: bold;">new</span> NormalUserFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// and in the AdminUserFactory class:</span>
<span style="color: #000000; font-weight: bold;">function</span> getMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Menu</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> AdminMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// and in the NormalUserFactory class:</span>
<span style="color: #000000; font-weight: bold;">function</span> getMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Menu</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> NormalMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// much later, in a remote location in your code-tree</span>
<span style="color: #0066CC;">menu</span> = factory.<span style="color: #006600;">getMenu</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Can you see how you would add a third user level &#8211; and how much more manageable it has become compared to the previous example?</p>
<p>Let&#8217;s follow the example code through to its logical conclusion. Say we have 10 user levels. Then we&#8217;ll end up with 10 different factory classes (AdminUserFactory, NormalUserFactory, SuperUserFactory, etc). So far so good. But how does the code that is actually using the factory to retrieve the menu know how to deal with all those 10 different classes without using another if-statement? Surely that will lead to type-errors if we don&#8217;t know the exact data-type?</p>
<h2>Interfacing with the Factory</h2>
<p>In order to allow code throughout your application to use different factory classes, we&#8217;re going to use an interface to define what methods a factory class provides. This interface will be used as the data-type when passing the factory around to other pieces of code. So in practice it doesn&#8217;t matter which factory class is used behind the scenes and dependencies within your code are reduced to a single interface class, which is what we like to see!</p>
<p>Our user-menu example seems to use factory to create its user-interface elements, so let&#8217;s create an interface called IUIFactory. We start with just a single function &#8211; we can always add to it later on:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// in the IUIFactory.as file</span>
<span style="color: #0066CC;">public</span> <span style="color: #0066CC;">interface</span> IUIFactory <span style="color: #66cc66;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">function</span> getMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Menu</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<p>As a rule, you&#8217;d start with your interface first, then create your first factory class and then create your choice code &#8211; otherwise you&#8217;ll end up in a bit of a pickle.</p>
<p>Here is the sample code from earlier, with the interface thrown in.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">// we start with an interface</span>
<span style="color: #000000; font-weight: bold;">var</span> factory:IUIFactory;
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> user.<span style="color: #006600;">isAdmin</span> <span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    factory = <span style="color: #000000; font-weight: bold;">new</span> AdminUserFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #66cc66;">&#123;</span>
    factory = <span style="color: #000000; font-weight: bold;">new</span> NormalUserFactory<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// and in the AdminUserFactory class - which implements IUIFactory</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Menu</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> AdminMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// and in the NormalUserFactory class - which also implements IUIFactory</span>
<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Menu</span>
<span style="color: #66cc66;">&#123;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> NormalMenu<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// much later, in a remote location in your code-tree</span>
<span style="color: #000000; font-weight: bold;">var</span> factory:IUIFactory;
<span style="color: #0066CC;">menu</span> = factory.<span style="color: #006600;">getMenu</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre></td></tr></table></div>

<p>Splendid.</p>
<p>Another beneficial side-effect of using an interface in this way comes into play when adding new features to your factory. Any new feature requires a new method in your factory interface. That new method will immediately result in compiler errors because none of your factory classes has implemented it yet. You have no option but to implement the new method in every single factory class &#8211; hence automatically making sure that your code is properly maintained.</p>
<p>Doesn&#8217;t that sound better than finding a long-lost if-statement deep down in the murky depths of your code-tree that your colleague forgot to change when they added a new user-group?</p>
<h2>YouTube Tutorial and Source Code</h2>
<p>The YouTube tutorial steps through a different example of coding a user-interface that can change depending on the age-group of the viewer.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="640" height="385" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/spfienbiqqs&amp;hl=en_GB&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="640" height="385" src="http://www.youtube.com/v/spfienbiqqs&amp;hl=en_GB&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>You can <a title="Factory Design Pattern Source Code" href="http://dndigital.net/wp/wp-content/uploads/2010/07/dndigital-abstract-factory.zip">download the source-code as a FlashBuilder 4 project</a> so that you can follow the tutorial and experiment further. There are a couple of extra images in the assets folder so you can produce a third factory class. Copyright / licensing info is included in each file, all images used are publicly available via <a href="http://sxc.hu" target="_blank">sxc.hu</a>.</p>
<h2>Further Thoughts &#8211; Factory Pattern and Dependency Injection</h2>
<p>The Factory Design Pattern&#8217;s strengths come from isolating choices in a single location. Furthermore, each factory class also encapsulates a very simple set of actions &#8211; it knows how to create the correct instances but doesn&#8217;t require knowledge of the surrounding application to do so &#8211; so we are adhering to the  &#8217;one class &#8211; one responsibility&#8217; concept.</p>
<p>Of course you still need to pass the actual factory instance around to the classes that require them and there are various ways of managing these dependencies. In the YouTube tutorial, I simply pass the factory instance to the view classes via their constructor and this is a perfectly valid way of handling it.</p>
<p>There are of course other options &#8211; and Dependency Injection (DI) is especially helpful when working with the factory pattern.</p>
<p>Since DI hinges in principal around matching interface data-types to concrete classes, switching factory classes becomes a doddle. You simply specify the appropriate factory class to be used when the DI container encounters the factory interface and your project can be dramatically changed by essentially touching only a single line of code. This is especially true when there is a fixed, pre-determined choice of factory class, for example when repurposing an entire project for a different market or target audience.</p>
<p>I&#8217;d love to hear your own experiences of the Factory Pattern and OOP in general &#8211; leave a note in the comments below.</p>
]]></content:encoded>
			<wfw:commentRss>http://dndigital.net/2010/07/advanced-actionscript-tutorial-the-abstract-factory-design-pattern/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
