<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Avoiding Typos via Output Methods</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/avoiding-typos-via-output-methods.aspx</link><description>One of the issues with the code generation templates is that they do not test the syntax of the output as you type. I’m a VB coder, and that would be my fantasy, an editor that told me whether my templates produced valid output as I type. That’s nearly</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>re: Avoiding Typos via Output Methods</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/avoiding-typos-via-output-methods.aspx#1516034</link><pubDate>Sat, 16 Feb 2008 14:59:22 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1516034</guid><dc:creator>Kathleen</dc:creator><description>&lt;p&gt;Bill,&lt;/p&gt;
&lt;p&gt;That's a good point. Let me look into that. One of the reasons I want this out there is for more brains to help me make it better. &lt;/p&gt;
&lt;p&gt;At the moment, I can't tell you why this needs to be a delegate. &amp;nbsp;But I haven't considered it veyr long. Earlier versions created arguments at a higher level (in output function) but I decided that was a bad design and removed the additional parameters. &lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1516034" width="1" height="1"&gt;</description></item><item><title>re: Avoiding Typos via Output Methods</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/avoiding-typos-via-output-methods.aspx#1515536</link><pubDate>Sat, 16 Feb 2008 00:53:23 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1515536</guid><dc:creator>bill</dc:creator><description>&lt;p&gt;Hi Kathleen,&lt;/p&gt;
&lt;p&gt;The issue of performance really isn't that important at design time unless it is really bad. &amp;nbsp;My objections to using XML literals purely for line breaks was mroe to do with Beth's samples of using them at runtime. There VB would be much better off if it had multiline verbatim strings.&lt;/p&gt;
&lt;p&gt;That leads me to the question why choose VB instead of C# as the primary language for the templates ? &lt;/p&gt;
&lt;p&gt;But my main question here was the OutoutFunction used above has 5 parameters on this overload, the fifth in your example takes a Func(Of String). &amp;nbsp;Why not have that just as String ? &amp;nbsp;Is the Func(Of STring) actually an Expression(Of Func(Of String)) and having the expression tree is of importance ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1515536" width="1" height="1"&gt;</description></item><item><title>re: Avoiding Typos via Output Methods</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/avoiding-typos-via-output-methods.aspx#1515196</link><pubDate>Fri, 15 Feb 2008 14:38:14 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1515196</guid><dc:creator>Kathleen</dc:creator><description>&lt;p&gt;Bill,&lt;/p&gt;
&lt;p&gt;Thanks for coming by. &lt;/p&gt;
&lt;p&gt;In this particular case, you are correct. The full fuctional approach would be better. But how often does a function simply return a value rather than doing calculations? My simplification for the sake of example did obscure that here. &lt;/p&gt;
&lt;p&gt;I look forward to continuing this argument, but I can foreshadow that one of the reasons I've fallen very heavily to the code blocks is their use in a preprocessor. If I know precisely which code is output template code and which code is to run the template itself, I can accomplish things that are otherwise impossible. &lt;/p&gt;
&lt;p&gt;I know you've had a couple of concerns about my approach with the code blocks and I look forward to that discussion being public. But one of your concerns was performance of creating the code block for little purpose, such as in the code I posted. The performance of these templaets is blazingly, frighteningly fast. I look forward to some benchmarks later, but I believe they will probably prove to be faster at generation than any mainstream tools we have - anything short of just outputting a bunch of strings using string builder, and that I believe to be non-maintainable in large templtes. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1515196" width="1" height="1"&gt;</description></item><item><title>re: Avoiding Typos via Output Methods</title><link>http://msmvps.com/blogs/kathleen/archive/2008/02/14/avoiding-typos-via-output-methods.aspx#1514805</link><pubDate>Fri, 15 Feb 2008 03:01:35 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1514805</guid><dc:creator>bill</dc:creator><description>&lt;p&gt;Why use XML literals there? &amp;nbsp;Doesn't that complicate the issue compared to:&lt;/p&gt;
&lt;p&gt;Private Function MemberGetPrimaryKey() As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; Return OutputFunction( _ &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Symbols.Method.GetPrimaryKey, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;Scope.Protected, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;MemberModifiers.Overrides, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;ObjectData.PrimaryKey.NetType, _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;m &amp;amp; ObjectData.PrimaryKeys(0).Name)&lt;/p&gt;
&lt;p&gt;End Function &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1514805" width="1" height="1"&gt;</description></item></channel></rss>