<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>simonpena.com &#187; design</title>
	<atom:link href="http://simonpena.com/blog/tag/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://simonpena.com/blog</link>
	<description>Una mezcla heterogénea de tecnología y desvaríos</description>
	<lastBuildDate>Tue, 11 Oct 2011 19:14:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Undo, redo support using patterns</title>
		<link>http://simonpena.com/blog/proyectos/pennybank/undo-redo-support-using-patterns/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=undo-redo-support-using-patterns</link>
		<comments>http://simonpena.com/blog/proyectos/pennybank/undo-redo-support-using-patterns/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 17:49:12 +0000</pubDate>
		<dc:creator>Simón</dc:creator>
				<category><![CDATA[Pennybank]]></category>
		<category><![CDATA[Command Pattern]]></category>
		<category><![CDATA[Composite Pattern]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[implementation]]></category>
		<category><![CDATA[Template method Pattern]]></category>

		<guid isPermaLink="false">http://pennybank.wordpress.com/?p=65</guid>
		<description><![CDATA[More report progress regarding undo, redo and execute using design patterns.<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/undo-redo-support-using-patterns/' addthis:title='Undo, redo support using patterns '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p>This Easter Week has been very productive. Although I didn't upload the screenshots as I said, I've made several interesting improvements.</p>
<ul>
<li>The delete menu item changes according to the current user interface selection. If an account is selected, it displays <em>delete account</em>. If an user is selected, it displays <em>delete user</em>, and if an account operation is selected, it displays <em>delete account operation</em>.</li>
<li>It is possible to undo/redo the actions made. The major improvement I pointed out on the previous post is almost done, so you can reverse the addition, edition and deletion of users, accounts and account operations.</li>
</ul>
<p>I've made a new hierarchy in the controller layer. I created the interface <a title="UIAction.java" href="http://code.google.com/p/pennybank/source/browse/trunk/src/main/java/com/googlecode/pennybank/swing/controller/actions/UIAction.java" target="_blank">UIAction</a>, with methods <em>execute</em>, <em>undo</em>, <em>redo</em> and <em>getName</em>. I created an abstract implementation, <a title="GenericAction.java" href="http://code.google.com/p/pennybank/source/browse/trunk/src/main/java/com/googlecode/pennybank/swing/controller/actions/GenericAction.java" target="_blank">GenericAction</a>, where I made <em>final</em> those methods -to avoid the concrete classes reimplementing them-, calling <em>doExecute</em>, <em>doUndo,</em> <em>doRedo</em> and <em>doGetName</em> (which currently doesn't make much sense), followed by a call to update (a private method which updates the information displayed on the main window).</p>
<p>The do<em>Wathever</em> methods are <em>protected</em> and <em>abstract</em>, so the actions extending GenericAction must override them. This way, each action implements its own behavior for that methods, but at the same time complying with the generic behavior without the an explicit call to <em>super</em>. It follows the <a title="Template method pattern" href="http://en.wikipedia.org/wiki/Template_method_pattern" target="_blank">Template method pattern</a>.</p>
<p>Besides, I made a <a title="CompositeAction.java" href="http://code.google.com/p/pennybank/source/browse/trunk/src/main/java/com/googlecode/pennybank/swing/controller/actions/CompositeAction.java" target="_blank">CompositeAction</a> class, following the <a title="Composite pattern" href="http://en.wikipedia.org/wiki/Composite_pattern" target="_blank">Composite pattern</a>, so several actions can be grouped into another.</p>
<p>This way, all the defined actions are commands, and the application itself has the responsibility of executing them. Whenever an action is executed, it is stored in an <em>undoable actions stack</em>, and its name is set in the edit menu, so you can read "Undo <em>actionName</em>". If you undo the action, the application takes it out from the stack, invokes its <em>undo </em>method, and adds it to the <em>redoable actions stack</em>. After that, its name will appear in the edit menu, displaying "Redo <em>actionName</em>". Again, if you redo the action, the application takes it out from that stack and invokes its <em>redo</em> method, adding it again to the <em>undoable actions stack</em>. And over and over again (as far as it is well implemented).</p>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/undo-redo-support-using-patterns/' addthis:title='Undo, redo support using patterns '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonpena.com/blog/proyectos/pennybank/undo-redo-support-using-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some (unasked) explanations</title>
		<link>http://simonpena.com/blog/proyectos/pennybank/some-unasked-explanations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=some-unasked-explanations</link>
		<comments>http://simonpena.com/blog/proyectos/pennybank/some-unasked-explanations/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 00:11:42 +0000</pubDate>
		<dc:creator>Simón</dc:creator>
				<category><![CDATA[Pennybank]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://pennybank.wordpress.com/?p=52</guid>
		<description><![CDATA[In occasions, the amount of time spent actually developing an application is less than the time spent thinking how to do it.<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/some-unasked-explanations/' addthis:title='Some (unasked) explanations '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p>When I started  developing PennyBank, the first decision I faced was the programming language I should use. I wanted something that looked integrated in the system, like iTunes, Mail, iCal... The first choice was obviously  <a title="Objective-C" href="http://en.wikipedia.org/wiki/Objective-C" target="_blank">Objective-C</a>, with the interface done in <a title="Interface Builder" href="http://developer.apple.com/tools/interfacebuilder.html" target="_blank">Interface Builder</a>. I had followed a small tutorial, and doing a trivial application (a calculator, I think) had showed me how good its visual programming was.</p>
<p>In my job I work using <a title="C# Programming Language" href="http://en.wikipedia.org/wiki/C_Sharp_(programming_language)" target="_blank">C#</a> with <a title="Visual Studio" href="http://msdn.microsoft.com/en-us/vstudio/default.aspx" target="_blank">Visual Studio 2008</a>. I can develop <a title="Graphical user interface" href="http://en.wikipedia.org/wiki/Graphical_user_interface" target="_blank">GUIs</a> real quickly, without having to withdraw time from what it is usually more important: the business logic. Here, I wanted more or less the same. I wanted a language which could let me focus on the logic without too many headaches when doing the GUI. So Objective-C seemed the right option, as there was that Interface Builder tool. But after just some searches in Google, I realized that I wouldn't be able to get the application done if I chose a language I was not familiar with.</p>
<p>And so I chose Java. I've done many small apps in Java when I was studying, so I feel quite familiar with it. Besides, I wanted to try <a title="Hibernate" href="http://www.hibernate.org/" target="_blank">Hibernate</a>, so this seemed a very good excuse. The other reason to choose Java was SWT. Some friends and I developed an application last year using <a title="The Standard Widget Tool" href="http://www.eclipse.org/swt/" target="_blank">SWT</a>. We were targeting Windows, but I recall reading that SWT was "the ultimate Java interface" in terms of native <a title="Look and feel" href="http://en.wikipedia.org/wiki/Look_and_feel" target="_blank">Look &amp; Feel</a> integration. As our application got to look great in Windows, I started coding in Java with the idea that SWT would save all my problems.</p>
<p>I was wrong. After two weeks developing the model layer with Hibernate, I wrote the first lines of code for the GUI. It was quite strange: I needed several days to notice that something was going wrong. The first days it was due to the following: <em> </em></p>
<blockquote><p><em>The special VM option     <strong><tt>-XstartOnFirstThread</tt></strong> is also required for SWT applications     to run properly on the Mac.</em></p></blockquote>
<p>It is stated clearly in the <a title="Deploying SWT Applications on Mac OS X" href="http://www.eclipse.org/swt/macosx/" target="_blank">Mac OS X section</a> of their page, but somehow I didn't read it, experiencing some real awful exceptions until I found it. After that, I had several issues that almost have PennyBank development stopped. First of all was the lack of a good Visual Editor in Eclipse. OK, there was the <a title="Visual Editor plug-in" href="http://www.eclipse.org/vep/WebContent/main.php" target="_blank">Visual Editor plug-in</a> , but I wasn't able to get it working:  its support seemed to have been dropped off, and there was no sign of activity in its section for the last two years (Jump <a href="#veplugin">here</a> if you don't want to read the rest and want to find which solution I found). After that, I wrote the first example of a toolbar.</p>
<p>It was... weird. I was looking at the main window, knowing that something wasn't right, but unable to tell what it was. The toolbar! This was NOT an OS X toolbar!After that, I knew that I had no reason to keep using SWT, as it wasn't giving me the integration I was expecting, nor it was giving me any ease of visual programming. I found a blog where someone built an  <a title="Making SWT look more native on Mac OS" href="http://blog.laurentm.com/2008/07/making-swt-look-more-native-on-mac-os/">unified tool bar using SWT</a>, but it looked too much of a hacking for me. So I moved to <a title="Netbeans" href="http://www.netbeans.org/" target="_blank">Netbeans</a>: I knew it had a <a title="Matisse on Netbeans" href="http://www.netbeans.org/kb/trails/matisse.html" target="_blank">tool for writing GUIs</a> so even if I would be coding a <em>not-so-nice</em> application, at least it would be faster.</p>
<p>Using <a title="Maven" href="http://maven.apache.org/" target="_blank">Maven</a> proved here to be a very wise decision: migrating from an IDE to the other was painless. But I didn't stay with Netbeans too much: after an strange problem with Subversion, I moved back to <a title="Eclipse" href="http://www.eclipse.org/" target="_blank">Eclipse</a>. At the beginning, I even thought about developing the interface by hand. Fortunately, I found a better solution.</p>
<p><a name="veplugin"></a>Even if the plug-in was officially unsupported, in <a title="Visual Editor plug-in" href="http://wiki.eclipse.org/VE/Update" target="_blank">this page</a> a link is provided to have it working under the last Eclipse build. Now that I was able to do visual programming, the only point missing was the so much wanted operative system integration.</p>
<p>So I started searching for <em>"Java OS X integration"</em>, finding lots of resources... until I found The One. <a title="Exploding Pixels" href="http://explodingpixels.wordpress.com/" target="_blank">Exploding Pixels</a> writer has developed <a title="Mac Widgets for Java" href="http://code.google.com/p/macwidgets/" target="_blank">Mac Widgets for Java</a>: some great widgets which gives the application a native look and feel. Another <em>must have</em> link is the <a title="Java Development Guide for Mac OS X" href="http://developer.apple.com/documentation/Java/Conceptual/Java14Development/index.html" target="_blank">Java Development Guide for Mac OS X</a>. With this one and the <a title="Apple Human Interface Guidelines" href="http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/index.html" target="_blank">Apple Human Interface Guidelines</a> I think I have all the technical information I need.</p>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/some-unasked-explanations/' addthis:title='Some (unasked) explanations '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonpena.com/blog/proyectos/pennybank/some-unasked-explanations/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Classifying account operations</title>
		<link>http://simonpena.com/blog/proyectos/pennybank/classifying-account-operations/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=classifying-account-operations</link>
		<comments>http://simonpena.com/blog/proyectos/pennybank/classifying-account-operations/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 23:06:20 +0000</pubDate>
		<dc:creator>Simón</dc:creator>
				<category><![CDATA[Pennybank]]></category>
		<category><![CDATA[classifying]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[operations]]></category>

		<guid isPermaLink="false">http://pennybank.wordpress.com/?p=22</guid>
		<description><![CDATA[Some thoughts about how to classify the account operations, keeping the code simple enough, but without taking any flexibility from the user<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/classifying-account-operations/' addthis:title='Classifying account operations '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></description>
			<content:encoded><![CDATA[<p>One of the things that made me start coding PennyBank was the idea of classifying account operations in various ways. I first thought about using categories, and letting the user add several ones to an account operation. That could be quite flexible, but after some time thinking, I realized that an account operation is most times classified in just one category: another question is if that category is a subcategory of another one more general.(If I buy a video game, this could be classified in the <em>"video games"</em> category, in the <em>electronic</em> category or even in a more general <em>"spare time"</em>. But it appears to me that there is a hierarchy relationship between those categories )</p>
<p>Having just one category  looked enough for me, until I realized that sometimes you may want to highlight, someway, an operation. And that could be done using <em>tags</em>. They should be different from categories, being a more specific way to filter operations, but making easier to develop the application core.</p>
<p>So, right now, this is the selected choice. One operation could be categorized or not, but should be classified in just one category. Categories, themselves, can be arranged hierarchically. And finally, operations can be tagged with multiple tags.</p>
<div class="addthis_toolbox addthis_default_style " addthis:url='http://simonpena.com/blog/proyectos/pennybank/classifying-account-operations/' addthis:title='Classifying account operations '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_button_google_plusone" g:plusone:size="medium"></a><a class="addthis_counter addthis_pill_style"></a></div>]]></content:encoded>
			<wfw:commentRss>http://simonpena.com/blog/proyectos/pennybank/classifying-account-operations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

