<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Mastering the Tao of Personal Computing</title>
	
	<link>http://npacemo.com/wordpress</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Tue, 06 Mar 2012 19:47:32 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/MasteringTheTaoOfPersonalComputing" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="masteringthetaoofpersonalcomputing" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><item>
		<title>Introduction to Flex Application’s Architecture - Redux</title>
		<link>http://npacemo.com/wordpress/2011/09/13/introduction-to-flex-application%e2%80%99s-architecture-redux/</link>
		<comments>http://npacemo.com/wordpress/2011/09/13/introduction-to-flex-application%e2%80%99s-architecture-redux/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 12:55:59 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Software Engineering]]></category>

		<category><![CDATA[architecture]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[frameworks]]></category>

		<category><![CDATA[introduction]]></category>

		<category><![CDATA[parsley]]></category>

		<category><![CDATA[robotlegs]]></category>

		<category><![CDATA[swiz]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=74</guid>
		<description><![CDATA[DOWNLOAD SLIDES
More than 3 years ago I wrote the following series of articles here:
Introduction to Flex Application’s Architecture - Part 1 - Cairngorm
Introduction to Flex Application’s Architecture - Part 2 - PureMVC
Introduction to Flex Application’s Architecture - Part 3 - The Gugga Approach
Even though this series still attracts a lot of interest, these posts are [...]]]></description>
			<content:encoded><![CDATA[<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;"><a rel="nofollow" href="http://npacemo.com/wordpress/wp-content/uploads/2011/09/flex-applications-architecture.pdf">DOWNLOAD SLIDES</a></span></p>
<p>More than 3 years ago I wrote the following series of articles here:</p>
<p><a href="http://npacemo.com/wordpress/2008/05/28/introduction-to-flex-applications-architecture-part-1-cairngorm/">Introduction to Flex Application’s Architecture - Part 1 - Cairngorm</a><br />
<a href="http://npacemo.com/wordpress/2008/06/08/introduction-to-flex-applications-architecture-part-2-puremvc/">Introduction to Flex Application’s Architecture - Part 2 - PureMVC</a><br />
<a href="http://npacemo.com/wordpress/2008/10/03/introduction-to-flex-applications-architecture-part-3-the-gugga-approach/">Introduction to Flex Application’s Architecture - Part 3 - The Gugga Approach</a></p>
<p>Even though this series still attracts a lot of interest, these posts are terribly outdated. A lot had happened in the last 3 years. The Flex framework changed a lot, the application frameworks have matured and my personal understandings have evolved through experience.</p>
<p>The original series has been written in time when the most popular frameworks were Cairngorm and PureMVC. Mate and Swiz we&#8217;re there but yet to be adopted and mature. The focus of my writings was to point out the deficiencies of these frameworks. It was a critique of the way these frameworks were implemented, but not a critique on the general approach. As you will see the present frameworks are using the same MVC (Model-View-Controller) pattern, but refined and matured through evolution and application in big complex real-life projects. The power of Flex is now utilized on a completely different level. While the old frameworks were good at imitating Java or technology-agnostic solutions, the modern versions have embraced a more natural to Flex approach.</p>
<p>In the old series I&#8217;ve made an attempt to demonstrate you such approach without using any of the frameworks. But in this new introduction to Flex application&#8217;s architecture I&#8217;ll try something different. No matter what you decide to use - framework or no framework at all, you need to be familiarized with the common set of problems all Flex applications have and which all modern frameworks are trying to address. </p>
<p>My slides and structure of presentation has been inspired from the Richard Lord&#8217;s outstanding presentation - <a href="http://www.richardlord.net/presentations/application-frameworks-the-good-the-bad-and-the-ugly">Application Frameworks – The Good, The Bad, and The Ugly</a></p>
<h3>Reader&#8217;s Prerequisites</h3>
<p>The content in this article requires a certain understanding of the following design patterns:</p>
<p><a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller">MVC</a><br />
<a href="http://en.wikipedia.org/wiki/Front_Controller_pattern">Front Controller</a><br />
<a href="http://en.wikipedia.org/wiki/Command_pattern">Command</a><br />
<a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer</a><br />
<a href="http://en.wikipedia.org/wiki/Inversion_of_control">Inversion of Control</a></p>
<p>If you&#8217;re not familiar with these patterns please take your time to read through them and make an attempt to understand them. Otherwise everything underneath would appear too abstract and disconnected to you.</p>
<h3>Introduction</h3>
<p>These days you have a great variety of good frameworks to choose from - Mate, Swiz, Parsley, Robotlegs, etc. You and your team can easily get lost in disputing which one to choose. This article main goals are:</p>
<p style="margin-left: 20px;">
● to reduce the discussion to a set of common problems all frameworks are trying to address in some way<br />
● to describe each of these problems and to present you the various options for solutions<br />
● to introduce some best practices which often take years and many projects for a team to figure out<br />
● to outline a general and practical approach when starting a project
</p>
<h3>The Common Problems</h3>
<p>All modern Flex frameworks are trying to address the following set of problems:</p>
<p style="margin-left: 20px;">
● dependencies management<br />
● events handling<br />
● presentation patterns
</p>
<h3>Dependencies Management</h3>
<p>Components rarely run on their own in full and complete independence. Most of the components depend on other instances of components. You need to take care of creating all needed instances and then pass the references to these components to all other components which collaborate with them. To address these problems the following patterns had emerged - Factory, Singleton and Inversion of Control.</p>
<p>In the slides I outline the following approaches:</p>
<p style="margin-left: 20px;">
● global singleton<br />
● global registry<br />
● manual declarative dependency management with MXML and IoC<br />
● IoC-container
</p>
<p>Without going into further details my recommendations would be to start with a <strong>manual declarative dependency management with MXML and IoC</strong> - while the project is still small this would allow you to start without the need to integrate a whole application framework. Also, while doing the whole dependency management by hand you&#8217;ll get some sense on the nature of this task and it would help you understand deeper the whole <strong>Inversion of Control</strong>-principle. As your project grow bigger you&#8217;ll realize that you need a more streamlined and unified approach towards dependency management. When you get there I would recommend you to use a framework that has built-in IoC-container - Swiz, Robotlegs and especially Parsley (this is my favourite). The modern trend is to express dependencies through the use of metadata tags, such as <strong>[Inject]</strong> or <strong>[Autowire]</strong>. I recommend you using these when you can.</p>
<h3>Events Handling</h3>
<p>When there&#8217;s graphical user interface there&#8217;s also events and handling of events. Events allow to decouple the UI from the controller&#8217;s logic. When it comes to dealing with events you need to answer the following questions:</p>
<h4>What kind of events should I dispatch?</h4>
<p>A rule of thumb is to break the functionality of your application into user gestures. A gesture is a unit of interaction with which the user expresses an intent to perform a functionality (e.g. click the &#8216;Delete&#8217;-button to delete an item, or it could be drag the item to the trash bin). When you break it into gestures, you can create a custom event that signifies the taken gesture. It&#8217;s not a good idea to use low-level events, such as <strong>MouseEvent.CLICK</strong>. Try to use the so called <strong>application-specific events</strong> - if it&#8217;s a click on the &#8216;Delete&#8217;-button, then create a &#8216;DeleteItem&#8217;-event. In such way the application specific event is decoupled from the current interaction that is chosen for the job - &#8216;DeleteItem&#8217; is abstract enough to be dispatched in either of the cases - click a &#8216;Delete&#8217;-button or drag-drop the item to the trash bin. Sometimes in order to translate a low-level event into an meaningful application-specific event you need to use some form of the Mediator-pattern.</p>
<h4>What dispatches these events?</h4>
<p>The frameworks usually use the following options:</p>
<p style="margin-left: 20px;">
● using a central dispatcher<br />
● using the display list
</p>
<p>My personal  recommendation is to use the display list when dispatching events. This would allow in addition to the Observer implementation to add Chain of Responsibility-capabilities.</p>
<h4>How to subscribe to the events of interest?</h4>
<p>The frameworks provide you again with a lot of choice - the usual discussion here is about pros. and cons. on using Commands or Controllers. While Commands seem pretty straight-forward, I would prefer using Controllers. With controllers I can avoid a lot of duplicating code - mostly the part where you define your dependencies. If a set of commands share the same dependencies and perform logically-close operations I would recommend using a controller annotated with <strong>[EventHandler]</strong>-metadata tags.</p>
<p>A strong reason to stick with Commands is when you want to support undo/redo functionality - in such cases it is super convenient to store the whole instance of the Command and repeat it if needed. The Command itself could serve the purposes of a Memento pattern.</p>
<h3>Presentation Patterns</h3>
<p>When it comes to implementing views and view logic, and when it comes to composing views out of other components, Flex offer you a whole spectrum of choices and options - we would refer to this spectrum as <strong>presentation patters</strong>. Different frameworks are in favor of different presentation patterns.</p>
<h4>Code Behind</h4>
<p>Historically, this is probably the oldest technique. In short the MXML uses an ActionScript-class as a base tag. Your logic goes in the AS, while the layout declaration is in the MXML. The greatest disadvantage of this approach is that you stick to a base class.</p>
<h4>Presentation Model</h4>
<p>In this case you don&#8217;t need a base class. You compose your component out of a MXML with view and a presentation model component placed in the declarations. The disadvantage of this approach is that you&#8217;ll end up with some AS code in the MXML tags. For the purists which strive to keep the MXML absolutely declarative with 0-lines of AS code the following approach has been developed.</p>
<h4>Supervising Controller &amp; Passive View</h4>
<p>In this approach the view is absolutely passive. The Supervising Controller expects someone to inject the view that needs supervision. I&#8217;m a great fan of this approach. The Spark-component model is basically the best example of this approach - the Skin is the passive view in that case and the skinnable component is the supervising controller (check out the sample given in the presentation). </p>
<h3>Outlining the Recipe (on how to build a Flex app)</h3>
<p>Recipes are good for novices. The following is a very rough outline in 6 basic steps:<br />
1. Always start with the views - complete the views and components you need.<br />
2. Then figure out all application-specific events you need.<br />
3. Dispatch these events.<br />
4. Handle these events in the Controllers.<br />
5. If you need to do any kind of remoting, I suggest you to use a mockup instead of a real server-side invocation.<br />
6. Last, integrate with the back-end services.</p>
<p>Let me know if want me to go into further detail about any of the information in this post!</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/OpPPC9gPMf0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2011/09/13/introduction-to-flex-application%e2%80%99s-architecture-redux/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What kind of a designer I would like to work with? (Attempt for a formulation, but also a question)</title>
		<link>http://npacemo.com/wordpress/2011/08/14/what-kind-of-a-designer/</link>
		<comments>http://npacemo.com/wordpress/2011/08/14/what-kind-of-a-designer/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 19:32:39 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=73</guid>
		<description><![CDATA[To me design is some sort of clarity of vision. Clarity to the extreme.  Down to the last detail. Not to be confused with cleanliness. The design  process is messy. Often chaotic and surrounded by uncertainty. But  nevertheless the presence of a clear vision is a sign of maturity. And  it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>To me design is some sort of clarity of vision. Clarity to the extreme.  Down to the last detail. Not to be confused with cleanliness. The design  process is messy. Often chaotic and surrounded by uncertainty. But  nevertheless the presence of a clear vision is a sign of maturity. And  it&#8217;s a sign of discipline. Discipline to control ones bursts of  artistism. Discipline to not miss the moment when the joyful playfulness  needs to cease and get transformed into focused production. Discipline  to not allow ones over-negative critique to dominate the design  conversation. It&#8217;s a discipline of emotion and sometimes even the  ability to self-induce yourself into certain emotions. There&#8217;s no  absolute control though.</p>
<p>To me design is to perpetually strive to turn ones actions and  creations into a signal. It&#8217;s about avoiding the noise. It&#8217;s about using  the noise on purpose. It&#8217;s about formulating and following manifestos.  It&#8217;s progressive, experimental in it&#8217;s core. It requires thought  unencumbered with fixed believes. It is a non-stop challenging of the  status quo.</p>
<p>The mind of the designer is built around sound theoretical  foundations. Some of them&#8230; Others are totally unstable. Unproved.  Designer&#8217;s mind is a work in progress. Fueled by the eagerness of  self-improvement and even more by the desire to make things better for  people&#8230; Somehow even when the designer is unreachable to the  spotlights I imagine her/him as being impressive.</p>
<p>&#8230;And being expressive. The lack of theoretical foundations means  lack of argument. To me this is a verdict for being reactive - it means  having a single choice and be oblivious for the alternatives.  It&#8217;s a  verdict for ignorance. These foundations in a way are an ability to  communicate. An ability to discuss and analyze or just consider options.  It is about forming a hypothesis, making an experiment. It&#8217;s about  getting into the feedback loop. Then update the hypothesis or formulate new ones.</p>
<p>I would avoid questioning designer&#8217;s technique. I believe this is  something the designer should grant by default. Lack of technique means  lack of practice. It&#8217;s a signal for immaturity (not to be confused with  lack of potential). It means not knowing your tools and language. It is  often a deficit in expressiveness.</p>
<p>Taste is important. Subjective prism refracting the rays of  aesthetics. Often taste is a deep understanding of the roots. Of the  sources and evolution of things. It is knowing about the rationale  behind them. All this should be intuitively sensed and recognized by the  designer.</p>
<p>To me design should be holistic. It is rarely about building a  single thing. It is about bringing it in the context of many things.  It&#8217;s about minding the context. It&#8217;s thinking about systems of things.</p>
<p>Somehow in my life and work I feel this hunger to allow being influenced by a strong designer.</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/5ZjHlawCWQc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2011/08/14/what-kind-of-a-designer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>What’s wrong with the creative community of Flash?</title>
		<link>http://npacemo.com/wordpress/2010/10/03/whats-wrong-with-the-creative-community-of-flash/</link>
		<comments>http://npacemo.com/wordpress/2010/10/03/whats-wrong-with-the-creative-community-of-flash/#comments</comments>
		<pubDate>Sun, 03 Oct 2010 15:42:03 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Software Engineering]]></category>

		<category><![CDATA[community]]></category>

		<category><![CDATA[creative]]></category>

		<category><![CDATA[flash]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=70</guid>
		<description><![CDATA[The Flash community is very diverse - it is a mixture of designers (UI/UX/IA), solid software engineers, artists, technology enthusiasts and a great number of individuals applying multi-discipline skills on various levels of fluency. It&#8217;s been a vibrant, extremely creative community that drove most of the innovation of the UI/UX for the web. For the [...]]]></description>
			<content:encoded><![CDATA[<p>The Flash community is very diverse - it is a mixture of designers (UI/UX/IA), solid software engineers, artists, technology enthusiasts and a great number of individuals applying multi-discipline skills on various levels of fluency. It&#8217;s been a vibrant, extremely creative community that drove most of the innovation of the UI/UX for the web. For the last 15 years Flash grew from just an animation tool to a fully-fledged enterprise application platform, but <strong>unfortunately the majority of Flash users could not grasp the meaning and implications of such a shift</strong>. Because it is not just shift in technology, but rather shift in the attitude - of what kind of products can be built-on Flash, of what kind of scale and complexity can be tackled with it, and probably most importantly what kind of professionalism is required to built software products of this completely different magnitude.</p>
<p><img style="margin: 0 0 0 0;" title="what-is-wrong" src="http://npacemo.com/wordpress/wp-content/uploads/2010/10/what-is-wrong-500x225.png" alt="What's wrong with the creative community of Flash?" width="500" height="225" /></p>
<p>It is clear that still the majority of Flash users are the creative community. This community can be characterized mostly with its tendency to focus on what&#8217;s getting build and giving little or no attention at all on how it is getting build. And I believe this is how it should be - designers should stick to design work and concentrate on the vision for the software product, while engineers should worry how the vision is going to be implemented. Sadly, this division of labor keeps being denied by the creative community as it continues to produce &#8220;awesome coolness&#8221; with suspicious engineering qualities.</p>
<p>To make such technological shift to work Adobe aimed at attracting more and more software engineers to the Flash community, but it appears it was at the cost of blocking non-programmers from building the things that used to be build easily from people with no computer science background. There&#8217;s an ongoing effort of bridging this gap between designers and developers, but while this hasn&#8217;t happened yet as my friend-designer <a href="http://fabianvercuiel.com/">Fabian Vercuiel</a> has wisely put it: &#8220;It leaves the members of the creative community in some sort of an <strong>identity crisis</strong>&#8220;.</p>
<p>People start asking: <strong><em>&#8220;What am I? Am I a designer or a programmer?&#8221;</em></strong>, and it&#8217;s a common thing to see one-guy-do-it-all in a Flash software project and running into bios similar to: <strong><em>&#8220;Artist, Designer and Technologist&#8221;</em></strong>.</p>
<p>This is a huge problem and I&#8217;ll tell you why!</p>
<p>In the past the one-guy-do-it-all approach worked well, because the projects were predominantly small, didn&#8217;t expect extensions and didn&#8217;t require long-term maintenance. So it was affordable not to pay attention on how they&#8217;re getting built - quick &amp; dirty cowboy programming delivered fast results and clients were happy.</p>
<p>With time projects grew in size and complexity, but the attitude towards building stuff stayed the same - things are still getting built with no respect to the underlying software architecture and with total ignorance for the need to put some extra effort to maintain the cleanliness of the code.</p>
<p>Creative technologists continue to undertake projects they could not handle properly - as the &#8220;awesome coolness&#8221; get bigger and bigger in extremely short periods of time this might amaze the client for a short while with its astonishing productivity until it reaches that certain moment where the creative technologist could not proceed further - simply because what&#8217;s being build even though impressive with its UI/UX is nothing but a mess. After reaching this point the client comes to the realization that the project is going nowhere and the total cost of owning a mess is zero productivity. If smart enough the client goes to the software engineers and hands off the work to them. And here comes the ugly part&#8230;</p>
<p>The software engineers are in a position in which they have to convince the client that the only way to proceed further is by doing a complete rework. But the rework usually takes at least twice the time spent by the creative technologist. From the client&#8217;s perspective this is unacceptable - it&#8217;s because the product has already been demoed in some level of completeness and because it is a work the client already payed for. Even if the software engineers manage to convince the client to rework, inevitably their productivity is going to be compared to the productivity demonstrated by the creative technologist. All this is unfavorable for both the client and the software team and it brings immense stress to such projects.</p>
<p>I see an easy resolution that will avoid such situations to happen and it is based on <strong>simple honesty. </strong></p>
<p>As a creative technologist you are obliged to inform your clients that:</p>
<p style="font-size: 10px; font-family: Courier; border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block;">You have a low level of proficiency in the software engineering craft, unless you&#8217;re really a professional software engineer.</p>
<p style="font-size: 10px; font-family: Courier; border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block;">You&#8217;ll produce a beautiful demo that will eventually need a major rework, unless you&#8217;re really a professional software engineer. Software engineers refer to such beautiful demos with the term throwaway prototype denoting that this is a conscious decision to produce something quick &amp; dirty in order to reduce various risks for the project - either design-related or technology-related risks before proceeding with the production of the actual solution.</p>
<p>To all creative technologists that want to move to the next level of their software engineering proficiency I&#8217;m recommending them to get educated on the following subjects:</p>
<p style="font-size: 12px; margin: 14px; padding: 5px 10px; display: block;"><strong>Design Patterns and OOP in general</strong><br />
A classic book on the topic is<a href="http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612"> Design Patterns: Elements of Reusable Object-Oriented Software by Erich Gamma, Richard Helm, Ralph Johnson and John M. Vlissides</a></p>
<p style="font-size: 12px; margin: 14px; padding: 5px 10px; display: block;"><strong>Software Architecture in general</strong><br />
A classic book on the topic is <a href="http://books.google.com/books?id=mdiIu8Kk1WMC&#038;printsec=frontcover&#038;dq=Software+Architecture&#038;source=bl&#038;ots=UbR2O4igSM&#038;sig=ZfdVllYABDiZIzvvMd3l-prl4iM&#038;hl=en&#038;ei=-JmoTMecPNO4jAfS3rjyDA&#038;sa=X&#038;oi=book_result&#038;ct=result&#038;resnum=9&#038;ved=0CEgQ6AEwCA#v=onepage&#038;q&#038;f=false">Software architecture in practice by Len Bass, Paul Clements, Rick Kazman</a></p>
<p style="font-size: 12px; margin: 14px; padding: 5px 10px; display: block;"><strong>Writing clean code</strong><br />
I especially recommend Uncle Bob&#8217;s book <a href="http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882">Clean Code: A Handbook of Agile Software Craftsmanship</a></p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/bFGY7L6vakE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2010/10/03/whats-wrong-with-the-creative-community-of-flash/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex 3 Animated Scrolling (a.k.a. Smooth Scroll)</title>
		<link>http://npacemo.com/wordpress/2009/10/24/flex-3-animated-scrolling-aka-smooth-scroll/</link>
		<comments>http://npacemo.com/wordpress/2009/10/24/flex-3-animated-scrolling-aka-smooth-scroll/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 09:16:04 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Animated]]></category>

		<category><![CDATA[Easing]]></category>

		<category><![CDATA[Flex 3]]></category>

		<category><![CDATA[ScrollBar]]></category>

		<category><![CDATA[Smooth]]></category>

		<category><![CDATA[Tween]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=69</guid>
		<description><![CDATA[Almost year and a half ago I&#8217;ve wrote an article about making a pretty custom scroll-bar with a Fixed Sized Scroll-Thumb - a task known in the community as a designer scroll-bar. Both blog posts proved to be useful, but just recently I received an email from this very cool guy Dino from Canada with [...]]]></description>
			<content:encoded><![CDATA[<p>Almost year and a half ago I&#8217;ve wrote an article about making a pretty custom scroll-bar with a <a href="http://npacemo.com/wordpress/2008/05/20/flex-3-designer-scrollbar-fixed-size-scrollthumb/">Fixed Sized Scroll-Thumb</a> - a task known in the community as a <a href="http://www.gskinner.com/blog/archives/2008/05/designer_scroll.html">designer scroll-bar.</a> Both blog posts proved to be useful, but just recently I received an email from this very cool guy Dino from Canada with the following question.</p>
<p><i><strong>Dino wrote:</strong></i><br />
<span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace; font-style: italic;">I was also wondering how would I go about adding easing to the scrolling of a VBox? I don’t think there is an out-of-box solution such as an Accordion having a style property openEasingFunction that allows you to specify easing but I could be wrong. Does this require customization of the Container class? I was looking at Container.scrollChildren() and other methods in the Container class to determine if I could override any behaviour.</span></p>
<p>Somehow his email coincided with a scroll-related task I had recently. I had to use a scroll-bar which is situated on a pretty custom position and it was strolling columns of content with a snapping effect. So, how would I approach the problem with the animated scroll-bar? </p>
<h3>The Solution</h3>
<p>Going for extending the Container or some of the others Flex containers is a hairy and let&#8217;s say adventurous direction to proceed with. And I believe the solution won&#8217;t be much flexible. What would you do if you need to place the scroll-bar on a more peculiar place (e.g. on the left or the top side of the container sizes or event somewhere else outside the scrolled container)?</p>
<p>The solution is to detach the scroll-bar from the container, so we can use an outside scroll-bar. The following code fragment shows you how to achieve this: </p>
<pre class="prettyprint" style="font-size: 12px; overflow: auto;">
&lt;!-- 1. Place the View that needs scrolling into a Canvas which represents the visible area
     which can't be exceeded by the View.
     !!!IMPORTANT!!! Disable the scrolling of the Canvas, so we can use a detached scroller,
     which we can place wherever we want (e.g. on the left or top sides of the Canvas) --&gt;
&lt;mx:Canvas id="viewContainer"
    width="{largerView.width}" height="500"
    verticalScrollPolicy="off" horizontalScrollPolicy="off"
    borderColor="black" borderStyle="solid"&gt;
    &lt;view:ViewThatNeedsScroll id="largerView"/&gt; &lt;!-- THIS IS THE VIEW --&gt;
&lt;/mx:Canvas&gt;

&lt;!-- 2. Create a Canvas with fictive content - this is the actual detatched scroll-bar.
     Make sure the dimensions of this Canvas are corresponding to the size of the visible
     area specified by the View-container. Also make sure the fictive content has dimensions
     corresponding to the the dimensions of the View.
     Use data binding to set the corresponding dimensions! --&gt;
&lt;mx:Canvas id="scrollerContainer"
    x="{viewContainer.x - scrollerContainer.width}"
    y="{viewContainer.y}"
    width="40" height="{viewContainer.height}"&gt;
    &lt;mx:Canvas width="1" height="{largerView.height}"/&gt; &lt;!-- THIS IS FAKE CONTENT --&gt;
&lt;/mx:Canvas&gt;
</pre>
<p/>
<h3>The Simplest Way to Attach the Scroll-Bar to the View</h3>
<p>Before trying to add a tween and an easing to the scrolling motion, I&#8217;ll show you the most simplest solution for attaching this outer scroll-bar to the View that needs to be scrolled:</p>
<pre class="prettyprint" style="font-size: 12px; overflow: auto;">
&lt;!-- 3. Use Data Binding to attach the scroller to the View: --&gt;
&lt;mx:Binding source="scrollerContainer.verticalScrollPosition"
    destination="viewContainer.verticalScrollPosition"/&gt;
</pre>
<p/>
<p>Here&#8217;s the working sample (<strong>view source</strong> is enabled):</p>
<div style="margin: 20px 0 20px 0; width: 500px; height: 200px;">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="DetachedScroller" width="500" height="200" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://npacemo.com/sample-applications/bin-detached-scroller/SmoothScroller.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://npacemo.com/sample-applications/bin-detached-scroller/SmoothScroller.swf" quality="high" bgcolor="#000000" width="500" height="200" name="DetachedScroller" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>
</div>
<h3>Animating the Scrolling</h3>
<p>I&#8217;ve implemented a simple controller component which animates the scrolling movement. You can adjust various properties of the <strong>ScrollerController</strong>, such as:</p>
<p style="margin-left: 20px;">
    ● interaction delay<br />
    ● easing function<br />
    ● max duration of the tween<br />
    ● etc.
</p>
<p>I&#8217;m not going to look at the controller&#8217;s implementation in details. Feel free to ask me any questions in the comments section.</p>
<p>Here&#8217;s the working sample (<strong>view source</strong> is enabled):</p>
<div style="margin: 20px 0 20px 0; width: 500px; height: 300px;">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="DetachedScroller" width="500" height="200" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://npacemo.com/sample-applications/bin-animated-scroller/SmoothScroller.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://npacemo.com/sample-applications/bin-animated-scroller/SmoothScroller.swf" quality="high" bgcolor="#000000" width="500" height="300" name="DetachedScroller" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>
</div>
<p><strong>Tell me what do you think of my solution? How would you solve this problem?</strong></p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/Y7kjtfwJB0Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/10/24/flex-3-animated-scrolling-aka-smooth-scroll/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flash Smoothing Issue</title>
		<link>http://npacemo.com/wordpress/2009/07/31/flash-smoothing-issue/</link>
		<comments>http://npacemo.com/wordpress/2009/07/31/flash-smoothing-issue/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 11:21:04 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Bitmap]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[issue]]></category>

		<category><![CDATA[smoothing]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=68</guid>
		<description><![CDATA[Smoothing in Flash won&#8217;t work with every image. This is a bit of an old discovery, but yesterday I ran again into this issue and I had the luck to recall what was the reason for it, and decided to document it in my blog in case I run again into this issue. 
Almost two [...]]]></description>
			<content:encoded><![CDATA[<p>Smoothing in Flash won&#8217;t work with every image. This is a bit of an old discovery, but yesterday I ran again into this issue and I had the luck to recall what was the reason for it, and decided to document it in my blog in case I run again into this issue. </p>
<p>Almost two years ago my colleague Barni and I literally spent half a day in finding what causes this behavior. We&#8217;ve tried everything - drawing the loaded bitmap into a new <strong>BitmapData</strong>-object with the <strong>smoothing</strong> argument set to <strong>true</strong>, but with no luck. And then it suddenly struck us - it was the image dimensions. Images that have an odd dimension(s) fail to be smoothed. Check the sample app beneath - choose a different image from the combo and observe whether the smoothing works for it:</p>
<div style="margin: 20px 0 20px 0; width: 500px; height: 350px;">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="SmoothingIssue" width="500" height="350" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://npacemo.com/sample-applications/bin-release-smoothing-not-fixed/SmoothingIssue.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://npacemo.com/sample-applications/bin-release-smoothing-not-fixed/SmoothingIssue.swf" quality="high" bgcolor="#000000" width="500" height="350" name="SmoothingIsssue" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>
</div>
<h3>The Solution</h3>
<p>The solution is to create a new BitmapData-object that is always with even dimensions.</p>
<pre class="prettyprint" style="font-size: 12px; overflow: auto;">
var smoothBitmapData : BitmapData = new BitmapData(
    loadedBitmap.width + (loadedBitmap.width % 2),
    loadedBitmap.height + (loadedBitmap.height % 2),
    true, 0x00FF0000);
smoothBitmapData.draw(
    loadedBitmap, null, null, null, null, true);

smoothBitmap = new Bitmap(
    smoothBitmapData, PixelSnapping.NEVER, true);
</pre>
<p/>
This is how it looks with the fix:</p>
<div style="margin: 20px 0 20px 0; width: 500px; height: 350px;">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="SmoothingIssue" width="500" height="350" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://npacemo.com/sample-applications/bin-release-smoothing-fixed/SmoothingIssue.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="allowScriptAccess" value="sameDomain" /><embed src="http://npacemo.com/sample-applications/bin-release-smoothing-fixed/SmoothingIssue.swf" quality="high" bgcolor="#000000" width="500" height="350" name="SmoothingIsssue" align="middle" play="true" loop="false" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object>
</div>
<p><a href="http://npacemo.com/sample-applications/bin-release-smoothing-fixed/srcview/index.html">VIEW SOURCE</a></p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/TbaiPXmBqlE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/07/31/flash-smoothing-issue/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Do the Evolution!</title>
		<link>http://npacemo.com/wordpress/2009/07/15/do-the-evolution/</link>
		<comments>http://npacemo.com/wordpress/2009/07/15/do-the-evolution/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 14:58:30 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Personal Computing]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[cryptography]]></category>

		<category><![CDATA[evolution]]></category>

		<category><![CDATA[genetic algorithm]]></category>

		<category><![CDATA[perl]]></category>

		<category><![CDATA[simple substitution]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=67</guid>
		<description><![CDATA[DOWNLOAD THE CODE (WRITTEN IN PERL)
Well, that&#8217;s an oldie! During the Cryptography course in the university (4 years and a half ago) I had an assignment to decipher a simple substitution cipher. Deciphering such ciphers is really straight-forward, but the extravagant part of me decided, that I&#8217;m too special to go with the straight way, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://openfmi.net/snippet/detail.php?type=snippet&#038;id=25">DOWNLOAD THE CODE (WRITTEN IN PERL)</a></p>
<p>Well, that&#8217;s an oldie! During the Cryptography course in the university (4 years and a half ago) I had an assignment to decipher a simple substitution cipher. Deciphering such ciphers is really straight-forward, but the extravagant part of me decided, that I&#8217;m too special to go with the straight way, so I&#8217;ve decided to try an alternative approach. Inspired from the Soft Computing course I attended the previous term, I was determined to experiment with a genetic algorithm and to play God with the small world of 20 populations with 20 individuals each possessing a unique DNA.</p>
<h3>My Conclusion</h3>
<p><strong>Well, does the evolution work or what?</strong> No matter how many times I&#8217;ve ran the evolution, it ended producing individuals which doesn&#8217;t look much like English - I had no luck with an exact match. Nevertheless the individuals bred by the process helped me a lot to recognize the English sentence that was in the cipher.</p>
<h3>The Source Code</h3>
<p>My implementation is in Perl - this language seemed most suitable for the task.</p>
<p>This is a slightly modified implementation of the genetics algorithm, described in <a href="http://www.cs.rochester.edu/u/brown/Crypto/studprojs/SubstGen.pdf">&#8220;Solving Substitution Ciphers with Genetics Algorithm&#8221; by Joe Gester</a>. A corpus of English text should be supplied - in this sample I pasted in the <i>corpus.txt</i> file <a href="http://eserver.org/fiction/innocence/secretgarden.html">&#8220;The Secret Garden&#8221; by G.K. Chesterton</a>.</p>
<pre class="prettyprint" style="font-size: 12px; overflow: auto;">
#########################################################################
# Solving Substitution Ciphers with Genetics Algorithm!			#
# 	(c) Vladimir Tsvetkov, 2005					#
# 	For selfsatisfaction only!					#
#########################################################################

#!/usr/bin/perl

use warnings;
use strict;

###############################################################################
# cypher text that is about to be cracked:
my $cypher_text = "BTKIB" . "OKIBR" . "BAARJ" . "ZGBON" . "QBBSH" . "OZIBM"
		. "BAAGB" . "ONZAH" . "RANMH" . "OZIBI" . "JQSAB" . "WKNHM"
		. "KTLBJ" . "ZZIBR" . "BWKQH" . "RWKHA" . "HHPJU" . "HVKIB"
		. "OJWQK" . "HRHWQ" . "BORIJ" . "KRJZX" . "HTWXK" . "HIJSS"
		. "BWWBC" . "K";

###############################################################################
# almost randomly chosen corpus in English:
# use this to calculate the digram and trigram frequency tables:
my $corpus = "";

###############################################################################
# capitalize all letters in the corpus, remove spaces, numbers and punctuation:
sub prepare_corpus {
	open (CORPUSFILE, '<', "corpus.txt")
		or die "Can't open file! $!";
	my @contents = <CORPUSFILE>;
	close (CORPUSFILE);
	foreach my $paragraph (@contents) {
		$corpus .= $paragraph;
	}
	$corpus =~ tr/a-z/A-Z/;	# capitalize
	$corpus =~ s/\s//g;	# remove spaces
	$corpus =~ s/\W//g;	# remove punctuation and other symbols
	$corpus =~ s/\d//g;	# remove digits
}

prepare_corpus ();

###############################################################################
# alphabeth we use:
my $alphabeth = &#8220;ABCDEFGHIJKLMNOPQRSTUVWXYZ&#8221;;

###############################################################################
# letters distribution for the alphabeth we use (in %):
# if you are using another alphabet, you should change this table!
my %letter_distribution_table = (
	&#8216;E&#8217; => 12.31,	 &#8216;L&#8217; => 4.03, 	&#8216;B&#8217; => 1.62,
	&#8216;T&#8217; => 9.59,	 &#8216;D&#8217; => 3.65, 	&#8216;G&#8217; => 1.61,
	&#8216;A&#8217; => 8.05,	 &#8216;C&#8217; => 3.20, 	&#8216;V&#8217; => 0.93,
	&#8216;O&#8217; => 7.94,	 &#8216;U&#8217; => 3.10, 	&#8216;K&#8217; => 0.52,
	&#8216;N&#8217; => 7.19,	 &#8216;P&#8217; => 2.29, 	&#8216;Q&#8217; => 0.20,
	&#8216;I&#8217; => 7.18,	 &#8216;F&#8217; => 2.28, 	&#8216;X&#8217; => 0.20,
	&#8216;S&#8217; => 6.59,	 &#8216;M&#8217; => 2.25, 	&#8216;J&#8217; => 0.10,
	&#8216;R&#8217; => 6.03,	 &#8216;W&#8217; => 2.03, 	&#8216;Z&#8217; => 0.09,
	&#8216;H&#8217; => 5.14,	 &#8216;Y&#8217; => 1.88
);

###############################################################################
# digram frequency table:
my %digram_frequency_table = ();

# this will populate the %digram_frequency_table:
sub calculate_digram_frequency_table {
	my $i = 1;
	foreach my $letter (split (//, $corpus)) {
		last if ($i == length $corpus);
		my $digram = $letter . substr ($corpus, $i, 1);
		$i ++;
		if (defined $digram_frequency_table{$digram}) {
			$digram_frequency_table{$digram} ++;
		} else {
			$digram_frequency_table{$digram} = 1;
		}
	}
}

calculate_digram_frequency_table ();

###############################################################################
# trigram frequency table:
my %trigram_frequency_table = ();

# this will populate the %trigram_frequency_table:
sub calculate_trigram_frequency_table {
	my $i = 1;
	foreach my $letter (split (//, $corpus)) {
		last if ($i == (length $corpus) - 1);
		my $trigram = $letter . substr ($corpus, $i, 2);
		$i ++;
		if (defined $trigram_frequency_table{$trigram}) {
			$trigram_frequency_table{$trigram} ++;
		} else {
			$trigram_frequency_table{$trigram} = 1;
		}
	}
}

calculate_trigram_frequency_table ();

###############################################################################
# implementing the crossover between individuals:
# as long as less than half of the key is swapped at any one time, at least
# the good information from one parent remains in the child and likely the
# majority of the good information from the other parent also remains
# Example:
# father - A (B  C  D) E  F
# mother - B  D  F  E  C  A
# the crossover takes the next 3 steps:
# 1. tr/BD/DB/
# 2. tr/CF/FC/
# 3. tr/DE/ED/
# child  - E  B  C  D  F  A
sub crossover {
	my ($father, $mother) = @_;
	my $letters_count = length $alphabeth;
	my $crossover_fragment_length = 12;
	my $fragment_offset =
		int (rand ($letters_count - $crossover_fragment_length + 1));

	my $child = $mother;
	my $father_fragment = substr ($father,
				$fragment_offset,
				$crossover_fragment_length);

	my $mother_fragment = substr ($mother,
				$fragment_offset,
				$crossover_fragment_length);

	# swap the randomly chosen fragments:
	my $i = 0;
	foreach my $father_letter (split (//, $father_fragment)) {
		my $mother_letter = substr ($mother_fragment, $i, 1);
		$i ++;
		my $digram_left = $father_letter . $mother_letter;
		my $digram_right = $mother_letter . $father_letter;
		$_ = $child;
		eval &#8220;tr/$digram_left/$digram_right/&#8221;;
		$child = $_;
	}

	return $child;
}

###############################################################################
# implementing the fitness function for a given individual:
# To apply the fitness function to an individual, the cipher-text is decrypted
# using the individual’s gene as it’s key. Then every trigram and digram in
# the decrypted text is looked up in the table of how many times it occurs
# in the corpus. These numbers are then summed. Thus, trigrams and bigrams
# that occur commonly in the corpus are more heavily rewarded than those
# that do not.
sub fitness {
	my ($individual) = @_;
	my $permutated_alphabeth = $individual;
	my $plain_text = $cypher_text;

	# decrypt, using the given individual:
	$_ = $plain_text;
	eval &#8220;tr/$permutated_alphabeth/$alphabeth/&#8221;;
	$plain_text = $_;

	# calculate the fitness function of the decrypted text:
	my $fitness = 0;
	my $i = 1;
	foreach my $letter (split (//, $plain_text)) {
		unless ($i == length $plain_text) {
			my $next_letter = substr ($plain_text, $i, 1);
			my $digram = $letter . $next_letter;
			$fitness += $digram_frequency_table{$digram}
				if (defined $digram_frequency_table{$digram});
			unless ($i == (length $corpus) - 1) {
				my $next_two_letters = substr ($plain_text, $i, 2);
				my $trigram = $letter . $next_two_letters;
				$fitness += $trigram_frequency_table{$trigram}
					if (defined $trigram_frequency_table{$trigram});
			} else {
				$i ++;
				next;
			}
		} else {
			last;
		}
		$i ++;
	}

	return $fitness;
}

###############################################################################
# implementing mutation:
# This is implemented as a swap between probable neighbors based on the
# single letter frequencies of English. That is, the character ’e’ might
# be swapped with ’t’ but not with ’v’ or ’x’.
# In this case the random swap occurs only for the first 9 most frequent
# letters, based on the %letter_distribution_table.
sub mutation {
	my ($individual) = @_;
	my $mutated_individual = $individual;
	my $letters_count = 9;
	my $letter_position1 = int (rand ($letters_count));
	my $letter_position2 = int (rand ($letters_count));
	return $mutated_individual if ($letter_position1 == $letter_position2);
	my @letters_sorted_by_distribution =
		reverse
			sort  { $letter_distribution_table{$a} <=>
				$letter_distribution_table{$b} }
				keys %letter_distribution_table;
	my $letter1 = $letters_sorted_by_distribution[$letter_position1];
	my $letter2 = $letters_sorted_by_distribution[$letter_position2];
	my $index1 = index ($alphabeth, $letter1);
	my $index2 = index ($alphabeth, $letter2);
	my @letters = split (//, $individual);
	my $swap_letter1 = $letters[$index1];
	my $swap_letter2 = $letters[$index2];
	my $digram_left = $swap_letter1 . $swap_letter2;
	my $digram_right = $swap_letter2 . $swap_letter1;
	$_ = $mutated_individual;
	eval &#8220;tr/$digram_left/$digram_right/&#8221;;
	$mutated_individual = $_;
	return $mutated_individual;
}

###############################################################################
# generate random individual (generates random permutation of the alphabeth):
sub generate_random_individual {
	my @letters = split (//, $alphabeth);
	my $random_individual = &#8221;;
	foreach my $i (reverse (1 .. length $alphabeth)) {
		my $pos = int (rand $i);
		$random_individual .= $letters[$pos];
		# delete the concatenated element from @letters:
		unless ($pos == $#letters) {
			my $temp = $letters[$#letters];
			$letters[$#letters] = $letters[$pos];
			$letters[$pos] = $temp;
			pop @letters;
		} else {
			pop @letters;
		}
	}
	return $random_individual;
}

###############################################################################
# number of populations:
my $populations_count = 20;

###############################################################################
# number of individuals in a population:
my $individuals_count = 20;

###############################################################################
# array of populations:
my @populations;

###############################################################################
# describe a population of indiliduals:
# my $population = {
#	&#8216;individuals&#8217; => [],
#	&#8216;total_fitness&#8217; => 0
# };

###############################################################################
# describe an individual:
# my $individual = {
#	&#8216;description&#8217; => &#8221;,
#	&#8216;fitness&#8217; => 0
# };

###############################################################################
# sort individuals in a population by the fitness function:
sub sort_individuals {
	my ($population) = @_;
	@{$population->{&#8217;individuals&#8217;}} =
		reverse sort { $a->{&#8217;fitness&#8217;} <=> $b->{&#8217;fitness&#8217;} }
			@{$population->{&#8217;individuals&#8217;}};
}

###############################################################################
# sort populations by the cumulative fitness values:
sub sort_populations {
	@populations =
		reverse sort { $a->{&#8217;total_fitness&#8217;} <=> $b->{&#8217;total_fitness&#8217;} }
			@populations;
}

###############################################################################
# initialize the first generation:
sub zero_generation {
	foreach (1 .. $populations_count) {
		my $population = {};
		$population->{&#8217;individuals&#8217;} = [];
		$population->{&#8217;total_fitness&#8217;} = 0;
		foreach (1 .. $individuals_count) {
			my $individual = {};
			$individual->{&#8217;description&#8217;} = &#8221;;
			$individual->{&#8217;fitness&#8217;} = 0;
			my $random_individual = generate_random_individual ();
			$individual->{&#8217;description&#8217;} = $random_individual;
			my $fitness = fitness ($random_individual);
			$individual->{&#8217;fitness&#8217;} = $fitness;
			push (@{$population->{&#8217;individuals&#8217;}}, $individual);
			$population->{&#8217;total_fitness&#8217;} += $fitness;
		}
		sort_individuals ($population);
		push (@populations, $population);
	}
	sort_populations ();
}

###############################################################################
# number of individuals in a population that will mutate:
my $mutate_individuals_count = 4;

###############################################################################
# mutate some randomly chosen individuals in a population:
# A random range of $mutate_individuals_count individuals from a single
# population will mutate.
sub mutate_population {
	my ($population) = @_;
	my $offset = int
		(rand ($individuals_count - $mutate_individuals_count));
	foreach my $i (1 .. $mutate_individuals_count) {
		my $individual =
			${$population->{&#8217;individuals&#8217;}}[$offset + $i];
		my $mutated_description =
			mutation ($individual->{&#8217;description&#8217;});
		$individual->{&#8217;description&#8217;} = $mutated_description;
		$population->{&#8217;total_fitness&#8217;} -= $individual->{&#8217;fitness&#8217;};
		$individual->{&#8217;fitness&#8217;} =
			fitness ($mutated_description);
		$population->{&#8217;total_fitness&#8217;} += $individual->{&#8217;fitness&#8217;};
	}
	sort_individuals ($population);
}

###############################################################################
# mutate all populations:
sub mutate_all_populations {
	foreach my $population (@populations) {
		mutate_population ($population);
	}
	sort_populations ();
}

###############################################################################
# breed the individuals in a population:
# The father is chosen among the 5 best individuals in a population.
# The mother is chosen among the rest individuals in the same population.
# Their child takes the place of the weakest individual in the population.
sub breeding {
	my ($population) = @_;
	my $father_pos = int (rand (5));
	my $father_individual = ${$population->{&#8217;individuals&#8217;}}[$father_pos];
	my $mother_pos = int (rand ($individuals_count - 5)) + 5;
	my $mother_individual = ${$population->{&#8217;individuals&#8217;}}[$mother_pos];
	my $child_individual =
		${$population->{&#8217;individuals&#8217;}}[$individuals_count - 1];
	my $father = $father_individual->{&#8217;description&#8217;};
	my $mother = $mother_individual->{&#8217;description&#8217;};
	my $child = crossover ($father, $mother);
	$child_individual->{&#8217;description&#8217;} = $child;
	$population->{&#8217;total_fitness&#8217;} -= $child_individual->{&#8217;fitness&#8217;};
	$child_individual->{&#8217;fitness&#8217;} = fitness ($child);
	$population->{&#8217;total_fitness&#8217;} += $child_individual->{&#8217;fitness&#8217;};
	sort_individuals ($population);
}

###############################################################################
# breed all populations:
sub breed_all_populations {
	foreach my $population (@populations) {
		breeding ($population);
	}
	sort_populations ();
}

###############################################################################
# interbreeding between neighbour populations:
# The father is the best individual in the first population.
# The mother is randomly chosen individual from the next weakest population.
# Their child takes the place of the weakest individual in the mother&#8217;s
# population. I thought it&#8217;s quite reasonable to interbreed only neighbour
# populations (populations that have close values for the total_fitness).
sub interbreeding {
	foreach my $i (0 .. $populations_count - 2) {
		my $father_population = $populations[$i];
		my $father_individual =
			${$father_population->{&#8217;individuals&#8217;}}[0];
		my $mother_population = $populations[$i + 1];
		my $mother_pos = int (rand ($individuals_count));
		my $mother_individual =
			${$father_population->{&#8217;individuals&#8217;}}[$mother_pos];
		my $child_individual =
			${$mother_population->{&#8217;individuals&#8217;}}[$individuals_count - 1];
		my $father = $father_individual->{&#8217;description&#8217;};
		my $mother = $mother_individual->{&#8217;description&#8217;};
		my $child = crossover ($father, $mother);
		$child_individual->{&#8217;description&#8217;} = $child;
		$mother_population->{&#8217;total_fitness&#8217;} -=
			$child_individual->{&#8217;fitness&#8217;};
		$child_individual->{&#8217;fitness&#8217;} = fitness ($child);
		$mother_population->{&#8217;total_fitness&#8217;} +=
			$child_individual->{&#8217;fitness&#8217;};
		sort_individuals ($mother_population);
	}
	sort_populations ();
}

###############################################################################
# clone an individual:
sub clone_individual {
	my ($individual) = @_;
	my $cloned_individual = {};
	$cloned_individual->{&#8217;description&#8217;} = $individual->{&#8217;description&#8217;};
	$cloned_individual->{&#8217;fitness&#8217;} = $individual->{&#8217;fitness&#8217;};
	return $cloned_individual;
}

###############################################################################
# sort array of individuals:
sub sort_best_individuals {
	my ($ref_individuals) = @_;
	@$ref_individuals =
		reverse sort { $a->{&#8217;fitness&#8217;} <=> $b->{&#8217;fitness&#8217;} }
			@$ref_individuals;
}

###############################################################################
# the best individuals throughout all generations:
my @best_individuals;

###############################################################################
# check if this individual is not already in the @best_individuals array:
sub is_member_individual {
	my ($ref_individuals, $individual) = @_;
	foreach my $member_individual (@$ref_individuals) {
		if ($member_individual->{&#8217;description&#8217;} eq
		    $individual->{&#8217;description&#8217;}) {
			return &#8220;TRUE&#8221;;
		}
	}
	return undef;
}

###############################################################################
# merges to sorted lists of individuals:
sub merge_individuals {
	my ($ref_candidate_individuals) = @_;
	my @new_individuals = (@best_individuals);
	foreach my $candidate_individual (@$ref_candidate_individuals) {
		push (@new_individuals, $candidate_individual)
			unless (is_member_individual (\@new_individuals, $candidate_individual));
	}
	sort_best_individuals (\@new_individuals);
	$#new_individuals = $populations_count - 1;
	@best_individuals = @new_individuals;
}

###############################################################################
# select the best individuals, and if they are better than the existing ones,
# change them:
# This is a way to save the local maxima for all generations in the evolution.
sub select_best_individuals {
	if (@best_individuals) {
		my @best_individuals_in_this_generation;
		foreach my $population (@populations) {
			my $individual =
				clone_individual (${$population->{&#8217;individuals&#8217;}}[0]);
			push (@best_individuals_in_this_generation, $individual);
		}
		sort_best_individuals (\@best_individuals_in_this_generation);
		merge_individuals (\@best_individuals_in_this_generation);
	} else {
		# first initialization of @best_individuals;
		foreach my $population (@populations) {
			my $individual =
				clone_individual (${$population->{&#8217;individuals&#8217;}}[0]);
			push (@best_individuals, $individual);
		}
		sort_best_individuals (\@best_individuals);
	}
}

###############################################################################
# calculate cumulative fitness for all populations in a generation:
sub cumulative_fitness {
	my $cumulative_fitness = 0;
	foreach my $population (@populations) {
		$cumulative_fitness += $population->{&#8217;total_fitness&#8217;};
	}
	return $cumulative_fitness;
}

###############################################################################
# calculate next generation:
sub next_generation {
	breed_all_populations ();
	select_best_individuals ();
	interbreeding ();
	select_best_individuals ();
	mutate_all_populations ();
	select_best_individuals ();
}

###############################################################################
# decrypt the cypher text, using the individual&#8217;s description:
sub decrypt_individual {
	my ($individual) = @_;
	my $permutated_alphabeth = $individual->{&#8217;description&#8217;};
	my $plain_text = $cypher_text;
	# decrypt, using the given individual:
	$_ = $plain_text;
	eval &#8220;tr/$permutated_alphabeth/$alphabeth/&#8221;;
	$plain_text = $_;
	return $plain_text;
}

###############################################################################
# prints all suggestions about the decription of the cypher text:
sub print_results {
	open (RESULTS, &#8216;>&#8217;, &#8220;decriptions.txt&#8221;)
		or die &#8220;Can&#8217;t open file! $!&#8221;;
	foreach my $population (@populations) {
		foreach my $individual (@{$population->{&#8217;individuals&#8217;}}) {
			my $plain_text = decrypt_individual ($individual);
			print RESULTS &#8220;$plain_text\n&#8221;;
		}
	}
	print RESULTS &#8220;\nBEST SUGGESTIONS:\n&#8221;;
	foreach my $individual (@best_individuals) {
		my $plain_text = decrypt_individual ($individual);
		print RESULTS &#8220;$plain_text\n&#8221;;
	}
	close (RESULTS);
}

###############################################################################
# number of generations that are allowed to be without an improvement:
# on every improvement increment this value!
# on every worsening decrement this value!
my $generations_without_improvement = 10;

###############################################################################
# simulation of the evolution process:
sub evolution {
	my $cumulative_fitness = 0;
	zero_generation ();
	select_best_individuals ();
	$cumulative_fitness = cumulative_fitness ();
	my $generations = 0;
	while ($generations_without_improvement) {
		print &#8220;GENERATION $generations\t\tFITNESS: $cumulative_fitness\tGENERATIONS LEFT: $generations_without_improvement\n&#8221;;
		$generations ++;
		next_generation ();
		my $new_cumulative_fitness = cumulative_fitness ();
		if ($new_cumulative_fitness > $cumulative_fitness) {
			$generations_without_improvement ++;
			$cumulative_fitness = $new_cumulative_fitness;
		} else {
			$generations_without_improvement &#8211;;
		}
	}
	print_results ();
}

evolution ();
</pre>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/gHYzRlfErcY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/07/15/do-the-evolution/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Formality vs. Informality</title>
		<link>http://npacemo.com/wordpress/2009/07/09/formality-vs-informality/</link>
		<comments>http://npacemo.com/wordpress/2009/07/09/formality-vs-informality/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 19:33:29 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[Software Engineering]]></category>

		<category><![CDATA[informality]]></category>

		<category><![CDATA[ontology]]></category>

		<category><![CDATA[paper]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=66</guid>
		<description><![CDATA[I&#8217;m writing this blog post for the very same purpose I&#8217;ve decidedly written my latest university paper in English. I just want to reach the biggest possible audience in attempt to introduce you an idea that has the potential to change drastically the way we write software.
HERE YOU CAN DOWNLOAD MY PAPER
Prolog
Just as always when [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m writing this blog post for the very same purpose I&#8217;ve decidedly written my latest university paper in English. I just want to reach the biggest possible audience in attempt to introduce you an idea that has the potential to change drastically the way we write software.</p>
<p><a href="http://npacemo.com/papers/Ontologies_and_Ontology_Languages_for_Web-Service_Description.pdf">HERE YOU CAN DOWNLOAD MY PAPER</a></p>
<h3>Prolog</h3>
<p>Just as always when I have to write a paper for the university, I take the assigned topic and turn it into something completely different. And that&#8217;s exactly what I did for my Middleware paper. </p>
<p>My assignment was to write about <strong>Ontologies and Ontology Languages for Web Service Description</strong>, but it ended being a paper about <em>reassessing the role which formality plays in the field of software engineering</em>. </p>
<h3>So, how did I got from there to here?</h3>
<p>At the start, my intention was to take a couple of ontologies for web service description and to make an attempt to evaluate them according to a set of design criteria, as described in one of the most widely cited works in ontology - <a href="http://tomgruber.org/writing/onto-design.pdf ">Thomas R. Gruber, Toward Principles for the Design of Ontologies Used for Knowledge Sharing.</a></p>
<p>But guess what? It doesn&#8217;t work that way. And it won&#8217;t work that way, especially when you don&#8217;t have enough time. And what do I mean by that? </p>
<h3>The Impenetrable Citadel of Concentric Formality</h3>
<p>As soon as I started my acquaintance with one of the ontologies I&#8217;ve picked, I realized that I don&#8217;t know enough and that I need to get familiar with the underlying layer. When I started to get to know the thing underneath, same sh*t happened. I just couldn&#8217;t move on without picking into the layer beneath. Getting two floors down and I couldn&#8217;t remember anymore what was two floors above. </p>
<p>I&#8217;ve always considered layering a good thing, but what was happening then? Why I&#8217;m not able to learn about a system one layer at a time, without having to pick into the layers beneath? And it just struck me:</p>
<blockquote><p>All these layers of effective formality all the way down are simply inefficient&#8230;
</p></blockquote>
<p>&#8230;And it is inefficient not because it isn&#8217;t precise, but because it is maybe <strong>too precise</strong>. </p>
<h3>Why growing an interest in Lisp may matter?</h3>
<p>When you grew an interest about something, interesting things will start to happen to you. Things like discovering new stuff, discovering new ideas and most importantly discovering new amazing people. Scheme is probably the most amazing programming language I&#8217;ve learned in the university, but I haven&#8217;t been manifesting any forms of interest in Lisp until recently. And that&#8217;s how I discovered the work of <a href="http://www.cs.ubc.ca/~gregor/">Gregor Kiczales</a> - the creator of the Meta-Object Protocol for Lisp, the father of CLOS and the mind behind the Aspect-Oriented Programming. And one of the first things I did was listening to his keynote talk at OOPSLA 2007 (available as <a href="http://www.oopsla.org/podcasts/Keynote_GregorKiczales.mp3">podcast</a> and <a href="http://www.cs.ubc.ca/~gregor/papers/kiczales-oopsla-07-for-viewing.pdf">PDF slides</a>). Since then I&#8217;ve been listening to this same talk at least three more times. This talk is all about <strong>formality vs. informality</strong> and it ended being a road-map for my Middleware paper. A substantial part of the audio you can find almost as a transcript in my paper. I&#8217;ve been shamelessly repeating Kiczales&#8217; words with the hope they will raise some interest in these radical ideas.</p>
<h3>Disclaimer</h3>
<p>In advance, I want to apologize to all the experts that are familiar in much more detail with the stuff I wrote about in my paper. To them it may seem that I&#8217;m just scratching the surface, and probably they&#8217;re right. Forgive me, if I haven&#8217;t presented your ideas in the right way, or if I&#8217;ve misunderstood you. If that&#8217;s the case, it would be great if I hear back from you.</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/Q558BFOFqSs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/07/09/formality-vs-informality/feed/</wfw:commentRss>
<enclosure url="http://www.oopsla.org/podcasts/Keynote_GregorKiczales.mp3" length="35846296" type="audio/mpeg" />
		</item>
		<item>
		<title>FLit - a Light-Weight Flex for Flash apps</title>
		<link>http://npacemo.com/wordpress/2009/06/30/flit-a-light-weight-flex-for-flash-apps/</link>
		<comments>http://npacemo.com/wordpress/2009/06/30/flit-a-light-weight-flex-for-flash-apps/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 14:45:05 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[flash]]></category>

		<category><![CDATA[flex]]></category>

		<category><![CDATA[FLit]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=65</guid>
		<description><![CDATA[A whole class of RIA applications is getting judiciously ignored by technology vendors like Adobe and Microsoft with the argument that these are way too custom to be utilized in any direction. In the recent years both vendors were focusing their efforts on streamlining the enterprise RIAs, both neglecting the class of applications that was [...]]]></description>
			<content:encoded><![CDATA[<p>A whole class of RIA applications is getting judiciously ignored by technology vendors like Adobe and Microsoft with the argument that these are <strong>way too custom</strong> to be utilized in any direction. In the recent years both vendors were focusing their efforts on streamlining the enterprise RIAs, both neglecting the class of applications that was previously the predominant type of RIA. I&#8217;m talking about marketing platform applications or <em>Rich User Experiences that are not focused on providing a particular business function</em>. Such applications most typically are not extensively using common UI controls and usually they don&#8217;t have to deal with visualizing and manipulating large sets of data in grids and charts. </p>
<p>Adobe have done a great job with Flex (and in the years to come it will hopefully improve)! But Flex comes with a certain weight that makes it nearly impossible to use when we have to develop the class of applications that I want to stress on. The overhead of the framework is too big to be ignored. Our main concern is that this will eventually result in poorer user experiences, because of initial download times. But even if we circumvent this issue in some way (check my article on <a href="http://npacemo.com/wordpress/2008/07/06/flex-application-bootstrapping-totally-custom-preloader/">Totally Custom Preloaders</a>), the SWF will still include code dependencies that are used nowhere in the application. Not to mention that the whole component model is too heavy and complicated and will eventually stand in our way when we have to implement a totally custom experience.</p>
<h3>Introducing FLit</h3>
<p>But on the other hand Flex comes with a set of tools and concept that we really love and still want to be able to use. So what we end up doing in our free time in <a href="http://obecto.com/">Obecto</a> is a framework that would enable us to use Flex for really custom Flash apps with a minimal overhead from the framework. And we called this framework <a href="http://flit.googlecode.com/">FLit - a light-weight Flex for Flash apps</a>. We&#8217;ve developing it open source from line 1 - so feel free to check out the source from <a href="http://flit.googlecode.com/">Google Code</a>. There you&#8217;ll find some samples too!<br />
<img style="margin: 0 0 0 0;" title="flit-logo" src="http://npacemo.com/wordpress/wp-content/uploads/2009/06/flit-logo.png" alt="Introducing FLit!" width="500" height="215" /></p>
<h3>Why we call it FLit?</h3>
<p>First, FL stands for Flash. We want to build plain AS3 projects without the need to use <strong>&lt;mx:Application&gt;</strong> as a root object for our apps, and we want it to be as fast and as small as a plain AS3 project could be.</p>
<p><img style="margin: 0 0 0 0;" title="flit-and-flash" src="http://npacemo.com/wordpress/wp-content/uploads/2009/06/flit-and-flash.png" alt="FLit is Flash" width="500" height="281" /></p>
<h3>How do we use Flex in FLit?</h3>
<p>As you might guess FL also stands for Flex, but we only use a small subset of the Flex Framework, like Data Binding and MXML, and nothing else - no UIComponent, no Flex Application. How do we succeed in using MXML inside of a plain AS3 project? Well, this is a topic for another post.</p>
<p>We are also using a concept <em>pretty close to the view contract in Spark</em>, thus enabling the separation of concerns between the designer and the developer. </p>
<p><img style="margin: 0 0 0 0;" title="flit-and-flex" src="http://npacemo.com/wordpress/wp-content/uploads/2009/06/flit-and-flex.png" alt="FLit is Flex" width="500" height="281" /></p>
<h3>What do we mean by lite?</h3>
<p>We understand liteness as to have minimum dependencies between components, thus there are no components in the framework that will induce as dependencies a substantial part of the framework itself. </p>
<p>We understand liteness as the ability to include only those concern that interest you and not some behavior hard-coded in the framework. </p>
<p>We also understand liteness as having a lite build process. Previously when building custom Flash apps we needed to use the designer machine and the designer productivity tools for the build. With FLit this is not the case - the designer is responsible only in preparing assets that must contain the parts specified in the view contract, so the productivity tools are not used for the build. So, this is also a pretty lite skinning process.<br />
<img style="margin: 0 0 0 0;" title="flit-lite" src="http://npacemo.com/wordpress/wp-content/uploads/2009/06/flit-lite.png" alt="FLit is lite" width="500" height="281" /></p>
<h3>The current state of FLit</h3>
<p>FLit is in early experimentation phase. Maybe <a href="http://dev.obecto.com/flit_samples/FormSample.html">this sample</a> somewhat summarizes what&#8217;s inside the framework now? You can also check out <a href="http://code.google.com/p/flit/source/browse/trunk/sampleComponents/src/component/flit/form/FlitForm.mxml#">the sample&#8217;s code</a>!<br />
A summary of features:</p>
<p style="margin-left: 20px;">
● light-weight base component<br />
● light-weight base container<br />
● view contract specification through metadata tags<br />
● skin asset<br />
● several layout strategies<br />
● transition manager that supports declarative transitions between states<br />
● tasks (an idea which originated from the <a href="http://www.gugga.com/GuggaFlashFramework/">GuggaFF</a>) - Sequence and Parallel are also tasks<br />
● declarative input validators<br />
● skin-able button component<br />
● tweening engine</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/2D2wQX_dDPI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/06/30/flit-a-light-weight-flex-for-flash-apps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Physical vs. Metaphorical User Interfaces</title>
		<link>http://npacemo.com/wordpress/2009/03/01/physical-vs-metaphorical-user-interfaces/</link>
		<comments>http://npacemo.com/wordpress/2009/03/01/physical-vs-metaphorical-user-interfaces/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 20:34:31 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Design]]></category>

		<category><![CDATA[Personal Computing]]></category>

		<category><![CDATA[Benjamin B. Bederson]]></category>

		<category><![CDATA[metaphor]]></category>

		<category><![CDATA[Pad++]]></category>

		<category><![CDATA[physics]]></category>

		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=64</guid>
		<description><![CDATA[We need to hurry up! Personal computing is evolving too slow. It&#8217;s needless to say that the amount of information we need to interact with increases every day. Display dimensions are getting bigger, but this type of scalability is somewhat limited - no matter how big a screen gets it will always be limited to [...]]]></description>
			<content:encoded><![CDATA[<p><strong>We need to hurry up!</strong> Personal computing is evolving too slow. It&#8217;s needless to say that the amount of information we need to interact with increases every day. Display dimensions are getting bigger, but this type of scalability is somewhat limited - no matter how big a screen gets it will always be limited to the <i>viewing frustum</i> of the human eyes. On the other side user interfaces in widespread personal computing are still stuck in the 80&#8217;s. Almost no development at all - nothing more than rudimentary improvements. Even Apple is incrementing too slow over it. </p>
<p/>
The thing is we&#8217;re still mimicking early media types and no one (neither Apple or Microsoft, or even free software initiatives) have the guts to leave behind old paradigms and move to radically new user interface <i>mechanisms</i>. </p>
<p/>
Some say a radically new user interfaces would be <i>unintuitive</i> and <i>unnatural</i>, but the adverb <i>intuitive</i> in nothing more than a reference to someone&#8217;s level of acquaintance or past experience with a concept. This simply means that in order to feel comfortable with a system you need to be relatively experienced with similar systems. But what are the options when most of the systems are poorly designed? To design an intuitive system we need to repeat the design flaws of the previous systems our potential users were exposed to. So maybe we should not set intuitiveness as a goal, but instead <strong>focus on human cognetics and solid scientific principles</strong> when exploring new possibilities for user interfaces.</p>
<p/>
Some say there is no business for radical changes, especially in times of crisis. People want something that has already been proven useful. There is no margin for risks&#8230; So, I&#8217;m going to publish a comparison between current metaphorical user interfaces with an alternative one that relies on information physics. </p>
<p/>
My points of view about personal computer user interfaces are strongly influenced by Jef Raskin&#8217;s book <i>The Humane Interface</i>. In his book he wrote about the application of <i>Zoomable User Interfaces</i> and he also referred to the research work done in this field by Benjamin B. Bederson with the Pad++ software at the University of New Mexico. Currently the information about <a href="http://www.cs.umd.edu/hcil/pad++/">Pad++</a> is moved to the web pages of the University of Maryland, where you can find a handful of <a href="http://www.cs.umd.edu/hcil/pad++/papers/">useful papers</a> (a must-read for everyone interested in designing and developing ZUI&#8217;s). I&#8217;ve recently found this comparison in the last pages of a <a href="http://www.cs.umd.edu/hcil/pad++/papers/uist-94-pad/uist-94-pad.pdf">paper</a> titled <i>Pad++: A Zooming Graphical Interface for Exploring Alternate Interface Physics</i>. I&#8217;ll publish the comparison with just minor modifications.</p>
<h3>Four distinguishing differences</h3>
<p>A physical interface strategy can be distinguished in at least four ways from a metaphor based strategies:</p>
<p/>
<strong>First</strong>, metaphors necessarily pre-exist their use. Pre-Copernicans could never have used the metaphor of the solar system for describing the atom. In designing interfaces, one is limited to metaphorical resources at hand. In addition, the metaphorical reference must be familiar to work. An unfamiliar interface metaphor in functionally no metaphor at all. One can never design metaphor the way one can design self-consistent physical descriptions of appearance and behavior. Thus, as an interface design strategy physics offer design-ability and tailor-ability that metaphor does not. </p>
<p/>
<strong>Second</strong>, metaphors are temporary bridging concepts. When they become ubiquitous, they die. The familiarity provided by the metaphor during earlier stages of uses gives way to familiarity with the interface due to actual experience. The current generation of kids have grew up with personal computers around them and a world of desktops, files and menus, but even though these are metaphors, and are also a successful ones, to these kids a desktop is just a computer screen and a file is just something on a hard drive with no mental association with the real life entities originally used for the metaphors. Successful metaphors also wind up as dead metaphors. But the pervasiveness of dead metaphors as files, menus, and windows may well restrict us from thinking about alternative organizations of computation.</p>
<p/>
<strong>Third</strong>, since the sheer amount and complexity of information with which we need to interact continues to grow, we require design strategies that <i>scale</i>. Metaphor is no such a scaling strategy. Physics is. Physics scales to organize greater and greater complexity by uniform application of sets of simple laws. In contrast, the greater the complexity of metaphorical reference, the less likely it is that any particular structural correspondence between metaphorical target and reference will be useful.</p>
<p/>
<strong>Fourth</strong>, it is clear that metaphors can be harmful as well as helpful since they may well lead users to import knowledge not supported by the interface. There are certainly metaphorical aspects associated with physics-based strategy. <strong>Our point is not that metaphors are not useful but that they may restrict the range of interfaces we consider. </strong></p>
<p>What do you think about this?<br />
Tell me, what you want to be able to do with your personal computers and what user interfaces you would like to have?</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/0KMXh7GhsGk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2009/03/01/physical-vs-metaphorical-user-interfaces/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thoughts on Creating an Open Company</title>
		<link>http://npacemo.com/wordpress/2008/12/22/thoughts-on-creating-an-open-company/</link>
		<comments>http://npacemo.com/wordpress/2008/12/22/thoughts-on-creating-an-open-company/#comments</comments>
		<pubDate>Mon, 22 Dec 2008 14:20:13 +0000</pubDate>
		<dc:creator>Vladimir Tsvetkov</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Design]]></category>

		<category><![CDATA[entrepreneurship]]></category>

		<category><![CDATA[obecto]]></category>

		<category><![CDATA[open]]></category>

		<category><![CDATA[sustainability]]></category>

		<category><![CDATA[The Cluetrain Manifesto]]></category>

		<guid isPermaLink="false">http://npacemo.com/wordpress/?p=61</guid>
		<description><![CDATA[Beware, this post has only questions and no answers but just a few suggestions coming out of my no-experience-at-all-in-creating-and-running-businesses. But guess what? It&#8217;s open, so feel free to come in and take part in the discussion.

Where to start from? A month or so somebody had twitted a book about the revolutionary changes happening over the [...]]]></description>
			<content:encoded><![CDATA[<p>Beware, this post has only questions and no answers but just a few suggestions coming out of my no-experience-at-all-in-creating-and-running-businesses. But guess what? It&#8217;s open, so feel free to come in and take part in the discussion.<br />
<img style="margin: 0 0 0 0;" title="come-in" src="http://npacemo.com/wordpress/wp-content/uploads/2008/12/openness.gif" alt="Come in! We're open" width="500" height="233" /><br />
Where to start from? A month or so somebody had twitted a book about the revolutionary changes happening over the Internet - <a href="http://www.cluetrain.com/">The Cluetrain Manifesto</a> - I took a look at it, read the manifesto, take it to my heart and bookmarked it. I really can&#8217;t remember who suggested me that book, but anyway I want to thank him. It was two days ago when I got back to that bookmark and started reading it and after I read the <a href="http://www.cluetrain.com/apocalypso.html">first chapter</a> it was really difficult for me to get asleep - the voice of the book was amplifying with my brain waves, resulting in a resonance that kept me awake for hours after the time I usually go to bed.</p>
<p/>
The thing is that me and my partner are forming a <a href="http://obecto.com/">company</a> which is focused on building human-centered Rich Internet Applications, but we don&#8217;t want to limit the human centrism only to the applications itself, but to also focus on the humans as the foundation of the whole company. And by humans we don&#8217;t mean consumers, demographics and statistics, but the conscious, valuable beings that are aware of themselves, the environment and the people around them.</p>
<h3>A bit of history</h3>
<p>The conveyor line best characterized the most of the successful businesses of the last century - increasingly detailed division of labour, mindless execution of single repetitive tasks and higher and higher deskilling. We refer to this period of time as to the Industrial Era, and to this management approach as to Command &#038; Control. While it is great for producing more with less, it&#8217;s simply not humane.</p>
<p/>
If you ask me the industrial era of Command &#038; Control management have died with the fall of the Berlin Wall (this event is not directly related to technology, but adds a dramatic effect) or even a decade before that, but I guess it will take another 20-30 years (hopefully far less than that) to change peoples perception of business as just a shiny polished logo, strong brand with some brainwashing slogans and infinitely repeating advertisements that dumb down the man into a robot (which eventually is substituted by actual robots) on the conveyer line for the purpose of producing and consuming more and more, in order to sustain the company&#8217;s infinite expansion. </p>
<p/>
I&#8217;m a software guy, so I have a natural disgust for Command &#038; Control - it&#8217;s just not the way software is getting done. But no matter how I hate Command &#038; Control, I still can&#8217;t believe how distorted was my perception of business. I thought I need to implement  the &#8220;genius&#8221; idea -  the idea that will bring the fortune to my company, but an idea that is not necessarily improving people&#8217;s lives. And then&#8230; then what? Just keep a nice company image, good financial records, advertise in order not to fossilize and leave everything else to the financiers - they are so good at buying and selling and blowing phony balloons. You may think I write this, because I&#8217;m one of those that hate brokers and bankers and all financiers, but probably I wouldn&#8217;t even thought of them if I haven&#8217;t recently stumbled upon this <a href="http://www.portfolio.com/news-markets/national-news/portfolio/2008/11/11/The-End-of-Wall-Streets-Boom">article</a> - I think Guy Kawasaki twitted about it three or four or five weeks ago and this is how I got to it.</p>
<p/>
Intuitively I knew my perception of business is full of shit, but it took some things to happen before I got my intuition wide awake.</p>
<h3>Sustainability</h3>
<p>I&#8217;ve been thinking for quite some time about the impact my lifestyle has on the environment, but not until a year ago I began to understand what sustainability really means and why it is important. Since then I try to live with the realization that everything I do should somehow fit into the natural environment and not just fit, but also to sustain in it without damaging or destroying it&#8230; or at least I just try to minimize my impact. If you still don&#8217;t know what sustainability is really about, you got to watch the <a href="http://www.ted.com/index.php/talks/william_mcdonough_on_cradle_to_cradle_design.html">William McDonough&#8217;s TED talk</a> to get acquainted with the notions of cradle-to-cradle design.</p>
<h3>Speaking of design&#8230;</h3>
<p>I&#8217;m in the business of making things, so it&#8217;s kind of essential for me to have an accurate understanding of what design is. The cool thing is that if you watch the <a href="http://www.ted.com/index.php/talks/william_mcdonough_on_cradle_to_cradle_design.html">William McDonough TED lecture</a> you&#8217;re not going to learn only about sustainability, but you can also get enlightened on what design is&#8230; and it&#8217;s pretty much everything. By saying that it&#8217;s pretty much everything it&#8217;s my way to emphasize on the importance of the concept of having an intention and to signify this intention with your designs. People think about their desires and needs, but rarely take a minute and try connecting all the dots into a picture that clearly shows their intentions. I was no different&#8230;</p>
<h3>It&#8217;s just scope and scale</h3>
<p>Everything I do or have done had a meaning in the context of my actions - graduating a nice university, picking a profession, practice that profession. Sure, professionalism is expected, getting the job done is expected, but nobody expects or requires from you to have intentions out of the scope and the scale of your jobs. It&#8217;s just so Command &#038; Control&#8230; but besides that Command &#038; Control is so inhumane it is also terribly bad for the environment. If you think about your actions, you&#8217;ll see that many of them are justified enough in a particular scope and scale, but in a broader scope and in a bigger scale those same actions are devastating - their signal of intention sounds pretty strange for a reasonable being. It goes something like: &#8220;Let&#8217;s have miserable lives full of stress in a polluted environment where our kids are dying from mercury intoxication.&#8221; Allan Chochinov have put it all together very beautifully in his 1000 words <a href="http://www.core77.com/reactor/04.07_chochinov.asp">Manifesto for Sustainability in Design</a>.</p>
<h3>Designer of a business</h3>
<p>As a beginner entrepreneur I&#8217;m also a designer of a business. It&#8217;s my responsibility to decide what&#8217;s going to be my company&#8217;s signal of intent. It&#8217;s my job to develop a sense of scope and scale for the company, instead of just finding ways to expand. It&#8217;s me who&#8217;s task is to define the company&#8217;s mission, instead of just searching for sources that will fill my pockets. It&#8217;s me and my partners&#8230; and as every other designer, we have specific problems to solve.</p>
<h3>The problem</h3>
<p>Simply put, we need to design a very humane conversation environment for our company. And by humane I mean an environment that responds to the natural human needs and our inclinations to speak freely, show off with the stuff we&#8217;re creating, share our knowledge, learn new things and satisfy our curiosity, but above all to connect and relate with other human beings. </p>
<h3>The common closed model</h3>
<p>The established model among successful companies is to have an intranet hidden behind a firewall and a centralized censorship. The intranet is used for internal discussions, research and development, enterprise management, etc. The firewall takes care of the company&#8217;s discoveries, issues, ideas and dirty underwear not to be released by chance to the public and to keep curious strangers, but mostly to keep potential clients and competition out of the companies internal issues and affairs. The central censorship is disguised under a Public Relations department. The PR guys are concerned only with the company&#8217;s image and this concern has nothing to do with utility or contribution to the greater good, not to mention ethics. It&#8217;s easy and maybe fair to start demonizing the Big Brother and to add a flavor of paranoia, but you should put aside conspiracy theories and start thinking about the reasons that have triggered the emergence of such a model. And the reasons are pretty obvious&#8230; It&#8217;s a matter of basic survival instincts. It looks like living in the constant conditions of competition and rivalry gives power to our most destructive forces. It&#8217;s utopian to expect fair play and ethics out of a dog-eat-dog situation. So, forget about greater good, forget about ethics, forget about basic human needs, forget about the environment and lets focus on screwing each other&#8230; But does it has to be necessarily like this?</p>
<h3>Are there any better alternatives?</h3>
<p>Remember the crazy mathematician from the <a href="http://www.imdb.com/title/tt0268978/">Beautiful Mind</a> movie? Do you remember his name? If you&#8217;ve attended a <a href="http://en.wikipedia.org/wiki/Game_theory">Game Theory</a> course there is no way you&#8217;ve missed or haven&#8217;t remembered his name - <a href="http://en.wikipedia.org/wiki/John_Forbes_Nash">John Forbes Nash Jr.</a> He had mathematically proven that in competitive environments, conflict situations or games, where every player is interested in raising a higher score, the optimal strategy is to reduce competitiveness in favor of cooperation. If all parties agree to such strategy, they&#8217;ll increase their score in the most optimal (least riskier) way and they&#8217;ll reach a point of equilibrium where everyone&#8217;s behavior should remain unchanged in order to gain a sure profit for all parties from such a conflict situation. Businesses apply this theory with their competition, but the sole goal of increasing profit no matter of the social and environmental costs, is pushing people away from businesses and is turning people into their biggest opponent. What used to be statistics, demographics and a gray dumb mass of consumers and employees is now a massive symbiotic system of pervasively interconnected individuals. In our hyper-linked world, we can know anything, anytime. </p>
<p/>
My starting business must acknowledge this eruption of mass awareness and must forge a mutually beneficial strategy that has the potential for large scale collaboration. And to my opinion the first step is to create an entirely open company.</p>
<h3>What&#8217;s an open company?</h3>
<p>I haven&#8217;t done any research on whether there are such companies and I haven&#8217;t even made the effort to search whether an &#8216;open company&#8217; exists as a term. I don&#8217;t know what an open company is, so don&#8217;t expect from me to give you an exact definition. What I can do, is to list some of the characteristics of an open company and also to write down what an open company is not.</p>
<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;">an open company should encourage the emerging Conversation and should not limit discussions only inside the corporate intranet - one way or another the information leakage is inevitable - either an unsatisfied client will expose you as a fraud if you pretend to be something that you&#8217;re not and if your services suck and your products are crap, or either one of your employees will start blogging under a legal disclaimer that will prevent affiliating his writings with the actual company&#8217;s issues</span></p>
<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;">an open company should make use of all emerging information channels in addition to the company&#8217;s established channels - useful feedback can come from virtually everyone and everywhere</span></p>
<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;">an open company should avoid standing in what I call a protective posture - covering its problems, masking company&#8217;s proportions into something completely different or being willing to do anything for a buck - this protective mode prevents companies from actually facing and solving their issues and eventually creating a healthy, worthy, sustainable businesses</span></p>
<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;">an open company should share its knowledge - simple as that</span></p>
<p>And here are some words on what an open company is not:</p>
<p><span style="border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block; background-color: oldLace;">an open company is not a reality 24/7 pimp show - company&#8217;s openness is not a desperate attempt for being original - company&#8217;s openness is a tool for discovering and solving issues, sharing knowledge and learning from each other - it is conceptually pure, potentially ethical, but most importantly it looks like a more humane way of making business</span></p>
<h3>The current status</h3>
<p>Right know my venture is wearing the suit of an outsourcing company. Should I be ashamed of that? Strange question you may think, but I wonder is it going to look that strange to you when you come to the realization that it is my company&#8217;s availability, my company&#8217;s competitive prices and it&#8217;s my company&#8217;s higher quality of service that makes possible and it&#8217;s partially responsible for the huge lay offs of programmers and software engineers in the world leading countries. Companies that pretend to be socially responsible may put this legal note on their services:</p>
<p style="font-size: 10px; font-family: Courier; border-style: solid; border-width: 1px; margin: 14px; padding: 5px 10px; display: block;">USE OUR OUTSOURCING SERVICES RESPONSIBLY. ABUSE MAY RESULT IN PEOPLE LOOSING THEIR JOBS, DESTROYING LOCAL ECONOMIES AND EVENTUALLY DESTROYING YOUR WHOLE COMMUNITY.</p>
<p>But on the other side, it&#8217;s me and my partners and our employees who maintain a cheaper lifestyle and restrain our consumer abilities to a level much lower than the level of our american colleagues for instance. This is the nature of the free enterprise system. All of us helped and contributed in establishing this system on a global scale, and now like it or not we&#8217;re in position to constantly compete with each other. I don&#8217;t like it this way. I would rather collaborate than compete with my colleagues, so I&#8217;m in a search of ways to create an open company. I don&#8217;t know if this makes any sense to anyone, but every suggestion and opinion would be appreciated.</p>
<img src="http://feeds.feedburner.com/~r/MasteringTheTaoOfPersonalComputing/~4/rySkYC7jCqE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://npacemo.com/wordpress/2008/12/22/thoughts-on-creating-an-open-company/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

