<?xml version="1.0" encoding="iso-8859-1"?><feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
  <title>design-nation.blog/en</title>
  <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/" />
  <modified>2007-01-20T12:55:22Z</modified>
  <tagline>a blog about actionscript, java, cocoa and software development in general</tagline>
  <id>tag:www.design-nation.net,2007:/en//4</id>
  <generator url="http://www.movabletype.org/" version="3.2">Movable Type</generator>
  <copyright>Copyright (c) 2006, Cesar Tardaguila</copyright>
  <entry>
    <title>Flash Lite or J2ME?</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002161.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2006-01-03T11:24:30+00:00</issued>
    <id>tag:www.design-nation.net,2006:/en//4.2161</id>
    <created>2006-01-03T11:24:30Z</created>
    <summary type="text/plain">Almost a year ago, I posted a comparison between Flash Lite and J2ME. As you probably now, the Flash Lite 2 update for Flash Professional 8 has just been released through Macromedia Labs, and it’s time to rewrite that post....</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>FlashLite</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Almost a year ago, <a href="http://www.design-nation.net/en/archives/000453.php">I posted a comparison between Flash Lite and J2ME</a>.</p>

<p>As you probably now, the <a href="http://labs.macromedia.com/technologies/flashlite2_update_flashpro8/">Flash Lite 2 update for Flash Professional 8</a> has just been released through Macromedia Labs, and it’s time to rewrite that post.</p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Has there been any change?</p>

<p>Thankfully, yes!. While the J2ME platform has been slowly but safely following its well established path, adding a few new profiles, the release of Flash Lite 2 brings a lot joy and good news for mobile developers.</p>

<p>So, what’s new in Flash Lite 2?<br />
Maybe the most important improvement in the new player is the support for ActionScript 2.0. So, we can forget about one the most important caveats of the old Flash Lite player, which was the flash 4 syntax (which also meant complex nested movieclips structures, code everywhere, and a deprecated syntax).</p>

<p>Now we don’t have to jump between two different syntaxes, and we don’t have to jump between two different development paradigms. We finally have an object-oriented language, with all its advantages: code reuse, small entities that are responsible of small tasks,... well, you know.</p>

<p>But the adoption of AS2 is not only an advantage by itself. Been able to develop a desktop application, a web application or a Flash Lite application writing exactly the same code will make much easier for all the developers out there to try the technology. And more developers working on "the shinny thing" means more applications available, and having more applications available will mean that there will be a stronger demand for more good applications. So, everybody wins.</p>

<p>Yeah, AS2, cool, but isn’t there anything else?</p>

<p>Yes, there are two more things, that, from my point of view, will make Flash Lite a serious J2ME contender: local storage and XML support. Why?</p>

<p>Local storage support is probably the most important feature of Flash Lite 2. GPS connections are expensive (here is Spain, are obscenely expensive, so you can imagine the cost of a 3G connection), so the users must be able to store small chunks of data in their devices. Period. This was something that was needed, and that Macromedia has implemented, so we can only be thankful for it. </p>

<p>But when there’s the need of downloading complex data, the old loadmovie command was a real pain. We asked for it, and now we have it. Cool.</p>

<p>So, one of the weaker points of Flash Lite, which was the lack of functionality, is not so important right now. Of course, there are many things you can do when developing a J2ME application, like accessing the Bluetooth or the PIM or the camera api, but in most applications there will not be the need to do so. I mean, how many mobile apps are multiuser Bluetooth-driven games?. Not so many.</p>

<p>So, there’s still a certain lack of functionality, but, from my point of view, it’s not such an important point as it was before.</p>

<p>Conclusion</p>

<p>J2ME is almost in the same point where it was a year ago. Flash Lite isn’t, and now, more than ever, I feel that, before starting to develop a new application, I can really stop and think about what’s the best tool for the job, if it’s Flash Lite or if it’s J2ME, because, right now I am not only constrained to J2ME. </p>

<p>I finally can choose.</p>]]>
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>FlashLite player 2 is available</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002160.php" />
    <modified>2007-01-20T20:46:55Z</modified>
    <issued>2005-12-21T15:03:59+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2160</id>
    <created>2005-12-21T15:03:59Z</created>
    <summary type="text/plain">I&apos;m sure you have read in the aggregators, but I won&apos;t do any harm to read about it once again. FlashLite 2 player is available through the la Adobe online store, and it costs 8 € (ex. VAT). There is...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>FlashLite</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>I'm sure you have read in the aggregators, but I won't do any harm to read about it once again.</p>

<p>FlashLite 2 player is available through the <a href="http://www.macromedia.com/cfusion/store/index.cfm?store=OLS-EU&view=ols_prod&category=/Software/Development/StandAlones/FlashLite2">la Adobe online store</a>, and it costs 8 € (ex. VAT).</p>

<p>There is no official documentation yet, and it is not possible to start developing specific content, but at least we can start testing our old FlashLite 1.1 apps against the new player ;)</p>

<p>You can read more about the announcement <a href="http://www.flashdevices.net/2005/12/flash-lite-player-2-now-available.html">at Flash Devices</a>.</p>

<p>Enjoy your new toy...</p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>Business &amp; marketing for the Mac Developer</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002159.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-12-12T08:53:01+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2159</id>
    <created>2005-12-12T08:53:01Z</created>
    <summary type="text/plain">The Apple Developer Connection website has added a new section that provides, among other useful tips, a collection of Business &amp; Marketing Frequently Asked Questions, information about specific markets (like education, science &amp; technology...). I think it&apos;s worth a read...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Mac</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>The <a href="http://developer.apple.com/">Apple Developer Connection</a> website has added a new section that provides, among other useful tips, a collection of Business & Marketing Frequently Asked Questions, information about specific markets (like education, science & technology...).</p>

<p>I think it's worth a read if you are a Mac developer.</p>

<p><a href="http://developer.apple.com/business/index.html">Business & Marketing for the Mac Developer</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>How to write unmaintenable code</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002158.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-11-26T07:53:33+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2158</id>
    <created>2005-11-26T07:53:33Z</created>
    <summary type="text/plain">And old link, that I lost, and that I found again yesterday. I love the opening quote: &quot; Never ascribe to malice, that which can be explained by incompetence&quot; A funny read: how to write unmaintenable code...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>General</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>And old link, that I lost, and that I found again yesterday. I love the opening quote: <i>" Never ascribe to malice, that which can be explained by incompetence"</i></p>

<p>A funny read: <a href="http://thc.org/root/phun/unmaintain.html">how to write unmaintenable code</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[Cocoa] Memory management and exceptions</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002157.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-11-23T16:55:10+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2157</id>
    <created>2005-11-23T16:55:10Z</created>
    <summary type="text/plain">In languages like Java and actionscript, the &quot;runtime&quot; manages memory, using what is called a garbage collector, that reclaims the memory occupied by an object once it determines that object is no longer accessible. In Objective-C, the programmer must release the resources that he or she has previously allocated to be used by the program.

Memory management is not difficult by itself, because the developer must follow only a few rules, but it is the source of many memory leaks, specially when the program behaves in an unexpected way.

So, what happens when we need to throw exceptions?. How can we be sure that we are not producing memory leaks?. Chris Hanson writes about it in Cocoa memory management &amp; exceptions</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Cocoa</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>In languages like Java and actionscript, the "runtime" manages memory, using what is called a garbage collector, that reclaims the memory occupied by an object once it determines that object is no longer accessible. In Objective-C, the programmer must release the resources that he or she has previously allocated to be used by the program.</p>

<p>Memory management is not difficult by itself, because the developer must follow only a few rules, but it is the source of many memory leaks, specially when the program behaves in an unexpected way.</p>

<p>So, what happens when we need to throw exceptions?. How can we be sure that we are not producing memory leaks?. Chris Hanson writes about it in <a href="http://www.livejournal.com/users/chanson/126035.html">Cocoa memory management & exceptions</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>Design patterns poster</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002155.php" />
    <modified>2007-01-20T12:54:58Z</modified>
    <issued>2005-11-01T18:12:55+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2155</id>
    <created>2005-11-01T18:12:55Z</created>
    <summary type="text/plain">I am sure you have heard about the Head First series and about the Head First Design Patterns book, because it is probably the best introductory book to understand design patterns. Last week I was browsing amazon when I found...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Design Patterns</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>I am sure you have heard about the Head First series and about the <a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596007124/qid=1130864263/sr=8-1/ref=sr_8_xs_ap_i1_xgl/202-7220919-6724630">Head First Design Patterns</a> book, because it is probably the best introductory book to <i>understand</i> design patterns.</p>

<p>Last week I was browsing amazon when I found this item: <a href="http://www.amazon.co.uk/exec/obidos/ASIN/0596102143/qid=1130864263/sr=8-2/ref=sr_8_xs_ap_i2_xgl/202-7220919-6724630">Head First Design Patterns Poster</a>.</p>

<p><img src="http://www.design-nation.net/en//archives/designPatternsPoster.jpg" border="0" height="399" width="414" alt="designPatternsPoster.jpg" align="" /></p>

<p>As its name says, it is a poster (a big one, in fact) that contains a graph (taken from the original book), not an UML diagram but a graph that explains the pattern and also the page number of the pattern in both the Gang of four and Head First Design Patterns.</p>

<p>It visually summarizes 18 patterns, and it is attached to the wall in front of my computer right now...</p>

<p>(By the way, all the links in this post will NOT earn me a comission).</p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[J2ME] Netbeans Mobility Pack 5.0 beta</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002150.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-09-29T10:28:18+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2150</id>
    <created>2005-09-29T10:28:18Z</created>
    <summary type="text/plain">Yesterday was a busy day at NetBeans. Not only they have released NetBeans 5.0 beta, but also Mobility Pack 5.0 beta At first glance, there are some new features that will make our life a bit easier: JSR 172 (...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>J2ME</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Yesterday was a busy day at NetBeans. Not only they have released <a href="http://www.netbeans.org/downloads/index.html">NetBeans 5.0 beta</a>, but also  <a href="http://www.netbeans.org/kb/50/mobility.html">Mobility Pack 5.0 beta</a></p>

<p>At first glance, there are some new features that will make our life a bit easier: JSR 172 ( webservices ) support, improved UI designer, and improved support for emulators.</p>

<p>More information and downloads here: <a href="http://www.netbeans.org/kb/50/mobility.html">Java ME MIDP Development for NetBeans IDE 5.0</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[J2ME] Some articles of interest</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002149.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-09-29T00:14:05+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2149</id>
    <created>2005-09-29T00:14:05Z</created>
    <summary type="text/plain">Sony-Ericsson&apos;s Developer World has published the third article in a series about 3D programming. This is new article is about programming particle systems Here are the links to the three articles: 3D programming tutorial for mobile devices using M3G 3D...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>J2ME</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Sony-Ericsson's Developer World has published the third article in a series about 3D programming. This is new article is about programming particle systems </p>

<p>Here are the links to the three articles:</p>

<ul>
<li><a href="http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/mobilejava3d/p_java3d_tutorial_part1_compliments_redikod.jsp?link_techtips=java3d-redikodtutorialpart1">3D programming tutorial for mobile devices using M3G</a></li>
<li><a href="http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/mobilejava3d/p_java3d_tutorial_part2_compliments_redikod.jsp?link_techtips=java3d-redikodtutorialpart2">3D programming tutotial part two: Light 3D theory and orientation</a></li>
<li><a href="http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/mobilejava3d/p_java3d_tutorial_part3_compliments_redikod.jsp?link_techtips=java3d-redikodtutorialpart3">3d programming tutorial part three: particle systems and immediate mode rendering</a></li>
</ul>

<p>Sun Developer Network has published the second article in a series about ecryption in MIDP</p>

<ul>
<li><a href="http://developers.sun.com/techtopics/mobility/midp/articles/security4/">MIDP Application Scrutiry 4: Encryption in MIDP</a></li>
</ul>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[J2ME] An article about the Media API ( JSR 135 )</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002142.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-09-02T10:04:20+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2142</id>
    <created>2005-09-02T10:04:20Z</created>
    <summary type="text/plain">Motocoder, Motorola&apos;s developer center, has released an article about the JSR 135, better known as the Mobile Media API.

The article includes a working example of an application that allows to capture images by camera.

Download the article ( pdf )</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>J2ME</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p><a href="http://www.motocoder.com/motorola/pcsHome.jsp">Motocoder</a>, Motorola's developer center, has released an article about the JSR 135, better known as the Mobile Media API.</p>

<p>The article includes a working example of an application that allows to capture images by camera.</p>

<p><a href="http://trix2.cellmania.com/downloads/downloads/pdf/WP_JSR_135.pdf">Download the article ( pdf )</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[J2ME] 3D programming tutorial about light</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002140.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-08-24T18:14:44+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2140</id>
    <created>2005-08-24T18:14:44Z</created>
    <summary type="text/plain">Sony Ericsson&apos;s Developer World has published the second article in a series about &quot;3D programming for mobile devices using M3G&quot;. The tutorial is written by Mikael Baros, and contains an easy to understand introduction to working with lights when programming...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>J2ME</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Sony Ericsson's <a href="http://developer.sonyericsson.com/site/global/tipstrickscode/mobilejava3d/p_java3d_tutorial_part2_compliments_redikod.jsp?link_techtips=java3d-redikodtutorialpart2">Developer World</a> has published the second article in a series about "3D programming for mobile devices using M3G".</p>

<p>The tutorial is written by Mikael Baros, and contains an easy to understand introduction to working with lights when programming in 3D. Althought the code it contains is written in J2ME, the concepts can be easily ported to other languages.</p>

<p><a href="http://developer.sonyericsson.com/site/global/tipstrickscode/mobilejava3d/p_java3d_tutorial_part2_compliments_redikod.jsp?link_techtips=java3d-redikodtutorialpart2">Here is the link</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>An example of the memento pattern ( the java version )</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002135.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-08-04T21:50:38+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2135</id>
    <created>2005-08-04T21:50:38Z</created>
    <summary type="text/plain">Conquering the world is not easy. You and me both know it. And Professor Coupling knows it too.

He has the knowdlege, he has a plan, he has the skills, and he has even the looks, but there are a lot of little details to care for before he can finally conquer the world!!.

In previous posts, be have seen how he has implemented the prototype pattern ( to create his army of clones –hey, I’ve just noticed the joke- ), the extension objects pattern ( to assign their roles ), the command pattern ( to assign them their orders ) and the observer pattern ( to implement a communications system ). It seems that Professor Coupling has had a lot of work, but was it enough?. NO!! ( muhahahahahahaha ).</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Java</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Conquering the world is not easy. You and me both know it. And Professor Coupling knows it too.</p>

<p>He has the knowdlege, he has a plan, he has the skills, and he has even the looks, but there are a lot of little details to care for before he can finally conquer the world!!.</p>

<p>In previous posts, be have seen how he has implemented the <a href="http://www.design-nation.net/en/archives/000483.php">prototype pattern</a> ( to create his army of clones –hey, I’ve just noticed the joke- ), the <a href="http://www.design-nation.net/en/archives/000489.php">extension objects pattern</a> ( to assign their roles ), the <a href="http://www.design-nation.net/en/archives/000493.php">command pattern</a> ( to assign them their orders ) and the <a href="http://www.design-nation.net/en/archives/000549.php">observer pattern</a> ( to implement a communications system ). It seems that Professor Coupling has had a lot of work, but was it enough?. NO!! ( muhahahahahahaha ).</p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>If you remember the post about the observer pattern ( and I doubt you can remember it, because I don’t ), we left our cows and sheeps in the instant previous to the final attack to conquer the world ( while Professor Coupling laughed histerically ). ( insert heroic music in the background ) They are waiting to receive the order to attack. Each cow and each sheep is on alert, listening to the radio, waiting to hear the secret signal, and to abandon their position and follow the orders they received.</p>

<p>Professor Coupling is just going to press the "attack" button, when suddenly he notices something ( and suddenly the heroic music stops ). “What if I have to send the “retreat” order to all my troops?. It’s not that my plan is going to fail ( I’m an evil genius after all ), but you know, you can’t count on your subordinates, so what would happen if I had to cancel the attack when my army has started its advance ( glorious advance, of course )?”. </p>

<p>Definitively, he is a genius. He has noticed a very subtle “bug” in his plan. What happens if he has to order his troops to cancel the attack once they have left their original positions?. Well, he has implemented a communications system, so he can send the retreat-secret-singal to all his soldiers, can’t he?. ( muhahahahahahhaha, you know ). But, cows and sheeps are well know for their lack of memory. They are also known for the quality of the cheese that can be made with their milk, but that is out of the scope of this tutorial.</p>

<p>The point is: a cow has no memory. A sheep has no memory. Period. They can just remember one thing. So they can remember that they have to attack, or to move somewhere, but as soon as they put that information into their brain, they are not able to remember anything else ( like, for instance, where they were five minutes before, or if they borrowed something from someone else ).</p>

<p>So, Professor Coupling can tell them to go back to their initial position, but that’s completely useless, before they can not remember where their initial position was.</p>

<p><img alt="memento1.jpg" src="http://www.design-nation.net/en/archives/memento1.jpg" width="349" height="279" /></p>


<p>But ( switch the heroic music on again, please ), Professor Coupling vaguely remembers when he was a young student, and he also vaguely remembers when he read about the memento pattern.</p>

<p>What if every sheep and every cow write down on a notebook their initial position ( the only thing they remember ), and give that notebook to their Sergeant?. What if the sergeant takes care of those notebooks, and give them back to their owners if they have ( the owners ) to go back to their initial position?. Problem solved!! ( muhahahahahahha ). That’s perfect!!. The sheeps and cows will only have to remember one position ( the position where they are supposed to go, no matter if they are attacking or retreating ), while an external entity will take care of that information.</p>

<p><img alt="memento2.jpg" src="http://www.design-nation.net/en/archives/memento2.jpg" width="397" height="258" /></p>

<p>How could a sheep store that information on a notebook?. Easy. Every sheep will be able to create an instance of a class to store that information.</p>

<code language="java">
package sheep;

public class SheepMemento
{
private int 	serialNumber;
private String 	location;
    
public SheepMemento( int serial, String loc )
{
serialNumber = serial;
location 	= loc;
}

public setLocation( String newLocation )
{
location = newLocation;
}

public String getLocation( )
{
return location;
}

}

</code>

<p>But wait!!!. Professor Coupling has noticed that there is a potential flaw in his plan. If the Sergeant takes care of all the initial positions of all the sheeps, there is a big security risk, because what happens if that information is stolen by the pesky enemy?. Well, the pesky enemy will have access to a lot of information about the Professor’s plan. Or even worst!!!. The pesky enemy could change that information!!!!. But wait, again!!. If the information that the Sergeant stores is encrypted, or is only accessible to the sheeps, the problem is solved, nobody could change that information!.</p>

<p>So, to avoid the changes in that information, Professor Coupling will do two different things. First of all, the fields in the SheepMemento class could only be set through the constructor. That’s the way to ensure that those values can only be set when the class is created, and no later.</p>

<code language="java">
package sheep;

public class SheepMemento
{
private int 	serialNumber;
private String 	location;
    
public SheepMemento( int serial, String loc )
{
serialNumber = serial;
location 	= loc;
}
}
</code>

<p>But unfortunately, that’s not enough ( it’s so difficult to have a really good plan ). Professor Coupling wants to avoid that the information stored in the memento could be changed by anybody. In fact, he wants that only a sheep could create its memento, and could set its data. So, he can be sure that nobody could interfere or obscure the information stored in the memento.</p>

<p>Doing that in Java is easy. Professor Coupling simply puts the memento class in the same package than the sheep, and makes its constructor and its fields protected. That way, only the sheeps could create mementos and assign their values.</p>

<p>So, the sheep package will contain the two following classes ( first of all the Sheep class ):</p>

<code language="Java">
package sheep;

public class Sheep
{
private int 	serialNumber;
private String 	location;
    
public Sheep( int serial, String loc )
{
serialNumber 	= serial;
location 		= loc;
}
    
public SheepMemento getMemento( )
{
return new SheepMemento( serialNumber, location );
}
    
public void setMemento( SheepMemento memento )
{
serialNumber	= memento.serialNumber;
location		= memento.location; 	
}
    
public void setLocation( String newLoc )
{
location = newLoc;
}
    
public String getLocation( )
{
return location;
}
    
public String toString( )
{
return "Sheep: serialNumber " + serialNumber + " location " + location;
}
}
</code>

<p>The SheepMemento class will be:</p>

<code language="Java">
package sheep;

public class SheepMemento
{
protected int 	serialNumber;
protected String 	location;
    
protected SheepMemento( int serial, String loc )
{
serialNumber = serial;
location 	= loc;
}
}
</code>

<p>And finally, the Sergeant:</p>

<code language="Java">
package sergeant;

import sheep.Sheep;
import sheep.SheepMemento;

public class Sergeant
{
        
public void attack( )
{
Sheep mySheep = new Sheep( 1, "here" );
        
SheepMemento initState = mySheep.getMemento( );
        
System.out.println( "initial position" );
System.out.println( mySheep );
        
System.out.println( "change its position" );
mySheep.setLocation( "there" );
        
System.out.println( "final position" );
System.out.println( mySheep );
        
System.out.println( "retreat!" );
mySheep.setMemento( initState );
        
System.out.println( mySheep );
}
    
    
public static void main( String[] args )
{
Sergeant sergeant = new Sergeant( );
        
sergeant.attack( );
}
}

</code>


<p>Muhahahahahahahahaha. Professor Coupling has done it again!!. He has been able to encapsulate the internal state of an object, put it in another object, and encapsulate it so well that it can only be retrieved by the object that created that package.</p>]]>
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>Apple drops Cocoa-Java</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002132.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-07-20T10:58:18+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2132</id>
    <created>2005-07-20T10:58:18Z</created>
    <summary type="text/plain">The last update of the ADC technical documentation says &quot;Important: Features added to Cocoa in Mac OS X versions later than 10.4 will not be added to the Cocoa-Java programming interface. Therefore, you should develop Cocoa applications using Objective-C to take advantage of existing and upcoming Cocoa features.&quot;. 

It says it loud and clear. If you want to develop powerful applications, you will have to forget about Java. 

In theory, it was possible to develop Cocoa applications both in Objective-C or in Java, altough the performance of the Java applications was far behind the performance of those written in Objective-C. From now on, there&apos;s only one choice.

Here&apos;s the link to the document: aquí

Via OSNews</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Java</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>The last update of the ADC technical documentation says "Important: Features added to Cocoa in Mac OS X versions later than 10.4 will not be added to the Cocoa-Java programming interface. Therefore, you should develop Cocoa applications using Objective-C to take advantage of existing and upcoming Cocoa features.". </p>

<p>It says it loud and clear. If you want to develop powerful applications, you will have to forget about Java. </p>

<p>In theory, it was possible to develop Cocoa applications both in Objective-C or in Java, altough the performance of the Java applications was far behind the performance of those written in Objective-C. From now on, there's only one choice.</p>

<p>The link to the document: <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/LanguageIntegration/index.html">here</a></p>

<p>Via <a href="http://www.osnews.com/story.php?news_id=11165">OSNews</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>[J2ME] Nokia Announces Next Generation Java Platform For Series 60</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002131.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-06-30T13:01:02+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2131</id>
    <created>2005-06-30T13:01:02Z</created>
    <summary type="text/plain">Nokia announces that the next generation of the Series 60 devices will support the Connected Device Configuration. Read the press release...</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>J2ME</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>Nokia announces that the next generation of the Series 60 devices will support the Connected Device Configuration.</p>

<p><a href="http://press.nokia.com/PR/200506/1000239_5.html">Read the press release</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>Prevalence</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002128.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-06-11T23:57:55+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2128</id>
    <created>2005-06-11T23:57:55Z</created>
    <summary type="text/plain">I guess this post will not mean too much to the experienced Java developers out there, but this is something that I&apos;ve found interesting.

onjava.com has posted an article about Prevailer. Prevailer is a framework that provides a prevalence layer for Java applications. But what does that mean?.

Instead of using a database or the native serialization mechanism, a prevalent system will take periodic screenshots of its state, and serialize them. Also, it will use command objects to perform the transactions that change the system state, and serialize them. That way, it ensures that the system is consistent.

Anyway, the article by Jim Paterson provides a complete example of implementation:

Prevalence: Transparent, Fault-Tolerant Object Persistence</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Java</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>I guess this post will not mean too much to the experienced Java developers out there, but this is something that I've found interesting.</p>

<p><a href="http://www.onjava.com">onjava.com</a> has posted an article about <a href="http://www.prevayler.org/">Prevailer</a>. Prevailer is a framework that provides a prevalence layer for Java applications. But what does that mean?.</p>

<p>Instead of using a database or the native serialization mechanism, a prevalent system will take periodic screenshots of its state, and serialize them. Also, it will use command objects to perform the transactions that change the system state, and serialize them. That way, it ensures that the system is consistent.</p>

<p>Anyway, the article by Jim Paterson provides a complete example of implementation:</p>

<p><a href="http://www.onjava.com/pub/a/onjava/2005/06/08/prevayler.html?page=1">Prevalence: Transparent, Fault-Tolerant Object Persistence</a></p>]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      
  </MTMacroApply>


    </content>
  </entry>
  <entry>
    <title>An example of the Observer pattern (the java version)</title>
    <link rel="alternate" type="text/html" href="http://www.design-nation.net/en/archives/002125.php" />
    <modified>2007-01-20T12:55:22Z</modified>
    <issued>2005-06-02T15:50:00+00:00</issued>
    <id>tag:www.design-nation.net,2005:/en//4.2125</id>
    <created>2005-06-02T15:50:00Z</created>
    <summary type="text/plain">Be aware!. Professor Coupling and his army of clones are ready!.The final attack is going to be launched quite soon!.  And their weapons are actionScript and design patterns!

In the previous posts, we’ve seen how Professor Coupling is able to clone any animal, and how he’s able to assign different roles to those clones. Oh, and he has also found the way to assign any animal its orders. Muhahahahahaha</summary>
    <author>
      <name>Cesar Tardaguila</name>
      <url>http://www.design-nation.net</url>
      <email>cesar.tardaguila@design-nation.net</email>
    </author>
    <dc:subject>Java</dc:subject>
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.design-nation.net/en/">



</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[Be aware!. Professor Coupling and his army of clones are ready!.The final attack is going to be launched quite soon!.  And their weapons are actionScript and design patterns!

In the previous posts, we’ve seen how Professor Coupling <a href="http://www.design-nation.net/en/archives/000483.php">is able to clone any animal</a>, and how <a href="http://www.design-nation.net/en/archives/000489.php">he’s able to assign different roles</a> to those clones. Oh, and he has also found the way <a href="http://www.design-nation.net/en/archives/000493.php">to assign any animal its orders</a>. Muhahahahahaha]]>
  </MTMacroApply>




</MTCodeBeautifier>
</MTMacroDefine>
  
      <![CDATA[<p>First of all, remember: Professor Coupling is crazy, but he’s not an idiot. He knows that maybe, his evil plan has some weak points, that maybe, there could be some mistakes. And he also knows that sometimes it’s better to go back to the starting point to gather some strength and launch a new attack ( well, you know, it’s not easy to conquer the world ). He wants to be able to tell his troops to cancel the attack if something goes wrong ( you know, please insert some hysterical laughs here ) .</p>

<p>So, he has equipped his troops with the newest model of EnigmaRadio ( enigmawoot!!??? ). The EnigmaRadio is the last invention of Professor Coupling’s evil genius, and basically it’s, well, a radio receiver, that is cheaper than an iPod. Not as cool as an iPod, but cheaper.</p>

<p>But why? Why would a sheep or a cow need a radio?. Well, conquering-the-world-battles are noisy. It’s not easy to communicate with your troops when you are in the middle of such destruction. There’s noise, there’s dust, fog… In fact, sometimes, you might be thinking that you are giving an order to a sheep, but you are talking to a cow. Well, a complete mess. And, of course, Professor Coupling is aware of all these communication problems.</p>

<p>Professor Coupling has been using his evil genius to find a solution. The solution he has found ( muhhhahahahahahah ) has been to assign a cow the responsibility of propagating his orders. In plain English, there will be a cow ( Corporal Cow ) whose duty will be to run all the way to the trenches, and then, one by one, give all the cows and sheeps the new orders. Brilliant!!!!.</p>

<p>Well, not so brilliant. What if someone kills ( sorry, gratuite violence again ) Corporal Cow when he still hasn’t given the new orders to all the soldiers?. </p>

<p>And so, Professor Coupling, once again, remembered when he was a young student, and the happy times when he studied the Observer pattern.</p>

<p>That’s why Professor Coupling, who is crazy but is not an idiot, has equipped all his troops with the latest model of  the EnigmaRadio. The EnigmaRadio will we tuned to BBC Radio 4 ( why not? ). So, his troops will charge against the enemy with their radios switched on, and as soon as they hear "In the navy", by Village People, they will now that it’s time to go back to their starting position.</p>

<p><img alt="enigmaBroadcaster.jpg" src="http://www.design-nation.net/es/archivos/enigmaBroadcaster.jpg" width="400" height="277" /><br/>Dj Coupling broadcasting his program</p>

<p>The code will be something like this:</p>

<code language="Java">
public interface IObserver
 {
public void update(Message info);
}
</code>
<p></p>
<code language="Java">
public interface ISubject 
{
public void addObserver(IObserver obs);
public void removeObserver( IObserver obs );
public void notifyObserver( );
}
</code>

<p></p>

<code language="Java">
public class Cow implements IObserver
{
public Cow( )
{
debug("Soy una vaca  muuuuuu| I am a cow Muuuu");
}
	
private void debug( String arg )
{
System.out.println("Vaca | Cow :-> "+arg );
}
	
public void update( Message msg )
{
debug("Actualizada | update ");
String kk = msg.getMsg();
debug("msgText: "+kk );
}
	
}
</code>

<p></p>

<code language="Java">
public class Sheep implements IObserver
{
	
public Sheep( )
{
debug("creada la oveja | a new sheep");
}
	
private void debug( String arg )
{
System.out.println("Oveja |Sheep :-> "+arg );
}
	
public void update( Message msg )
{
debug("Actualizada | update ");
String kk = msg.getMsg();
debug("msgText: "+kk );
}
}

</code>

<p>The message:</p>

<code language="Java">
public class Message {
String msg = "";
	
public void setMsg( String arg )
{
this.msg = arg;
}
	
public String getMsg( )
{
return this.msg;
}
}

</code>

<p></p>

<code language="Java">

public class Profesor implements ISubject
{
private ArrayList misObservers;
private Message miMsg;
	
public Profesor( )
{
//System.out.println("profesor profesor");
debug("Creando al profesor | a new Profesor");
misObservers = new ArrayList();
}
	
public void debug( String arg )
{
System.out.println("Profesor:-> "+arg);
}
	
public void addObserver( IObserver obs )
{
debug("añadido observer | a new observer");
misObservers.add(obs);
debug("Ya tengo | I have: "+misObservers.size()+" observers ");
}
	
public void removeObserver( IObserver obs)
{
debug("eliminado observer | removing observer");
//int value = indexOf
misObservers.remove(misObservers.indexOf(obs));
debug("ahora me quedan | now i have : "+misObservers.size()+" observers ");
}
	
public void notifyObserver( )
{
debug("notificar observers | notify observer ");
miMsg = new Message( );
miMsg.setMsg("In the Navy");
for( int i = 0; i < misObservers.size(); i++ )
{
IObserver obs = ( IObserver )misObservers.get(i);
		
			
obs.update( miMsg );
}
}
	
}

</code>

<p>And finally</p>

<code language="Java">
public class ObserverSample
 {
public static void main(String[] args)
 {
Profesor prof = new Profesor();
Sheep firstSheep = new Sheep();
Cow firstCow = new Cow();
Sheep secondSheep = new Sheep( );
Cow secondCow = new Cow( );
Sheep thirdSheep = new Sheep();
Cow thirdCow = new Cow();
		
prof.addObserver( firstsheep );
prof.addObserver( secondSheep );
prof.addObserver( thirdSheep );
prof.addObserver( firstCow );
prof.addObserver( secondCow );
prof.addObserver( thirdCow );
prof.removeObserver( firstSheep );
prof.notifyObserver( );
		
}
}
</code>

<p>Muhahahahahahhahahahaha ( almost half an hour of hysterical laughs ). Professor Coupling has found a quick and reliable way of sending messages to his troops. It’s perfect!! Well, really?. Maybe it’s not so perfect.</p>

<p>Imagine that, for instance, Professor Coupling wants his soldiers to report back when they receive the new orders. Or imagine that Professor Coupling can infiltrate a sheep into the enemy’s headquarters. That spy could not communicate with Professor Coupling to tell him when the perfect moment to launch the attack comes!!!.</p>

<p>But, Professor Coupling, who is crazy but is not an idiot, has previously thought about it, and has decided to implement a mechanism in the EnigmaRadio that could serve his troops to communicate back with him.  So, the spy sheep, as soon as it discovers the enemy’s weakest point, could phone the EnigmaRadio base station and ask them to broadcast Boney M’s "Rasputin" ( their secret "attttttaaaaaaaaaaaaaack" signal ). So, when Professor Coupling’s troops hear "Rasputin" through their EnigmaRadio, they will know that the moment has come, that it will be the moment to launch the final attack. </p>

<p><img alt="enigmaReceiver.jpg" src="http://www.design-nation.net/es/archivos/enigmaReceiver.jpg" width="400" height="271" /><br/>A sheep singing "In the Navy"</p>

<p>So, Professor Coupling will have to change his code a bit ( but he doesn’t care, listen: "Muhahahahahahahaaaaa" ). He will start adding a new method ( requestInfo ) to the ISubject interface . That method will allow his radio station to receive the telephone calls from the Spy Sheep. He has also changed the constructor of the Cow and Sheep classes.</p>

<code language="Java">
public interface ISubject
 {
public void addObserver(IObserver obs);
public void removeObserver( IObserver obs );
public void notifyObserver( Message msg );
public void requestInfo( String arg  );
}
</code>

<p></p>
<code language="Java">
public class Cow implements IObserver
{
public Cow( )
{
debug("Soy una vaca | I am a cow ");
}
	
private void debug( String arg )
{
System.out.println("Vaca | Cow :-> "+arg );
}
	
public void update( Message info )
{
debug("Actualizada | update ");
debug(" -> "+ info.getMsg());
}
	
}

</code>

<p></p>

<code language="Java">
public class Sheep implements IObserver
{
private ISubject profesor;
public Sheep(ISubject isub )
{
debug("creada la oveja | a new Sheep");
this.profesor = isub;
this.profesor.addObserver(this);
this.profesor.requestInfo( "Rasputin" );
}
	
private void debug( String arg )
{
System.out.println("Oveja | Sheep:-> "+arg );
}
	
public void update( Message info )
{
debug("Actualiz·ndome | update");
debug( " -> "+info.getMsg());
}
}

</code>

<p></p>

<code language="Java">

import java.util.ArrayList;

public class Profesor implements ISubject
{
private ArrayList misObservers;
	
public Profesor( )
{
//System.out.println("profesor profesor");
debug("Creando al profesor | a new profesor");
misObservers = new ArrayList();
}
	
public void debug( String arg )
{
System.out.println("Profesor :-> "+arg);
}
	
public void addObserver( IObserver obs )
{
debug("añadido observer | a new observer");
misObservers.add(obs);
debug("Ya tengo | I have: "+misObservers.size()+" observers ");
}
	
public void removeObserver( IObserver obs)
{
debug("eliminado observer | removing observer");
misObservers.remove(misObservers.indexOf(obs));
debug("ahora me quedan | now i have: "+misObservers.size()+" observers ");
}
	
public void notifyObserver(Message msg )
{
debug("notificar observers | notify observers");
for( int i = 0; i < misObservers.size(); i++ )
{
IObserver obs = ( IObserver )misObservers.get(i);
obs.update( msg );
}
}
	
public void requestInfo( String arg )
{
debug("recibiendo una petición | someone has asked for ...");
Message msg = new Message( );
msg.setMsg( arg ); 
this.notifyObserver( msg );
}
	
}

</code>

<p>And finally: </p>

<code language="Java">
public class ObserverSample
 {

public static void main(String[] args) {
Profesor dispar = new Profesor();
Sheep oveja = new Sheep( dispar );
		
}
}
</code>

<p>A quick note: Professor Coupling knows about the existance of the java.util.Obervable class and the java.uti.Observer interface. But he didn't want to extend Obervable, because he extends a long list of evil geniuses. That's why he has decided to build his own ISubject interface. He could have used the Oberver interface as the base class for the cows and sheep, but you know, that's the way evil geniuses are...</p>

<p>All these classes have been simplified to the maximum, because we just wanted to show how the pattern works, and to show that Professor Coupling is an evil genius, but he’s not an idiot ( the image fades to black, and "The End" appears ).</p>

<p>And remember, Professor Coupling is spanish, and a bit lazy, so he's left some comments in his mother tongue...</p>


<p>You can download the source code <a href="http://www.design-nation.net/en/archives/observer_java.rar">here</a></p>]]>
  </MTMacroApply>


    </content>
  </entry>

</feed>