<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.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>Marcelo's WebLog : Design</title><link>http://blogs.msdn.com/marcelolr/archive/tags/Design/default.aspx</link><description>Tags: Design</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Debugging and PDBs</title><link>http://blogs.msdn.com/marcelolr/archive/2009/05/12/debugging-and-pdbs.aspx</link><pubDate>Wed, 13 May 2009 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9608011</guid><dc:creator>marcelolr</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/marcelolr/comments/9608011.aspx</comments><wfw:commentRss>http://blogs.msdn.com/marcelolr/commentrss.aspx?PostID=9608011</wfw:commentRss><description>&lt;P&gt;Debugging is hard. There are many things we do to make it easier on ourselves.&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Feature-level things like building tracing and logging capabilities.&lt;/LI&gt;
&lt;LI&gt;Design-level things like having clear points at which state is checked for consistency (internal or parameters passed in, for example), so we narrow down the areas where things might have gone wrong.&lt;/LI&gt;
&lt;LI&gt;Code-level things like making sure that exceptions bubble up without losing the stack.&lt;/LI&gt;
&lt;LI&gt;Operational-level things like using tools to capture dumps on failure and monitoring performance counters, to have good data about the program and its environment.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;John Robbins has a great post about build-time and environment-setup-time things you can do to make your debugging life easier, and PDB files are a big part of it. If you haven't debugged symbol-indexed and source-indexed programs in the past, you're in for a treat.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/11/pdb-files-what-every-developer-must-know.aspx"&gt;http://www.wintellect.com/CS/blogs/jrobbins/archive/2009/05/11/pdb-files-what-every-developer-must-know.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Enjoy!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9608011" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Design/default.aspx">Design</category></item><item><title>Abstraction, simplicity and predictability</title><link>http://blogs.msdn.com/marcelolr/archive/2009/04/16/abstraction-simplicity-and-predictability.aspx</link><pubDate>Fri, 17 Apr 2009 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9550067</guid><dc:creator>marcelolr</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/marcelolr/comments/9550067.aspx</comments><wfw:commentRss>http://blogs.msdn.com/marcelolr/commentrss.aspx?PostID=9550067</wfw:commentRss><description>&lt;P&gt;As a short follow-up to my last post on &lt;A href="http://blogs.msdn.com/marcelolr/archive/2009/04/15/reasoning-about-code.aspx" mce_href="http://blogs.msdn.com/marcelolr/archive/2009/04/15/reasoning-about-code.aspx"&gt;reasoning about code&lt;/A&gt;, I wanted to touch upon &lt;STRONG&gt;abstraction in general&lt;/STRONG&gt; - meaning "information hiding" in the general sense, and not necessarily a particular programming mechanism such as polymorphism or some such thing.&lt;/P&gt;
&lt;P&gt;Abstraction buys us a number of good things for a design - the ability to think about things using fewer concepts (because we can focus on the more general stuff) and&amp;nbsp;the ability to change system behavior by changing an isolated part (the abstracted part), to name the first two that come to mind. In general, abstraction is a great way to have the consumer of the abstract &lt;STRONG&gt;focus&lt;/STRONG&gt; on something, by hiding or diverting focus away from the implementation particulars.&lt;/P&gt;
&lt;P&gt;There is a price to the use of abstraction, however. Well, there's more than a single thing in practice, but I want to focus on one. When you choose what to hide, you may run into the risk of making the system behavior &lt;STRONG&gt;harder to predict&lt;/STRONG&gt;, and as such more difficult to reason about.&lt;/P&gt;
&lt;P&gt;For example, if my abstraction doesn't explain some basics of the performance characteristics of the implementation, my only recourse is to profile to understand how the system will behave overall (you should profile anyway, but that's a separate matter). Or an abstraction might not give clear rules as to what happens when an object enters an error state - should you "not touch it", try to dispose of it, continue using it, or what?&lt;/P&gt;
&lt;P&gt;I'm not advocating any particular solutions or tradeoffs here, but instead I just want to bring awareness to the fact that &lt;STRONG&gt;there is a trade-off to be considered&lt;/STRONG&gt;. It's good to know how others will reason about our code, even if just to say "this isn't specified and you can't count on anything, so you should be careful and &lt;EM&gt;something&lt;/EM&gt;". Whether the "something" is 'ignore this', 'bail out', 'work around this', 'assume worst case', 'terminate the process', or something else, there should still be a clear way of explaining and reasoning about our code.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9550067" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Design/default.aspx">Design</category></item><item><title>Reasoning about code</title><link>http://blogs.msdn.com/marcelolr/archive/2009/04/15/reasoning-about-code.aspx</link><pubDate>Thu, 16 Apr 2009 00:00:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9550056</guid><dc:creator>marcelolr</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/marcelolr/comments/9550056.aspx</comments><wfw:commentRss>http://blogs.msdn.com/marcelolr/commentrss.aspx?PostID=9550056</wfw:commentRss><description>&lt;P&gt;When we have conversation about API design, or more generally about fragments of code that we write or we think customers will write, we often talk about &lt;STRONG&gt;reasoning about code&lt;/STRONG&gt;. We typically mean that someone reading the code will be able to understand the implications of making an API call for example, and write clean code accordingly. There is always a component of &lt;STRONG&gt;simplicity&lt;/STRONG&gt; in code someone can reason about.&lt;/P&gt;
&lt;P&gt;For example, someone might say that functional-style code is easier to reason about, because there are no side-effects and so you can concentrate on whatever local computation a given function does. Or someone might say that it's hard to reason about code that deals with an object that has entered an error state, because the results of operations are undefined and it's hard or impossible to keep track in your head about what the consequences of any given API call might be.&lt;/P&gt;
&lt;P&gt;I think that beyond simplicity, the core of &lt;EM&gt;code you can reason about&lt;/EM&gt; is &lt;STRONG&gt;predictability&lt;/STRONG&gt;. To the extent that you can predict the behavior of a fragment of code, and it's straightforward enough, you can reason about what the code does and what the impact of changes would be.&lt;/P&gt;
&lt;P&gt;Going back to the previous examples, functional-style code is easier to reason about because once you predict what it does locally, you understand the complete picture - there are no other, off-to-the-side effects. When an object is in an error state, you can't use it anymore ("you can't touch it", you might say) if you can't predict what it will do - the core of the problem is that you can no longer infer things about its behavior and put it together with other concepts to use it.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9550056" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Development/default.aspx">Development</category><category domain="http://blogs.msdn.com/marcelolr/archive/tags/Design/default.aspx">Design</category></item></channel></rss>