<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Architecture &amp; Patterns</title>
        <link>http://agilior.pt/blogs/rodrigo.guerreiro/category/8.aspx</link>
        <description>Architecture &amp; Patterns</description>
        <language>pt-PT</language>
        <copyright>Rodrigo Guerreiro</copyright>
        <managingEditor>rodrigo.guerreiro@agilior.pt</managingEditor>
        <generator>Subtext Version 1.9.0.27</generator>
        <item>
            <title>To LINQ or not to LINQ</title>
            <link>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/11/27/3261.aspx</link>
            <description>&lt;p&gt;Some point in time, when starting a new project you'll ask some questions:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;em&gt;"What data access layer library am I going to use?"&lt;/em&gt;  &lt;/li&gt;&lt;li&gt;&lt;em&gt;"Should I develop my own?"&lt;/em&gt;  &lt;/li&gt;&lt;li&gt;&lt;em&gt;"And how about an O/R mapper?"&lt;/em&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;These are important questions and you should answer them. But the answer is now a little more simple to find. Since the &lt;a href="http://blogs.msdn.com/somasegar/archive/2007/11/19/visual-studio-2008-and-net-framework-3-5-shipped.aspx" target="_blank"&gt;release of .NET 3.5 last week&lt;/a&gt;, we now have built-in the framework a nice feature called LINQ.&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p align="center"&gt;&lt;em&gt;LINQ or Language INtegrated Query is a set of language and framework features that allow you to write queries directly in C#. LINQ drastically cuts the plumbing code required for database applications while reducing runtime errors (LINQ queries are statically type-checked by the compiler). LINQ can also query local in-memory collections and XML trees. Framework 3.5 ships with a lightweight new XML DOM designed for this purpose...LINQ and C# 3.0 are set to make a huge impact: LINQ to SQL alone will halve the cost of writing and maintaining a data access layer. Further, a single new query syntax works across databases, local collections, XML documents, datasets, as well as third party products. [via &lt;a href="http://www.albahari.com/nutshell/about.html" target="_blank"&gt;albahari.com&lt;/a&gt;]&lt;/em&gt;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;One example (taken from &lt;a href="http://www.linqpad.net" target="_blank"&gt;LINQPad&lt;/a&gt;) using the northwind database for LINQ to SQL:&lt;/p&gt; &lt;table cellspacing="0" cellpadding="2" width="1335" border="1"&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td valign="top" width="632"&gt; &lt;p align="center"&gt;&lt;strong&gt;LINQ&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="701"&gt; &lt;p align="center"&gt;&lt;strong&gt;SQL&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td valign="top" width="631"&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;from p in Products&lt;br /&gt;let spanishOrders = p.OrderDetails.Where (o =&amp;gt; o.Order.ShipCountry == "Spain")&lt;br /&gt;where spanishOrders.Any()&lt;br /&gt;orderby p.ProductName&lt;br /&gt;select new&lt;br /&gt;{&lt;br /&gt;    p.ProductName,&lt;br /&gt;    p.Category.CategoryName,&lt;br /&gt;    Orders = spanishOrders.Count(),    &lt;br /&gt;    TotalValue = spanishOrders.Sum (o =&amp;gt; o.UnitPrice * o.Quantity)&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="701"&gt; &lt;p&gt;&lt;font face="Courier New" size="2"&gt;SELECT [t0].[ProductName], [t1].[CategoryName], (&lt;br /&gt;    SELECT COUNT(*)&lt;br /&gt;    FROM [OrderDetails] AS [t4]&lt;br /&gt;    INNER JOIN [Orders] AS [t5] ON [t5].[OrderID] = [t4].[OrderID]&lt;br /&gt;    WHERE ([t5].[ShipCountry] = @p0) AND ([t4].[ProductID] = [t0].[ProductID])&lt;br /&gt;    ) AS [Orders], (&lt;br /&gt;    SELECT SUM([t8].[value])&lt;br /&gt;    FROM (&lt;br /&gt;        SELECT [t6].[UnitPrice] * (CONVERT(Decimal(29,4),[t6].[Quantity])) AS [value], [t7].[ShipCountry], [t6].[ProductID]&lt;br /&gt;        FROM [OrderDetails] AS [t6]&lt;br /&gt;        INNER JOIN [Orders] AS [t7] ON [t7].[OrderID] = [t6].[OrderID]&lt;br /&gt;        ) AS [t8]&lt;br /&gt;    WHERE ([t8].[ShipCountry] = @p0) AND ([t8].[ProductID] = [t0].[ProductID])&lt;br /&gt;    ) AS [TotalValue]&lt;br /&gt;FROM [Products] AS [t0]&lt;br /&gt;LEFT OUTER JOIN [Categories] AS [t1] ON [t1].[CategoryID] = [t0].[CategoryID]&lt;br /&gt;WHERE EXISTS(&lt;br /&gt;    SELECT NULL AS [EMPTY]&lt;br /&gt;    FROM [OrderDetails] AS [t2]&lt;br /&gt;    INNER JOIN [Orders] AS [t3] ON [t3].[OrderID] = [t2].[OrderID]&lt;br /&gt;    WHERE ([t3].[ShipCountry] = @p0) AND ([t2].[ProductID] = [t0].[ProductID])&lt;br /&gt;    )&lt;br /&gt;ORDER BY [t0].[ProductName]&lt;/font&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;Now...that's cool :) (I know that you could do the same query with a better SQL...)&lt;/p&gt; &lt;p&gt;But you could probably say that you prefer to stay with your own DAL or even with the one that you bought. But &lt;u&gt;EVERYONE&lt;/u&gt; should learn about LINQ before starting a new project. There's no need to invent the wheel over and over. If you're going to develop in .NET (VB, C#, etc) you should consider LINQ, because it's a DAL, an O/R mapper, and it was tuned by a &lt;a href="http://blogs.msdn.com/ricom/default.aspx" target="_blank"&gt;real smart guy&lt;/a&gt; that works in a &lt;a href="http://www.microsoft.com" target="_blank"&gt;big company&lt;/a&gt;. Building your DAL with LINQ also adds the value of technical support and bug fixes with no cost. Keep in mind that LINQ can also be used to query local collections, XML, datasets or anything else that implements &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/03/13/new-orcas-language-feature-extension-methods.aspx" target="_blank"&gt;extension methods&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you want to learn how to use LINQ, there's no better way than trying. So, check &lt;a href="http://www.linqpad.net/" target="_blank"&gt;this&lt;/a&gt; out. (I must say that &lt;a href="http://www.linqpad.net" target="_blank"&gt;LINQPad&lt;/a&gt; rocks. Remember that you need to &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=333325fd-ae52-4e35-b531-508d977d32a6&amp;amp;DisplayLang=en" target="_blank"&gt;install .NET 3.5&lt;/a&gt; first)&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5b9dec33-8a14-4c9d-bf24-4393b3f02b96" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/LINQ" rel="tag"&gt;LINQ&lt;/a&gt;, &lt;a href="http://technorati.com/tags/LINQPad" rel="tag"&gt;LINQPad&lt;/a&gt;, &lt;a href="http://technorati.com/tags/.NET%203.5" rel="tag"&gt;.NET 3.5&lt;/a&gt;, &lt;a href="http://technorati.com/tags/DAL" rel="tag"&gt;DAL&lt;/a&gt;, &lt;a href="http://technorati.com/tags/O/R%20Mapper" rel="tag"&gt;O/R Mapper&lt;/a&gt;, &lt;a href="http://technorati.com/tags/ORM" rel="tag"&gt;ORM&lt;/a&gt;, &lt;a href="http://technorati.com/tags/SQL" rel="tag"&gt;SQL&lt;/a&gt;&lt;/div&gt;&lt;img src="http://agilior.pt/blogs/rodrigo.guerreiro/aggbug/3261.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodrigo Guerreiro</dc:creator>
            <guid>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/11/27/3261.aspx</guid>
            <pubDate>Tue, 27 Nov 2007 11:44:16 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/rodrigo.guerreiro/comments/3261.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/11/27/3261.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://agilior.pt/blogs/rodrigo.guerreiro/comments/commentRss/3261.aspx</wfw:commentRss>
            <trackback:ping>http://agilior.pt/blogs/rodrigo.guerreiro/services/trackbacks/3261.aspx</trackback:ping>
        </item>
        <item>
            <title>Performance Testing Guidance for Web Applications</title>
            <link>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/09/17/2216.aspx</link>
            <description>&lt;p&gt;Hi you all.&lt;/p&gt; &lt;p&gt;I'm back from my deserved vacations that, by the way, was also my honeymoon :) My trip was to &lt;a href="http://www.portodegalinhas.com.br/" target="_blank"&gt;Porto de Galinhas&lt;/a&gt;, Brazil. I really encourage everyone to stay one week in the &lt;a href="http://www.nannai.com.br/" target="_blank"&gt;Nannai&lt;/a&gt; resort.&lt;/p&gt; &lt;p&gt;Now I'm trying to update my blog readings and one thing that caught my attention was the Rico Mariani's &lt;a href="http://blogs.msdn.com/ricom/archive/2007/08/29/performance-testing-guidance-for-web-applications.aspx" target="_blank"&gt;entry&lt;/a&gt;. I'm really keen to read this &lt;a href="http://www.codeplex.com/PerfTestingGuide" target="_blank"&gt;guide&lt;/a&gt; on web applications performance testing. Can't wait to see how the p&amp;amp;p team wrote.&lt;/p&gt; &lt;p&gt;Are you, too?&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:4debc017-2a3c-444c-a4d7-574ec103061c" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/performace%20testing" rel="tag"&gt;performace testing&lt;/a&gt;, &lt;a href="http://technorati.com/tags/patterns%20&amp;amp;%20practices" rel="tag"&gt;patterns &amp;amp; practices&lt;/a&gt;&lt;/div&gt;&lt;img src="http://agilior.pt/blogs/rodrigo.guerreiro/aggbug/2216.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodrigo Guerreiro</dc:creator>
            <guid>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/09/17/2216.aspx</guid>
            <pubDate>Mon, 17 Sep 2007 13:24:03 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/rodrigo.guerreiro/comments/2216.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/09/17/2216.aspx#feedback</comments>
            <wfw:commentRss>http://agilior.pt/blogs/rodrigo.guerreiro/comments/commentRss/2216.aspx</wfw:commentRss>
            <trackback:ping>http://agilior.pt/blogs/rodrigo.guerreiro/services/trackbacks/2216.aspx</trackback:ping>
        </item>
        <item>
            <title>The Eight Fallacies of Distributed Computing</title>
            <link>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/07/16/1124.aspx</link>
            <description>&lt;p&gt;See it &lt;a href="http://michael.toren.net/mirrors/eight-fallacies-of-distributed-computing/" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Specially at integration projects, such the one that I'm now, these problems are recurrent. The one that I struggle EVERY SINGLE DAY is right the first one: "The network is reliable". What a common mistake!!! &lt;/p&gt; &lt;p&gt;Now I fully understand why &lt;a href="http://www.agilior.pt/blogs/tiago.pascoal/default.aspx" target="_blank"&gt;Tiago&lt;/a&gt; requested me to implement a retry system :)&lt;/p&gt; &lt;p&gt;You may wonder why develop a retry system and not use the retry options on each send port in the BizTalk.... Well, because it simply doesn't work the way we wanted to. We wanted a retry implementation that made available to the user a way to configure it to retry the message forever (it's unacceptable to lost messages), or to configure it to retry during a specific amount of time (not less than one day) and, like the options of the BizTalk send port, retry the message X times. Another difference is that instead of a linear scale, like in the BizTalk, the time space between the retries is logarithmic.&lt;/p&gt; &lt;p&gt;With this in mind we simply don't trust the network reliability but, in other end, we're sure that we won't lost any messages.&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="0767317B-992E-4b12-91E0-4F059A8CECA8:668a0fcd-9872-4f90-bc4f-62c6ed00f1f6" contenteditable="false" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tags: &lt;a href="http://technorati.com/tags/biztalk%202006" rel="tag"&gt;biztalk 2006&lt;/a&gt;, &lt;a href="http://technorati.com/tags/retry" rel="tag"&gt;retry&lt;/a&gt;, &lt;a href="http://technorati.com/tags/distributed%20computing%20fallacies" rel="tag"&gt;distributed computing fallacies&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;P.S.: Oohh and &lt;a href="http://agilior.pt/blogs/tiago.pascoal/archive/2007/07/07/1016.aspx" target="_blank"&gt;DiffMerge rocks&lt;/a&gt; ;)&lt;/p&gt;&lt;img src="http://agilior.pt/blogs/rodrigo.guerreiro/aggbug/1124.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Rodrigo Guerreiro</dc:creator>
            <guid>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/07/16/1124.aspx</guid>
            <pubDate>Mon, 16 Jul 2007 16:26:40 GMT</pubDate>
            <wfw:comment>http://agilior.pt/blogs/rodrigo.guerreiro/comments/1124.aspx</wfw:comment>
            <comments>http://agilior.pt/blogs/rodrigo.guerreiro/archive/2007/07/16/1124.aspx#feedback</comments>
            <wfw:commentRss>http://agilior.pt/blogs/rodrigo.guerreiro/comments/commentRss/1124.aspx</wfw:commentRss>
            <trackback:ping>http://agilior.pt/blogs/rodrigo.guerreiro/services/trackbacks/1124.aspx</trackback:ping>
        </item>
    </channel>
</rss>