<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Just in time ideas</title>
	<atom:link href="https://testdrivendevelopment.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://testdrivendevelopment.wordpress.com</link>
	<description>Perchè le vostre idee devono diventare prodotti &#34;Giusto in tempo&#34; !!!</description>
	<lastBuildDate>Sun, 07 Oct 2012 08:27:54 +0000</lastBuildDate>
	<language>it-IT</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<site xmlns="com-wordpress:feed-additions:1">2459763</site><cloud domain='testdrivendevelopment.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>https://s0.wp.com/i/buttonw-com.png</url>
		<title>Just in time ideas</title>
		<link>https://testdrivendevelopment.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="https://testdrivendevelopment.wordpress.com/osd.xml" title="Just in time ideas" />
	<atom:link rel='hub' href='https://testdrivendevelopment.wordpress.com/?pushpress=hub'/>
	<item>
		<title>Un anno senza post</title>
		<link>https://testdrivendevelopment.wordpress.com/2012/10/07/un-anno-senza-post/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2012/10/07/un-anno-senza-post/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Sun, 07 Oct 2012 08:27:54 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=177</guid>

					<description><![CDATA[Ebbene sì, è passato un anno senza scrive un post. Ci ho pensato più volte di mettermi alla tastiera e raccogliere qualche idea da pubblicare sul mio blog ma causa mancanza di tempo e soprattutto stimoli ho lasciato perdere. Visto questi risultato ho deciso di fare un passo indietro. Lascio perdere il sito/blog basato sul OCTOPRESS &#8211; [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Ebbene sì, è passato un anno senza scrive un post.</p>
<p>Ci ho pensato più volte di mettermi alla tastiera e raccogliere qualche idea da pubblicare sul mio blog ma causa mancanza di tempo e soprattutto stimoli ho lasciato perdere. Visto questi risultato ho deciso di fare un passo indietro. Lascio perdere il sito/blog basato sul <a href="http://github.com/imathis/octopress">OCTOPRESS &#8211; A blogging framework for hackers</a> per tornare al classico <a href="http://wordpress.com">wordpress.com</a> . Credo e spero che questa decisione mi agevolerà nel pubblicare nuovi contenuti sul questo sito.</p>
<p>Ma cosa ho fatto negli ultimi 12 mesi? Beh tecnicamente forse non ho fatto nulla di cutting-edge, non ho usato tecnologie dei ultimo grido. Con piacere ho usato tecnologie consolidate cercando di spremerle fino in fondo in un ambiente enterprise cercando contemporaneamente di spingere l&#8217;adozione di alcune novità tecniche che posso migliorare il lavoro del gruppo di cui faccio parte. Ora spero solo di trovare il tempo  di raccontare un po&#8217; cosa ha funzionato e cosa no.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2012/10/07/un-anno-senza-post/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">177</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Il mio lavoro</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/10/07/il-mio-lavoro/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/10/07/il-mio-lavoro/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Fri, 07 Oct 2011 08:03:47 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=160</guid>

					<description><![CDATA[A volte mi capita di confortarmi con amici e conoscenti riguardo al lavoro e constatare quanto la mia vita sia condizionata dalla mia attività lavorativa. A volte mi domando se questo tempo dedicato al lavoro sia giusto o se forse sto esagerando perdendo di vista cose più importanti. Proprio in questi giorni purtroppo uno dei [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>A volte mi capita di confortarmi con amici e conoscenti riguardo al lavoro e constatare quanto la mia vita sia condizionata dalla mia attività lavorativa. A volte mi domando se questo tempo dedicato al lavoro sia giusto o se forse sto esagerando perdendo di vista cose più importanti.</p>
<p>Proprio in questi giorni purtroppo uno dei più grandi imprenditori dell’informatica contemporanea,<a href="http://it.wikipedia.org/wiki/Steve_Jobs">Steve Jobs</a>, ci ha lasciato. La sua dedizione al lavoro era cosa risaputa e mi piace ricordarlo con una frase del suo celebre discorso tenuto presso l’unversita di stanford</p>
<blockquote><p>You’ve got to find what you love. And that is as true for your work as it is for your lovers. Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work. And the only way to do great work is to love what you do. If you haven’t found it yet, keep looking. Don’t settle. As with all matters of the heart, you’ll know when you find it. And, like any great relationship, it just gets better and better as the years roll on. So keep looking until you find it. Don’t settle.</p></blockquote>
<p>e concludere questo post con la sua frase di commiato</p>
<blockquote><p>Stay Hungry. Stay Foolish.</p></blockquote>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/10/07/il-mio-lavoro/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">160</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Synchronization</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/10/06/synchronization/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/10/06/synchronization/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Thu, 06 Oct 2011 08:05:33 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=163</guid>

					<description><![CDATA[La programmazione multi-threading dopo il classico esempio “Hello world” sembra la soluzione ottimale per molti dei problemi quotidiani dei nostri software ad un costo tutto sommato accettabile: dobbiamo isolare il codice da eseguire in parallelo costruendo un po’ di delegate e ricordarci di usare i lock opportuni se il codice “parallelizzato” accede a variabili condivise. Purtroppo però quando si [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>La programmazione multi-threading dopo il classico esempio “Hello world” sembra la soluzione ottimale per molti dei problemi quotidiani dei nostri software ad un costo tutto sommato accettabile: dobbiamo isolare il codice da eseguire in parallelo costruendo un po’ di <a href="http://www.jitidea.net/blog/2011/09/22/delegate-o-puntatori-a-funzioni">delegate</a> e ricordarci di usare i <a href="http://www.jitidea.net/blog/2011/09/25/codice-thread-safe/">lock</a> opportuni se il codice “parallelizzato” accede a variabili condivise.</p>
<p>Purtroppo però quando si ricorre all’utilizzo della programmazione concorrente i problemi non si fermano qui. Un’altro importante capitolo, e non ceto semplice, è quello relativo alla sincronizzazione dei diversi thread che operano in concorrenza.</p>
<p>Lo scenario più semplice lo troviamo quando abbiamo 2 thread: il primo lancia il secondo e resta in attesa che il secondo termini il suo lavoro. Ma spesso le cose non sono così semplici. Quando le operazioni da eseguire in contemporanea sono molte la faccenda si può complicare parecchio. Quando poi l’esecuzione di una operazione dipende dal termine di altre operazioni concorrenti che al loro volta sono il risultato di altre operazioni asincrone ed in mezzo a tutto questo si inseriscono anche varibili condivise le cose possono facilmente sfuggire di mano.</p>
<p>In questi casi l’approccio migliore è evitare l’improvvisazione: esistono diversi pattern per affrontare in modo corretto questi scenari. La prima cosa da fare è conoscerli e capire come sono implementati nei linguaggi di programmazione che usiamo quotidianamente.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/10/06/synchronization/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">163</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Multi-threading vs. node.js</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/09/26/multi-threading-vs-node-js/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/09/26/multi-threading-vs-node-js/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Mon, 26 Sep 2011 08:07:26 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=165</guid>

					<description><![CDATA[Ieri si è tenuta a Brescia la prima conferenza italiana dedicata a Node.js Node.js è un framework event-driven I/O per il motore JavaScript V8. Si tratta di un framework relativo all’utilizzo server-side di Javascript per realizzare applicativi scalabili e real-time. È simile come funzionalità a Twisted in Python, Perl Object Environment in Perl o a Event machine in Ruby.Node.js è in questo [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Ieri si è tenuta a Brescia la prima <a href="http://nodejsconf.it/">conferenza italiana</a> dedicata a <a href="http://nodejs.org/">Node.js</a></p>
<p><a href="http://nodejs.org/">Node.js</a> è un framework event-driven I/O per il motore JavaScript V8. Si tratta di un framework relativo all’utilizzo server-side di Javascript per realizzare applicativi scalabili e real-time. È simile come funzionalità a Twisted in Python, Perl Object Environment in Perl o a <a href="http://rubyeventmachine.com/">Event machine</a> in Ruby.<a href="http://nodejs.org/">Node.js</a> è in questo momento una delle tecnologie più discusse in rete. Sicuramente <a href="http://nodejs.org/">Node.js</a> avrà un ruolo fondamentale nei prossimi anni nello sviluppo di applicativi web data la continua e pressante richiesta di applicativi real-time e scalabili. Inoltre il linguaggio utilizzato è JavaScript, linguaggio ampiamente utilizzato e conosciuto dagli sviluppatori web.</p>
<p><a href="http://nodejs.org/">Node.js</a>, rispetto agli altri web server disponibili oggi sul mercato, ha un grande vantaggio: offre prestazioni molto elevate ed un consumo di risorse molto limitato. <a href="http://nodejs.org/">Node.js</a> ha un’altra caratteristica peculiare: è un processo mono-thread.</p>
<p>L’obiettivo di <a href="http://nodejs.org/">Node.js</a> è quello di fornire un modo semplice per costruire software di rete scalabili. Basta guardare il classico esempio “Hello world” per capire la radicale differenza rispetto agli altri web-server:</p>
<div>
<div id="gist-1240409">
<div>
<div>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<pre>1
2
3
4
5
6
7</pre>
</td>
<td width="100%">
<div id="LC1">var http = require(&#8216;http&#8217;);</div>
<div id="LC2">http.createServer(function (req, res) {</div>
<div id="LC3">  res.writeHead(200, {&#8216;Content-Type&#8217;: &#8216;text/plain&#8217;});</div>
<div id="LC4">  res.end(&#8216;Hello World\n&#8217;);</div>
<div id="LC5">}).listen(1337, &#8220;127.0.0.1&#8221;);</div>
<div id="LC6">console.log(&#8216;Server running at <a href="http://127.0.0.1:1337/&#038;#8217" rel="nofollow">http://127.0.0.1:1337/&#038;#8217</a>;);</div>
<div id="LC7"></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div></div>
<div><a href="http://nodejs.org/">Node.js</a> dice al sistema operativo (tramite epoll, kqueue, /dev/poll, o select) che dovrebbe essere notificato quando una nuova connessione viene fatta, e poi va a dormire. Ad ogni nuova connessione, poi esegue una callback. Ogni connessione necessità quindi di una piccola allocazione sullo heap. Questo è in contrasto con modello di concorrenza più comune di oggi, dove sono impiegati i thread del sistema operativo. Il Thread-based networking è relativamente inefficiente e molto difficile da usare (vedi: <a href="http://www.kegel.com/c10k.html">questo</a> e <a href="http://bulk.fefe.de/scalable-networking.pdf">questo</a> ).</div>
</div>
</div>
<p><a href="http://nodejs.org/">Node.js</a> mostra tutta la sua efficienza nella gestione della memoria con carichi di lavoro elevati rispetto ai sistemi che per ogni connessione allocano 2MB di thread stack. Inoltre, gli sviluppatori di <a href="http://nodejs.org/">Node.js</a> sono liberi da preoccupazioni di dead-lock del processo perchè non ci sono lock. Quasi nessuna funzione di <a href="http://nodejs.org/">Node.js</a> esegue direttamente operazioni di I / O, così che il processo non si blocca mai. Visto che nessuno blocca nulla, anche programmatori meno esperti sono in grado di sviluppare sistemi molto performanti con il minimo sforzo. Altra nota interessante: utilizzando un solo thread per tutte le richieste gli sviluppatori non devono preoccuparsi del’accesso concorrente alle risorse perchè questo caso semplicemente non può avvenire: c’è un solo thread quindi solo una connessione accede ad un risorsa in un determinato istante.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/09/26/multi-threading-vs-node-js/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">165</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Codice Thread-safe</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/09/25/codice-thread-safe/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/09/25/codice-thread-safe/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Sun, 25 Sep 2011 08:11:13 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=170</guid>

					<description><![CDATA[Se il primo concetto era legato alla sintassi con cui scriviamo il nostro codice multi-thread (o concorrente) il secondo aspetto fondamentale è legato a come possiamo accedere agli oggetti che manipoliamo all’interno delle nostre applicazioni. Finchè usiamo un solo thread la creazione di un oggetto e la sua successivamente manipolazione non generano nessun problema. Quando [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Se il primo concetto era legato alla sintassi con cui scriviamo il nostro codice multi-thread (o concorrente) il secondo aspetto fondamentale è legato a come possiamo accedere agli oggetti che manipoliamo all’interno delle nostre applicazioni. Finchè usiamo un solo thread la creazione di un oggetto e la sua successivamente manipolazione non generano nessun problema. Quando invece abbiamo necessità di creare un oggetto in un thread e poi manipolarlo da altri dobbiamo fare in modo che all’oggetto sia applicato un lock affinche in un determinato istante ci sia soltanto un singolo thread che ci accede e per fare questo dobbiamo creare un lock prima di accedere all’oggetto e rilasciare il lock non appena terminato il lavoro con esso. Questo lock impedisce che più thread accedano in maniera parallela allo stesso oggetto. Da questo fatto si evince che se due o più thread tentano di accedere ad una istanza di un oggetto lo posso fare solo uno alla volta.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/09/25/codice-thread-safe/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">170</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Delegate O Puntatori a Funzioni</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/09/22/delegate-o-puntatori-a-funzioni/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/09/22/delegate-o-puntatori-a-funzioni/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Thu, 22 Sep 2011 08:12:18 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=172</guid>

					<description><![CDATA[Perchè un blocco di codice sia eseguito in parallelo rispetto ad altre istruzioni e necessario identificarlo creado un metodo e darlo in pasto ad un qualcosa che sia capace di eseguire questo blocco di codice in modo asincrono. Perchè questo qualcosa sia capace di eseguire un qualsiasi metodo abbiamo bisogno di un livello di astrazione [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Perchè un blocco di codice sia eseguito in parallelo rispetto ad altre istruzioni e necessario identificarlo creado un metodo e darlo in pasto ad un qualcosa che sia capace di eseguire questo blocco di codice in modo asincrono. Perchè questo qualcosa sia capace di eseguire un qualsiasi metodo abbiamo bisogno di un livello di astrazione tra il nostro metodo ed il sistema che lo esegue in asincrono. Per creare questa astrazione ci serve un delegate ovvero un puntatore a funzione. L’unico vincolo che esiste tra il metodo e il delegate che punta a quel metodo e che entrambe abbiamo la stessa firma (quindi stesso numero e tipo di parametri e stesso tipo per quanto riguarda il valore di ritorno). Alcuni linguaggi per favorire questa operazione permettono la scrittura di metodi/funzioni anomini quindi metodi senza nome a cui ci si può riferire soltanto attraverso un delegate.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/09/22/delegate-o-puntatori-a-funzioni/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">172</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>Programmazione Concorrente</title>
		<link>https://testdrivendevelopment.wordpress.com/2011/09/19/programmazione-concorrente/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2011/09/19/programmazione-concorrente/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Mon, 19 Sep 2011 08:13:52 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=174</guid>

					<description><![CDATA[Alcuni anni fa, correva l’anno 2007, durante il TechEd avevo assistito a questa illuminante sessione dal titolo ”Irresistible Forces Meet the Movable Objects”. Il messaggio di Pat Helland sullo sviluppo software nel medio e lungo termine era molto chiaro: la frequenza dei clock ha raggiunto il limite e l’evoluzione va verso le CPU multi-core quindi la programmazione [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Alcuni anni fa, correva l’anno 2007, durante il TechEd avevo assistito a questa illuminante sessione dal titolo ”<a href="http://blogs.msdn.com/b/pathelland/archive/2008/05/02/link-to-the-video-of-the-irresistible-forces-meet-the-movable-objects.aspx">Irresistible Forces Meet the Movable Objects</a>”. Il messaggio di <a href="http://blogs.msdn.com/phelland">Pat Helland</a> sullo sviluppo software nel medio e lungo termine era molto chiaro: la frequenza dei clock ha raggiunto il limite e l’evoluzione va verso le CPU multi-core quindi la programmazione concorrente ed i relativi pattern devono diventare una delle conoscenze indispensabili per ogni programmatore professionista.</p>
<p>Oggi sono passati alcuni anni da quella lungimirante sessione e di questo topic se ne parla sempre di più. Basti pensare a quale sia l’hype per <a href="http://nodejs.org/">node.js</a> ovvero un web-server che si programma in javascript dove tutto il codice non è bloccante: il risultato è una estrema scalabilità rispetto ad altri web-server “tradizionali”</p>
<p>Per quanto riguarda i diversi framework per lo sviluppo applicativo , sia web sia desktop, tutti di questi tempi hanno investito molti sforzi per agevolare la programmazione concorrente. Per esempio in un Ruby è stato introdotto <a href="http://rubyeventmachine.com/">Event machine</a> mentre per il .NET framework, che fin dalla versione 1 supporta questo tipo di programmazione, sono stati introdotti la <a href="http://msdn.microsoft.com/en-us/library/dd460717.aspx">Task Parallel Library</a> e <a href="http://msdn.microsoft.com/en-us/library/hh242985.aspx">Reactive Extensions</a></p>
<p>Insomma ogni piattaforma ha introdotto e/o sta introducendo funzionalità che hanno l’obiettivo di rendere semplice la creazione di applicazioni che sfruttano al 100% tutti i core presenti sui personal computer odierni e futuri. Già l’obiettivo è rendere semplice un compito che negli anni passati non era certo un argomento entry-level. La ragione fondamentale a mio avviso era la mancanza di conoscenze chiare in materia ma fortunatamente oggi la conoscenza in materia si è evoluta e perlomeno sono chiare una serie di problematiche comuni a tutti i linguaggi quando si parla di programmazione concorrente.</p>
<h2>Patterns of parallel programming</h2>
<p>Per chi vuole capire completamente cosa significa la programmazione concorrente (o multi-thread) il primo punto è capire quali sono gli schemi/scenari (ovvero i pattern) che si incontrano in questo mondo.</p>
<p>Al di la del tettaglio tecnologico questo <a href="http://microsoft.com/">documento</a> di ben oltre 100 pagine dedicate all’attuale versione del .NET Framework è una buona lettura per chi vuole capire quali sono i pattern e gli anti-pattern da utilizzare o meno per creare software multi-thread di qualità.</p>
<p>Fonte: <a href="http://microsoft.com/">Patterns of parallel programming &#8211; Understanding and applying parallel patterns with the .net framework 4 and Visual C#</a></p>
<h2>Parallel programming “for real”</h2>
<p>Visto che nei prossimi mesi passerò la maggior parte delle mie giornate lavorative sviluppando un sistema che eroga informazioni in “real-time”, quindi fa largo uso della programmazione multi-thread, vorrei cercare di riassumere con alcuni post quelli che sono i problemi reali che si incontrano facendo un utilizzo quotidiano della programmazione concorrente.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2011/09/19/programmazione-concorrente/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">174</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>ConfORM: understand core pieces</title>
		<link>https://testdrivendevelopment.wordpress.com/2010/09/06/conform-understand-core-pieces/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2010/09/06/conform-understand-core-pieces/#comments</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Mon, 06 Sep 2010 23:09:25 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[conform]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[NHibernate]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/2010/09/06/conform-understand-core-pieces/</guid>

					<description><![CDATA[If you read the post ConfORM Gettins started you already know that NHibernate mapping task could be very easy with ConfORM. But unfortunately real project are a little bit more complicated that the example I shown in my first post about ConfORM so we need to understand how we can squeeze the tool to get [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>If you read the post <a href="https://testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/">ConfORM Gettins started</a> you already know that <a href="http://nhforge.org">NHibernate</a> mapping task could be very easy with <a href="http://code.google.com/p/codeconform/">ConfORM</a>. But unfortunately real project are a little bit more complicated that the example I shown in <a href="testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/">my first post</a> about <a href="http://code.google.com/p/codeconform/">ConfORM</a> so we need to understand how we can squeeze the tool to get the work done also when things get complicated.</p>
<p>The key to success is to understand which are the many configuration points of <a href="http://code.google.com/p/codeconform/">ConfORM</a>: <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/IDomainInspector.cs">IDomainInspector</a> and <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm/NH/Mapper.cs">Mapper</a>. This two pieces can be described as the head and the tail of the mapping process.<br />
<a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/IDomainInspector.cs">IDomainInspector</a> is the entry point and also the mapping driver. This object is used to describe our domain model and currently there is only one concrete implementation of it: <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/ObjectRelationalMapper.cs">ObjectRelationalMapper</a>. <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/ObjectRelationalMapper.cs">ObjectRelationalMapper</a> class use ORM terminology to descride domain: TablePerClass, TablePerConcreteClass, ManyToMany, ManyToOne, OneToOne, Set, Bag, List, Poid, Component are just some of the methods you’ll find in it (they are also grouped inside the IObjectRelationalMapper interface but this is an implementation details). Another important thing to consider is that <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/IDomainInspector.cs">IDomainInspector</a> is just an interface and this means that if don’t like the current implementation (ObjectRelationalMapper) you can write your own and use with <a href="http://code.google.com/p/codeconform/">ConfORM</a>. For example you could create a DomainDrivenDesignMappper that has method like RootAggregate, ValueObjec an so on.<br />
The other important object is the the <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm/NH/Mapper.cs">Mapper</a>.</p>
<pre class="csharpcode"><span class="kwrd">namespace</span> ConfOrm.NH
{
    <span class="kwrd">public</span> <span class="kwrd">class</span> Mapper
    {
        <span class="kwrd">public</span> Mapper(IDomainInspector domainInspector);
        <span class="kwrd">public</span> Mapper(IDomainInspector domainInspector, ICustomizersHolder customizerHolder);
        <span class="kwrd">public</span> Mapper(IDomainInspector domainInspector, IPatternsAppliersHolder patternsAppliers);

        <span class="kwrd">public</span> Mapper(IDomainInspector domainInspector, ICustomizersHolder customizerHolder,
                      IPatternsAppliersHolder patternsAppliers, ICandidatePersistentMembersProvider membersProvider);

        <span class="kwrd">public</span> IPatternsAppliersHolder PatternsAppliers { get; }

        <span class="kwrd">public</span> <span class="kwrd">void</span> Class&lt;TRootEntity&gt;(Action&lt;IClassMapper&lt;TRootEntity&gt;&gt; customizeAction) <span class="kwrd">where</span> TRootEntity : <span class="kwrd">class</span>;
        <span class="kwrd">public</span> <span class="kwrd">void</span> Subclass&lt;TEntity&gt;(Action&lt;ISubclassMapper&lt;TEntity&gt;&gt; customizeAction) <span class="kwrd">where</span> TEntity : <span class="kwrd">class</span>;

        <span class="kwrd">public</span> <span class="kwrd">void</span> JoinedSubclass&lt;TEntity&gt;(Action&lt;IJoinedSubclassMapper&lt;TEntity&gt;&gt; customizeAction)
            <span class="kwrd">where</span> TEntity : <span class="kwrd">class</span>;

        <span class="kwrd">public</span> <span class="kwrd">void</span> UnionSubclass&lt;TEntity&gt;(Action&lt;IUnionSubclassMapper&lt;TEntity&gt;&gt; customizeAction) <span class="kwrd">where</span> TEntity : <span class="kwrd">class</span>;
        <span class="kwrd">public</span> <span class="kwrd">void</span> Component&lt;TComponent&gt;(Action&lt;IComponentMapper&lt;TComponent&gt;&gt; customizeAction) <span class="kwrd">where</span> TComponent : <span class="kwrd">class</span>;

        <span class="kwrd">public</span> <span class="kwrd">void</span> Customize&lt;TPersistent&gt;(Action&lt;IPersistentClassCustomizer&lt;TPersistent&gt;&gt; customizeAction)
            <span class="kwrd">where</span> TPersistent : <span class="kwrd">class</span>;

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddPoidPattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;MemberInfo, IIdMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddPropertyPattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;IPropertyMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddPropertyPattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;MemberInfo, IPropertyMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddCollectionPattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;ICollectionPropertiesMapper&gt; applier);

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddCollectionPattern(Predicate&lt;MemberInfo&gt; matcher,
                                         Action&lt;MemberInfo, ICollectionPropertiesMapper&gt; applier);

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddManyToOnePattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;IManyToOneMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddManyToOnePattern(Predicate&lt;MemberInfo&gt; matcher, Action&lt;MemberInfo, IManyToOneMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddRootClassPattern(Predicate&lt;Type&gt; matcher, Action&lt;Type, IClassAttributesMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddSubclassPattern(Predicate&lt;Type&gt; matcher, Action&lt;Type, ISubclassAttributesMapper&gt; applier);

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddJoinedSubclassPattern(Predicate&lt;Type&gt; matcher,
                                             Action&lt;Type, IJoinedSubclassAttributesMapper&gt; applier);

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddUnionSubclassPattern(Predicate&lt;Type&gt; matcher,
                                            Action&lt;Type, IUnionSubclassAttributesMapper&gt; applier);

        <span class="kwrd">public</span> <span class="kwrd">void</span> AddRootClassPattern(Predicate&lt;Type&gt; matcher, Action&lt;IClassAttributesMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddSubclassPattern(Predicate&lt;Type&gt; matcher, Action&lt;ISubclassAttributesMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddJoinedSubclassPattern(Predicate&lt;Type&gt; matcher, Action&lt;IJoinedSubclassAttributesMapper&gt; applier);
        <span class="kwrd">public</span> <span class="kwrd">void</span> AddUnionSubclassPattern(Predicate&lt;Type&gt; matcher, Action&lt;IUnionSubclassAttributesMapper&gt; applier);
        <span class="kwrd">public</span> HbmMapping CompileMappingFor(IEnumerable&lt;Type&gt; types);

        <span class="kwrd">protected</span> <span class="kwrd">virtual</span> Mapper.ICollectionElementRelationMapper DetermineCollectionElementRelationType(
            MemberInfo property, PropertyPath propertyPath, Type collectionElementType);

        <span class="kwrd">public</span> IEnumerable&lt;HbmMapping&gt; CompileMappingForEach(IEnumerable&lt;Type&gt; types);
        <span class="kwrd">public</span> <span class="kwrd">void</span> TypeDef&lt;TComplex, TUserType&gt;() <span class="kwrd">where</span> TUserType : IUserType;

        <span class="preproc">#region</span> Nested type: ICollectionElementRelationMapper

        <span class="kwrd">protected</span> <span class="kwrd">interface</span> ICollectionElementRelationMapper
        {
            <span class="kwrd">void</span> Map(ICollectionElementRelation relation);
            <span class="kwrd">void</span> MapCollectionProperties(ICollectionPropertiesMapper mapped);
        }

        <span class="preproc">#endregion</span>

        <span class="preproc">#region</span> Nested type: IMapKeyRelationMapper

        <span class="kwrd">protected</span> <span class="kwrd">interface</span> IMapKeyRelationMapper
        {
            <span class="kwrd">void</span> Map(IMapKeyRelation relation);
        }

        <span class="preproc">#endregion</span>
    }
}</pre>
<p>If you look carefully at the namespace of this class you’ll notice the is “ConfOrm.NH” and if you analize the contructors you’ll understand that the <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm/NH/Mapper.cs">ConfOrm.NH.Mapper</a> class takes always an <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/IDomainInspector.cs">IDomainInspector</a> and than analize and compile it to a HbmMapping instance via CompileMappingFor or CompileMappingForEach methods (read this <a href="https://testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/">post</a> if you need a real sample of this usage)</p>
<p>With the methods on <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm/NH/Mapper.cs">Mapper</a> you can customize its behavior. For example you can customize the table name mapped to a class with this line of code:</p>
<pre class="csharpcode">mapper.Class&lt;Answer&gt;(cm =&gt; cm.Table(<span class="str">"a_dummy_table_name"</span>));</pre>
<p>or set the Length of the properties using this expression:</p>
<pre class="csharpcode">mapper.Customize&lt;Name&gt;(name =&gt;
{
             name.Property(np =&gt; np.First, pm =&gt; pm.Length(20));
             name.Property(np =&gt; np.Last, pm =&gt; pm.Length(35));
});</pre>
<p>This two tasks (table names and property length) aren’t detail of the domain model. They are questions related to the database that’s the reason why the are handled by the <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm/NH/Mapper.cs">Mapper</a> class and not by the <a href="http://codeconform.googlecode.com/hg/ConfOrm/ConfOrm/IDomainInspector.cs">IDomainInspector</a>.</p>
<p>Last but not least in the future someone could be interested in using <a href="http://code.google.com/p/codeconform/">ConfORM</a> with another ORM. All you need to do is to write your own Mapper.</p>
<p>Are you <a href="http://code.google.com/p/codeconform/">ConfORM</a> ?</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2010/09/06/conform-understand-core-pieces/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">132</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>
	</item>
		<item>
		<title>ConfORM &#8211; Output XML mappings</title>
		<link>https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/#respond</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Sun, 05 Sep 2010 09:46:22 +0000</pubDate>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[conform]]></category>
		<category><![CDATA[NHibernate]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=115</guid>

					<description><![CDATA[As described in this post ConfORM doesn&#8217;t desirialize xml files into C# objects as many others tools do therefore no xml is produced by default by ConfORM. But many times, for NHibernate users, watching an hbm.xml files is just the simplest way to detect how NHibernate is configured. This the reason why the leatest bits of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>As described in this <a href="http://fabiomaulo.blogspot.com/2010/03/nhibernate-mappings-path.html">post</a> <a href="http://http://code.google.com/p/codeconform/">ConfORM</a> doesn&#8217;t desirialize xml files into C# objects as many others tools do therefore no xml is produced by default by <a href="http://http://code.google.com/p/codeconform/">ConfORM</a>. But many times, for <a href="http://nhforge.org">NHibernate</a> users, watching an hbm.xml files is just the simplest way to detect how <a href="http://nhforge.org">NHibernate</a> is configured. This the reason why the leatest bits of <a href="http://http://code.google.com/p/codeconform/">ConfORM</a> contains a class callled NHibernateMappingsExtensions (inside ConfOrm.UsageExamples project) that is just a util extensions to use in your tests or where you need to see the XML mappings. This class doesn&#8217;t do anything special: it serializes instances of HbmMapping objects, that is the <a href="http://nhforge.org">NHibernate</a>&#8216;s object holding the mapping information, into xml. The HbmMapping instance is created by the <a href="http://http://code.google.com/p/codeconform/">ConfORM</a> Mapper class which a class that any <a href="http://http://code.google.com/p/codeconform/">ConfORM</a>&#8216;s users should know very well since it&#8217;s one the key pieces of the tool (I&#8217;ll blog about it soon).</p>
<p>NHibernateMappingsExtensions usage it very simple. Copy &amp; paste this class inside your test project and write down a test that set up <a href="http://http://code.google.com/p/codeconform/">ConfORM</a> correctly</p>
<p><a href="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg"><img data-attachment-id="123" data-permalink="https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/capture-4/" data-orig-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg" data-orig-size="602,173" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;claudio&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1283706156&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Capture" data-image-description="" data-image-caption="" data-medium-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg?w=300" data-large-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg?w=490" class="alignnone size-full wp-image-123" title="Capture" src="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg?w=490" alt=""   srcset="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg 602w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg?w=150&amp;h=43 150w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg?w=300&amp;h=86 300w" sizes="(max-width: 602px) 100vw, 602px" /></a></p>
<p>and finally call the method AsString() if you want to see all the xml in the output console like this</p>
<p><a href="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg"><img data-attachment-id="119" data-permalink="https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/capture-2/" data-orig-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg" data-orig-size="687,502" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;claudio&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1283704704&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Capture" data-image-description="" data-image-caption="" data-medium-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg?w=300" data-large-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg?w=490" class="alignnone size-full wp-image-119" title="Capture" src="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg?w=490" alt=""   srcset="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg 687w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg?w=150&amp;h=110 150w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg?w=300&amp;h=219 300w" sizes="(max-width: 687px) 100vw, 687px" /></a></p>
<p>or call the method WriteAllXmlMapping() if you want a single .hbm.xml file for each domain object on the disk</p>
<p><a href="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg"><img data-attachment-id="121" data-permalink="https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/capture-3/" data-orig-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg" data-orig-size="465,200" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;claudio&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1283705697&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}" data-image-title="Capture" data-image-description="" data-image-caption="" data-medium-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg?w=300" data-large-file="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg?w=465" class="alignnone size-full wp-image-121" title="Capture" src="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg?w=490" alt=""   srcset="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg 465w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg?w=150&amp;h=65 150w, https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg?w=300&amp;h=129 300w" sizes="(max-width: 465px) 100vw, 465px" /></a></p>
<p>You could find more samples of this two methods in the <a href="http://code.google.com/p/codeconform/source/browse/ConfOrm/ConfOrm.UsageExamples/">ConfOrm.UsageExamples project</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2010/09/05/conform-output-xml-mappings/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">115</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>

		<media:content url="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture3.jpg" medium="image">
			<media:title type="html">Capture</media:title>
		</media:content>

		<media:content url="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture1.jpg" medium="image">
			<media:title type="html">Capture</media:title>
		</media:content>

		<media:content url="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/capture2.jpg" medium="image">
			<media:title type="html">Capture</media:title>
		</media:content>
	</item>
		<item>
		<title>ConfORM- Getting started</title>
		<link>https://testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/</link>
					<comments>https://testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/#comments</comments>
		
		<dc:creator><![CDATA[makka]]></dc:creator>
		<pubDate>Thu, 02 Sep 2010 21:46:13 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[conform]]></category>
		<category><![CDATA[NHibernate]]></category>
		<guid isPermaLink="false">http://testdrivendevelopment.wordpress.com/?p=108</guid>

					<description><![CDATA[ConfORM is a just another option to create the mapping for NHibernate. Out-of-the-box NHibernate mapping&#8217;s can be created only with XML mapping files (*.hbb.xml files). ConfORM uses code instead of XML. If you are thinking that there is already at least one tool that follow this approach you should read this post to understand which [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a href="http://code.google.com/p/codeconform/">ConfORM</a> is a just another option to create the mapping for NHibernate. Out-of-the-box NHibernate mapping&#8217;s can be created only with XML mapping files (*.hbb.xml files). <a href="http://code.google.com/p/codeconform/">ConfORM</a> uses code instead of XML. If you are thinking that there is already at least one tool that follow this approach you should read this <a href="http://fabiomaulo.blogspot.com/2010/03/nhibernate-mappings-path.html">post</a> to understand which are the differences between the other tools and <a href="http://code.google.com/p/codeconform/">ConfORM</a>.     <br />After this brief introduction I want to show you a little example of <a href="http://code.google.com/p/codeconform/">ConfORM</a>’s usage to demonstrate how easy could be life with this tool.&#160;&#160; <br />Here below I posted a screenshot of my domain model. As you can see there is nothing special here: some <a href="http://nhforge.org/doc/nh/en/index.html#collections-mapping">Collections</a> and some <a href="http://nhforge.org/doc/nh/en/index.html#mapping-declaration-manytoone">ManyToOne</a> relationships. There is also a read-only property: Element.HasGroupedAnswer (sorry you can’t see it in the screenshot below) .     </p>
<p><a href="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/image.png"><img loading="lazy" style="background-image:none;padding-left:0;padding-right:0;display:inline;padding-top:0;border-width:0;" title="image" border="0" alt="image" src="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/image_thumb.png?w=619&#038;h=480" width="619" height="480" /></a></p>
<p>The very first step is to create a valid configuration object for NHibernate. Using NHibernate.Cfg.Loquacious feature from NHibernate version 3 this can be done with this lines of code. </p>
<pre class="csharpcode">            Configuration configure = <span class="kwrd">new</span> Configuration();
            configure.SessionFactoryName(<span class="str">&quot;Demo&quot;</span>);
            configure.Proxy(p =&gt;
            {
                p.Validation = <span class="kwrd">false</span>;
                p.ProxyFactoryFactory&lt;ProxyFactoryFactory&gt;();
            });
            configure.Properties[<span class="str">&quot;current_session_context_class&quot;</span>] = _context;
            configure.DataBaseIntegration(db =&gt;
            {
                db.Dialect&lt;MsSql2008Dialect&gt;();
                db.Driver&lt;SqlClientDriver&gt;();
                db.KeywordsAutoImport = Hbm2DDLKeyWords.AutoQuote;
                db.IsolationLevel = IsolationLevel.ReadCommitted;
                db.LogFormatedSql = LogSqlInConsole;
                db.LogSqlInConsole = LogSqlInConsole;                
                db.ConnectionString = <span class="str">&quot;yuor connection string goes here&quot;</span>;
                db.Timeout = 10;
                db.HqlToSqlSubstitutions = <span class="str">&quot;true 1, false 0, yes 'Y', no 'N'&quot;</span>;
            });</pre>
<pre class="csharpcode">&#160;</pre>
<p>Once configuration object is ready we must setup mapping for our domain. Now it’s time to use ConfORM. I decided to wrap all mapping stuff inside the class shown below.</p>
<pre class="csharpcode">    <span class="kwrd">public</span> <span class="kwrd">class</span> ConfOrmDomainMapper
    {
        <span class="kwrd">public</span> ConfOrmDomainMapper()
        {
            orm = <span class="kwrd">new</span> ObjectRelationalMapper();         
            orm.Patterns.PoidStrategies.Add(<span class="kwrd">new</span> NativePoidPattern());
            var patternsAppliers = <span class="kwrd">new</span> CoolPatternsAppliersHolder(orm);

            mapper = <span class="kwrd">new</span> Mapper(orm, patternsAppliers);

            DefineDomain();
            DefineMapping();
        }

        <span class="kwrd">private</span> <span class="kwrd">void</span> DefineMapping()
        {           
        }

        <span class="kwrd">private</span> <span class="kwrd">void</span> DefineDomain()
        {
            orm.TablePerClass(GetTypes());
        }

        <span class="kwrd">public</span> HbmMapping Mapping
        {
            get { <span class="kwrd">return</span> mapper.CompileMappingFor(GetTypes()); }
        }

        IEnumerable&lt;Type&gt; GetTypes()
        {
            var type = <span class="kwrd">typeof</span>(BaseEntity);
            <span class="kwrd">return</span> type.Assembly.GetTypes().Where(t =&gt; t.BaseType == type);
        }
        <span class="kwrd">private</span> <span class="kwrd">readonly</span> ObjectRelationalMapper orm;
        <span class="kwrd">private</span> <span class="kwrd">readonly</span> Mapper mapper;
    }</pre>
<p>Since all the classes in my domain model inherit from a common class called BaseEntity I can use reflection to get all types with a single line of code. This is not mandatory for ConfORM but as you can the result is very nice. In this simple sample I don’t need to customize the mapper but if you need to do you can use the Mapper class instance. Now all the mapping is already done. Since I used CoolPatternsAppliersHolder <a href="http://code.google.com/p/codeconform/">ConfORM</a> already create a complete mapping to start working with NHibernate (I’ll blog some details about it in the future)</p>
<p>To finish I need to join ConfORM mappings and NHibernate configuration. This task is done with this few lines of code:</p>
<pre class="csharpcode">ConfOrmDomainMapper domainMapper = <span class="kwrd">new</span> ConfOrmDomainMapper();</pre>
<pre class="csharpcode">configure.AddDeserializedMapping(domainMapper.Mapping, <span class="str">&quot;MyAppDomain&quot;</span>);</pre>
<p>After this I’m ready to create a SessionFactory with</p>
<pre class="csharpcode">configure.BuildSessionFactory();</pre>
<p>and start using NHibernate a usual. </p>
<p>This was just the beginning. I hope to find some more time to write again about <a href="http://code.google.com/p/codeconform/">ConfORM</a>. </p>
<p>I want also thank <a href="http://fabiomaulo.blogspot.com/">Fabio Maulo</a> for sharing with community this another piece of great code!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://testdrivendevelopment.wordpress.com/2010/09/02/conform-getting-started/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">108</post-id>
		<media:content url="https://2.gravatar.com/avatar/e0ff4930d7fde53b4d4062fba15470fc0d2ac8ee7b2470ae66d57c59e1ec6c32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">makka</media:title>
		</media:content>

		<media:content url="https://testdrivendevelopment.wordpress.com/wp-content/uploads/2010/09/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
