<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>presenter-first &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/presenter-first/</link>
	<description>Feed of posts on WordPress.com tagged "presenter-first"</description>
	<pubDate>Tue, 22 Dec 2009 13:31:37 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Smalltalk Presenter First - Parte 1]]></title>
<link>http://chicoary.wordpress.com/2008/02/07/smalltalk-presenter-first-parte-1/</link>
<pubDate>Thu, 07 Feb 2008 08:46:53 +0000</pubDate>
<dc:creator>chicoary</dc:creator>
<guid>http://chicoary.wordpress.com/2008/02/07/smalltalk-presenter-first-parte-1/</guid>
<description><![CDATA[Lendo o artigo Big Complex, and tested? Just say &#8220;When&#8221; me animei a escrever código em S]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Lendo o artigo <a href="http://atomicobject.com/files/BigComplexTested_Feb07.pdf" target="_blank"><em>Big Complex, and tested? Just say &#8220;When&#8221;</em></a> me animei a escrever código em Smalltalk para exercitar as idéias relativas ao método Presenter First e organização do código no estilo Model, View, Presenter. Iniciei um projeto simples para evitar me meter com complicações da interface gráfica com Morphs. A idéia é exibir um quadrado (um Morph) que vá mostrando as cores na sequência de cores <em>red, green, blue</em>, conforme se clica com o botão esquerdo do mouse (<em>red button</em> no jargão dos <em>smalltalkers</em>).</p>
<h4>Começando com o Presenter primeiro</h4>
<p><a title="rgbsquarepresentercreation.png" href="http://chicoary.wordpress.com/files/2008/02/rgbsquarepresentercreation.png"><img src="http://chicoary.wordpress.com/files/2008/02/rgbsquarepresentercreation.png" alt="rgbsquarepresentercreation.png" /></a></p>
<p>O presenter mantém referências para <em>model</em> e <em>view</em>.</p>
<p>A classe RGBSquarePresenter conterá apenas a inicialização conforme abaixo:</p>
<p><a title="rgbsquarepresenter-initializeevents1.png" href="http://chicoary.wordpress.com/files/2008/03/rgbsquarepresenter-initializeevents1.png"><img src="http://chicoary.wordpress.com/files/2008/03/rgbsquarepresenter-initializeevents1.png" alt="rgbsquarepresenter-initializeevents1.png" /></a></p>
<p>O código acima expressa a <em>user story</em> até agora (<em>quando</em><em> o botão esquerdo for pressionado mudar a cor  na interface do usuário para a próxima cor na sequência red green blue</em>)   , no estilo idiomático &#8220;say when&#8221;, decomposta em dois eventos:</p>
<ul>
<li><em>Quando o botão esquerdo for pressionado mudar a cor no modelo para a próxima cor na sequência red green blue; </em></li>
<li><em>Quando a cor no modelo for alterada atualizar a cor na interface do usuário.</em></li>
</ul>
<blockquote><p>Nota: Os eventos nas user stories devem ser denominados com nomes de alto nível. No código na interface do usuário será feita a tradução dos eventos de baixo nível para os de alto nível: <em>#redButtonPressed</em> para <em>#nextColor</em>, como veremos adiante.</p></blockquote>
<p>Podemos extrair os eventos e as interfaces necessários para a <em>view</em> e o <em>model</em> inspecionando <em>initializeEvents.</em></p>
<h4>Criando os testes do <em>model primeiro<br />
</em></h4>
<p>Dentro da filosofia <em>test first v</em>amos criar os testes para a classe do <em>model:</em></p>
<p><a title="presenterfirstmodeltestcase.png" href="http://chicoary.wordpress.com/files/2008/02/presenterfirstmodeltestcase.png"><img src="http://chicoary.wordpress.com/files/2008/02/presenterfirstmodeltestcase.png" alt="presenterfirstmodeltestcase.png" /></a></p>
<p><a title="testcoloraftercreation.png" href="http://chicoary.wordpress.com/files/2008/03/testcoloraftercreation.png"><img src="http://chicoary.wordpress.com/files/2008/03/testcoloraftercreation.png" alt="testcoloraftercreation.png" /></a></p>
<p><a title="testfirstnextcolorcall.png" href="http://chicoary.wordpress.com/files/2008/03/testfirstnextcolorcall.png"><img src="http://chicoary.wordpress.com/files/2008/03/testfirstnextcolorcall.png" alt="testfirstnextcolorcall.png" /></a></p>
<p><a title="testsecondnextcolorcall.png" href="http://chicoary.wordpress.com/files/2008/03/testsecondnextcolorcall.png"><img src="http://chicoary.wordpress.com/files/2008/03/testsecondnextcolorcall.png" alt="testsecondnextcolorcall.png" /></a></p>
<p><a title="testthirdnextcolorcall.png" href="http://chicoary.wordpress.com/files/2008/03/testthirdnextcolorcall.png"><img src="http://chicoary.wordpress.com/files/2008/03/testthirdnextcolorcall.png" alt="testthirdnextcolorcall.png" /></a></p>
<h4>Escrevendo o <em>model</em> para passar nos testes</h4>
<p>O <em>model</em> para passar nos testes é o seguinte:</p>
<p><a title="rgbsquaremodel.png" href="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel.png"><img src="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel.png" alt="rgbsquaremodel.png" /></a></p>
<p><a title="rgbsquaremodel-initialize.png" href="http://chicoary.wordpress.com/files/2008/03/rgbsquaremodel-initialize.png"><img src="http://chicoary.wordpress.com/files/2008/03/rgbsquaremodel-initialize.png" alt="rgbsquaremodel-initialize.png" /></a></p>
<p><a title="rgbsquaremodel-nextcolor.png" href="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-nextcolor.png"><img src="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-nextcolor.png" alt="rgbsquaremodel-nextcolor.png" /></a></p>
<blockquote><p>Nota: Omitiremos os <em>accessor</em>s enquanto forem triviais.</p></blockquote>
<h4>Criando um <em>trait</em> para o idioma <em>&#8220;say when&#8221;</em></h4>
<p>Agora vamos instalar o sistema de eventos do idioma <em>when: do:.</em> Como na construção da interface do usuário usaremos herança da classe Morph não vamos poder usar o mesmo mecanismo para herdar os métodos necessários para os eventos. Usaremos então <em><a href="http://www.iam.unibe.ch/~scg/Research/Traits/" target="_blank">traits</a>. </em>Vamos definir o seguinte <em>trait</em>:</p>
<p><a title="twhenidiom.png" href="http://chicoary.wordpress.com/files/2008/02/twhenidiom.png"><img src="http://chicoary.wordpress.com/files/2008/02/twhenidiom.png" alt="twhenidiom.png" /></a></p>
<p><a title="twhenidiom-when-do.png" href="http://chicoary.wordpress.com/files/2008/02/twhenidiom-when-do.png"><img src="http://chicoary.wordpress.com/files/2008/02/twhenidiom-when-do.png" alt="twhenidiom-when-do.png" /></a></p>
<p><a title="twhenidiom-fireevent.png" href="http://chicoary.wordpress.com/files/2008/02/twhenidiom-fireevent.png"><img src="http://chicoary.wordpress.com/files/2008/02/twhenidiom-fireevent.png" alt="twhenidiom-fireevent.png" /></a></p>
<p><a title="twhenidiom-events.png" href="http://chicoary.wordpress.com/files/2008/02/twhenidiom-events.png"><img src="http://chicoary.wordpress.com/files/2008/02/twhenidiom-events.png" alt="twhenidiom-events.png" /></a></p>
<blockquote><p>Nota: O método <em>revisit, que </em>serve para colocação de comentários que podem ser revistados posteriormente, é baseado em  <em><a href="http://squeak.preeminent.org/tut2007/html/035B.html" target="_blank">Leaving Notes In Your Code</a> </em>do tutorial  <a href="http://squeak.preeminent.org/tut2007/html/index.html" target="_blank"><em>A Development Example for Squeak 3.9</em></a>.  Para descobrir onde foram colocadas chamadas para o método <em>revisit</em> basta usar a ferramenta <em>Messages Names</em> e obter os <em>senders</em> de <em>revisit</em>.</p></blockquote>
<blockquote><p>Nota: Para conhecer a tese sobre <em>traits</em> leia <a href="http://www.iam.unibe.ch/~scg/Archive/PhD/schaerli-phd.pdf" target="_blank">Traits — Composing Classes from Behavioral Building Blocks</a>.</p></blockquote>
<h4>Usando o <em>trait</em> no <em>model</em></h4>
<p>Vamos incluir o <em>trait</em> criado no <em>model</em> (veja a segunda linha):</p>
<p><a title="rgbsquaremodel-with-trait.png" href="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-with-trait.png"><img src="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-with-trait.png" alt="rgbsquaremodel-with-trait.png" /></a></p>
<p>Agora é necessário fazer <em>override</em> do <em>glue method</em> <em>events,</em> que é requerido:</p>
<p><a title="rgbsquaremodel-events.png" href="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-events.png"><img src="http://chicoary.wordpress.com/files/2008/02/rgbsquaremodel-events.png" alt="rgbsquaremodel-events.png" /></a></p>
<blockquote><p>Nota: O <em>model</em>, com o uso do <em>trait,</em> também está livre para usar herança em qualquer ponto da hierarquia de classes.</p></blockquote>
<p>Encerramos a parte 1 aqui. Na parte 2 vamos tratar da interface gráfica do usuário.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Presenter First – A bibliography]]></title>
<link>http://codefornothing.wordpress.com/2007/11/17/presenter-first-%e2%80%93-a-bibliography/</link>
<pubDate>Sat, 17 Nov 2007 19:45:26 +0000</pubDate>
<dc:creator>codefornothing</dc:creator>
<guid>http://codefornothing.wordpress.com/2007/11/17/presenter-first-%e2%80%93-a-bibliography/</guid>
<description><![CDATA[Presenter First (PF) is a technique for organizing source code and development activities to produce]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Presenter First (PF) is a technique for organizing source code and development activities to produce fully tested GUI applications from customer stories using test-driven development.</p>
<p>As we all know, interfaces be them for desktop applications or for web applications are hard to get right and usually get bogged down with validation and business code that we know shouldn&#8217;t be there but it is so convenient that we always end up succumbing to the temptation. This eventually escalates and we end up with very long test plans because there isn&#8217;t any sane way of unit testing the code that is behind the web pages or windows forms.</p>
<p>The point of Presenter First is to move as much code as possible out of the UI and into classes that can be unit tested.</p>
<p>Here is an annotated bibliography:</p>
<p><strong>The Humble Dialog Box by Michael Feathers<br />
</strong></p>
<p>Start here! This short article/tutorial inspired the creators of Presenter First and it puts you in the right mindset for understanding the concepts presented later.</p>
<p><a href="http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf">http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf</a></p>
<p><strong>Presenter First: Organizing Complex GUI Applications for Test-Driven Development<br />
</strong></p>
<p>This is the seminal article with an in-depth explanation of the process using Ruby. Note that this is all language agnostic and applies to C#, Perl, VB, etc.</p>
<p><a href="http://atomicobject.com/files/PresenterFirstAgile2006.pdf">http://atomicobject.com/files/PresenterFirstAgile2006.pdf</a></p>
<p><strong>Brian Marick&#8217;s Presenter First wireframe demo (quicktime movie)<br />
</strong></p>
<p>Interesting screencast and take on the method. Very easy to follow but you need to install Quicktime.</p>
<p><a href="http://www.testing.com/cgi-bin/blog/2007/01/05#wireframe2">http://www.testing.com/cgi-bin/blog/2007/01/05#wireframe2</a></p>
<p><strong>Three part video interview with the guys from Atomic Object<br />
</strong></p>
<p>Ron Jacobs from <a href="http://www.arcast.tv/">http://www.arcast.tv/</a> interviews Atomic Object&#8217;s developers in a very long but very interesting discussion about systems architecture and Presenter First.</p>
<p><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=312305">http://channel9.msdn.com/ShowPost.aspx?PostID=312305</a></p>
<p><strong>Home page of Presenter First<br />
</strong></p>
<p>More links and sample code. Especially the primer in c#: <a href="http://atomicobject.com/files/Puzzle.zip">http://atomicobject.com/files/Puzzle.zip</a></p>
<p><a href="http://atomicobject.com/pages/Presenter+First">http://atomicobject.com/pages/Presenter+First</a></p>
<p><a href="http://en.wikipedia.org/wiki/Presenter_First">http://en.wikipedia.org/wiki/Presenter_First</a></p>
<p><strong>Other MVP articles</strong></p>
<p>Model View Presenter using Dependency Injection and Threading support<br />
<a href="http://www.codeproject.com/KB/cs/ModelViewPresenterWithDI.aspx">http://www.codeproject.com/KB/cs/ModelViewPresenterWithDI.aspx</a></p>
<p>A series of articles about MVP in Codeproject<br />
<a href="http://www.codeproject.com/KB/architecture/DotNetMVPFramework_Part1.aspx">http://www.codeproject.com/KB/architecture/DotNetMVPFramework_Part1.aspx</a></p>
<p>A complete series on how to apply this family of patterns to UI design using Winforms. Recommended.<br />
The link is very long so <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx">click here</a></p>
<p><strong>Final Words</strong></p>
<p>This article should have appeared before the series that I am developing about Presenter First but somehow got left for later. The series contains so far two articles:</p>
<p><a href="http://codefornothing.wordpress.com/2007/09/15/model-view-presenter-in-visual-basic-6-part-1/">http://codefornothing.wordpress.com/2007/09/15/model-view-presenter-in-visual-basic-6-part-1/</a><br />
<a href="http://codefornothing.wordpress.com/2007/10/15/model-view-presenter-in-visual-basic-6-part-2/">http://codefornothing.wordpress.com/2007/10/15/model-view-presenter-in-visual-basic-6-part-2/</a></p>
<p>There are more to come soon. I intend to finish the VB6 saga with a third part and then start a new series about Presenter First and .NET.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Method and User Stories]]></title>
<link>http://misunderstandings.wordpress.com/2006/07/16/method-and-user-stories/</link>
<pubDate>Sun, 16 Jul 2006 10:37:26 +0000</pubDate>
<dc:creator>waldo</dc:creator>
<guid>http://misunderstandings.wordpress.com/2006/07/16/method-and-user-stories/</guid>
<description><![CDATA[The idea is to take the steps presented in atomic object&#8217;s PresenterFirstAgile2006 paper and c]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The idea is to take the steps presented in <a href="http://atomicobject.com/home.page">atomic object</a>&#8217;s <a href="http://atomicobject.com/media/files/PresenterFirstAgile2006.pdf">PresenterFirstAgile2006 paper</a> and customise them into a tight dev loop, and a large project <em>(including client interaction loop)</em> around my own work style.</p>
<p>So initially I start with:</p>
<blockquote>
<ol>
<li>Create a stub presenter class that takes a model interface and a view interface via its constructor <em>(constructor dependency injection)</em></li>
<li>Create mock test objects that satisfy the model and view interfaces</li>
<li>For all user stories in customer priority order
<ol>
<li>Analyse story for impact on view</li>
<li>Add support to view interface for the story</li>
<li>Analyse story for impact on model</li>
<li>Add support to model interface for the story</li>
<li>Implement methods in the mock objects for new methods confirming they were called or returning typical data</li>
<li>Do everything that can possibly break for this story <em>(everything you can think of)</em></li>
<li>Write a test for the presenter that exercises the application via an event or action on the view or model <em>(an external system event)</em></li>
<li>Make assertions on the state of the model and the state of the view</li>
<li>Implement private methods in the presenter</li>
<li>Until all tests pass</li>
<li>Create a minimal user interface implementation to satisfy the view interface for this story</li>
</ol>
</li>
</ol>
</blockquote>
<h4>Stories</h4>
<p>So it&#8217;s assumed that you&#8217;ve already got some <a href="http://en.wikipedia.org/wiki/User_story">User Stories</a> <em>(a <a href="http://www.mountaingoatsoftware.com/pres/XP2006UserStories.pdf">presentation</a>)</em>&#8230; Given the scale of this demo, I&#8217;m going perform a massive overkill on the detail of the stories, however I need to include them as they form an important part of my loop so far.</p>
<p>So my stories are just including an id, title, text, priority <em>(high~5 low~1)<em>, estimate <em>(in hours, supposed to be days but, what the hell)</em>. Plus the option to write on the back of the &#8216;card&#8217; extra notes regarding client discussion or ideas for tests.</p>
<blockquote><p>
<strong>Story Id &#8211; 1,            Priority<em>(high~5 low~1)</em> &#8211; 5,             Estimate<em>(# of hours)</em> &#8211; 2</strong></p>
<blockquote><p>
  The Listener can see and change various Album details.
	</p></blockquote>
<p>[1.1 Discussion] ~ Known Album details so far include: Title, Artist, Composer, Classical Indicator <em>(also that Classical Indicator implies existence of a Composer)</em><br />
[1.2 Test] ~ Behaves nicely with the scenario that there aren&#8217;t any albums
</p></blockquote>
<blockquote><p>
<strong>Story Id &#8211; 2,            Priority<em>(high~5 low~1)</em> &#8211; 5,             Estimate<em>(# of hours)</em> &#8211; 2</strong></p>
<blockquote><p>
	The Listener can see and change various Song details.
	</p></blockquote>
<p>[2.1 Discussion] ~ Known Song details so far include: Title, Tracking Length, Rating<br />
[2.2 Test] ~ Behaves nicely with the scenario that there aren&#8217;t any songs
</p></blockquote>
<blockquote><p>
<strong>Story Id &#8211; 3,            Priority<em>(high~5 low~1)</em> &#8211; 4,             Estimate<em>(# of hours)</em> &#8211; 1.5</strong></p>
<blockquote><p>
	The Listener can Song details are provided by Album <em>(only Songs for the chosen Album are provided)</em>.
	</p></blockquote>
<p>[] ~
</p></blockquote>
<p>So now we&#8217;ve got some stories, let&#8217;s start coding <em>(I mean, coding tests <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</em>. Next, using NUnit for test driven dev from within Visual Studio.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Initial Presenter First demonstration program]]></title>
<link>http://misunderstandings.wordpress.com/2006/07/15/initial-presenter-first-demonstration-program/</link>
<pubDate>Sat, 15 Jul 2006 06:12:00 +0000</pubDate>
<dc:creator>waldo</dc:creator>
<guid>http://misunderstandings.wordpress.com/2006/07/15/initial-presenter-first-demonstration-program/</guid>
<description><![CDATA[Trying to learn to use presenter-first and tdd properly, with the following tools: Visual Studio, NU]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Trying to learn to use <a href="http://atomicobject.com/presenterfirst.page">presenter-first</a> and <a href="http://www.agiledata.org/essays/tdd.html">tdd</a> properly, with the following tools: Visual Studio, <a href="http://nunit.org/">NUnit</a>, ReSharper, <a href="http://nmock.org/">NMock2.0</a>, &#8230;.</p>
<p>My demo is going to try to extend slightly the demo album app used by <a href="http://www.martinfowler.com/">Martin Fowler</a> in describing <a href="http://www.martinfowler.com/eaaDev/ModelViewPresenter.html">Model-View-Presenter (MVP)</a>, I&#8217;ve also looked at a C# version of this <a href="http://benreichelt.net/blog/2005/11/18/Learning-the-Model-View-Presenter-Pattern/">app from Ben Reichelt&#8217;s blog</a>.</p>
<p>So to summarise: I&#8217;m trying to follow <a href="http://www.agiledata.org/essays/tdd.html">tdd</a> method; using C#; and using <a href="http://atomicobject.com/presenterfirst.page">Presenter-First</a> to guide the structure.</p>
<h4>Useful references</h4>
<ul>
<li><a href="http://www.martinfowler.com/eaaDev/MediatedSynchronization.html">Mediated Synchronisation</a> <em>(based on <a href="http://en.wikipedia.org/wiki/Observer_pattern">Observer</a> pattern)</em></li>
<li><a href="http://www.martinfowler.com/eaaDev/EventAggregator.html">Event Aggregators</a> <em>(specialisation of <a href="http://en.wikipedia.org/wiki/Facade_pattern">Facade</a> pattern)</em>
</li>
<li>An extention of <a href="http://atomicobject.com/presenterfirst.page">Presenter-First</a> with Adapters <em>(for more complex issues)</em>
</li>
<li><a href="http://www.martinfowler.com/articles/injection.html">Control</a></li>
<li><a href="https://www.objectmentor.com/resources/articles/dip.pdf">Dependency Inversion</a></li>
</ul>
</div>]]></content:encoded>
</item>

</channel>
</rss>
