<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/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>Frans Bouma's blog - All Comments</title><link>http://weblogs.asp.net/fbouma/default.aspx</link><description>Generator.CreateCoolTool();</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8266278</link><pubDate>Sun, 22 Jan 2012 07:02:30 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8266278</guid><dc:creator>mattjcowan</dc:creator><description>&lt;p&gt;Great post. I hope this is the beginning of a series of posts :-) The question you are responding to in this post is a great question, one that I&amp;#39;ve asked myself. Also, while startups are usually very different one from the other, they usually have unique pressures, such as out-of-band deadlines, competing agendas sometimes by stakeholders, chaotic resourcing, and having to be a scientist in the middle of all of it can be grueling. It would be interesting to take this discussion to a team, and see how to make this work out in a team atmosphere (ie: roles and responsibilities, scientist v. engineer). I appreciated the statement &amp;quot;it&amp;#39;s sometimes not possible to do every step in the time it requires&amp;quot;, that&amp;#39;s a breath of fresh air, when sleep is becoming rare :-). Now, I need to learn more about describing and designing algorithms (without code), and &amp;quot;Formal methods&amp;quot;. Keyvan, can you write some more about that ;-)&lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8266278" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8265178</link><pubDate>Fri, 20 Jan 2012 19:11:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8265178</guid><dc:creator>Patrick Smacchia</dc:creator><description>&lt;p&gt;IMHO there are two essential practices that makes unit testing extremely efficient to find bug, that you don&amp;#39;t really mention: Code Contract (you barely mention it) and 100% Code Coverage.&lt;/p&gt;
&lt;p&gt;When both Contracts and Full Coverage are used, one can be pretty confident that the code portion tested is pretty close to bug free (not 100% sure of course!). I wrote a post on that last week actually:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://codebetter.com/patricksmacchia/2012/01/10/non-trivial-and-real-world-feedbacks-on-writing-unit-tests/"&gt;codebetter.com/.../non-trivial-and-real-world-feedbacks-on-writing-unit-tests&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Also, you often mention the number of unit tests as a testing metric, while the metrics that really matters (IMHO) are the number of assertions checked (in tests or in contracts) and the percentage of code covered.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8265178" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8265031</link><pubDate>Fri, 20 Jan 2012 15:58:55 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8265031</guid><dc:creator>FransBouma</dc:creator><description>&lt;p&gt;@Keyvan Nayyeri&lt;/p&gt;
&lt;p&gt;Thanks for your post :) As I (apparently not correctly) tried to explain in my post, I'm not a specialist in this field, so I tried to describe what I knew of software correctness proving and how I apply it in practice. &lt;/p&gt;
&lt;p&gt;So what I tried to do was giving developers who have no notion of formal proving (as you said, it's a complicated field) some tools/ways of working that they can apply in their own daily work so they create more reliable / less buggy software. What you described so well 'software testing can at most only show there are bugs, not the absence of them', is unfortunately not well known among developers: what they most of the time think when they see all green unittests: &amp;quot;bugs are gone, ship it!&amp;quot;. Some teams realize this though, and write a tremendous amount of tests, have rules like 'we need 100% code coverage' and other time wasters. &lt;/p&gt;
&lt;p&gt;IMHO time not well spend. But as you said, it's very hard (complex, lot of work) to reach the goal of proving the complete system to be bugfree so some ways to get near that goal might already be helpful. That's what I tried to describe. Of course my post isn't a way to write software for a plane, it's not formal enough as you know. &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8265031" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8265023</link><pubDate>Fri, 20 Jan 2012 15:44:25 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8265023</guid><dc:creator>Keyvan Nayyeri</dc:creator><description>&lt;p&gt;Frans,&lt;/p&gt;
&lt;p&gt;I thought I have to jump in and leave some comments because your post includes some incorrect information. Unfortunately, this area is one of those areas where programmers and testers have a lot of misbeliefs because all they know is software testing.&lt;/p&gt;
&lt;p&gt;You have to distinguish two different fields called Software Testing and Formal Methods. The former is relatively easily and includes all the things you know about unit testing and integration testing, and the latter is totally different and almost all the industrial programmers don&amp;#39;t know about it because it&amp;#39;s an advanced and complicated mechanism.&lt;/p&gt;
&lt;p&gt;With software testing, what you&amp;#39;re trying to achieve is improving the quality of software by reducing the number of bugs, exceptions, and errors that you can predict before a user catches them. With software testing what you can achieve at most is proving the presence of bugs not their absence. Even if you write millions of tests, you can&amp;#39;t guarantee that there is no other bug or error.&lt;/p&gt;
&lt;p&gt;Software testing works great for most industrial software systems that are not critical. At most, there is an incorrect output or an exception, but there are critical software systems that must be bug-free like those used in aviation, healthcare, or automotive.&lt;/p&gt;
&lt;p&gt;Formal methods are a set of mathematical techniques to actually prove that a program runs without any bugs, errors, or exceptions in order to make sure that it&amp;#39;s not going to kill somebody or make a catastrophic failure. Formal methods require a deep knowledge of mathematics and programming and it&amp;#39;s the purpose of research at academia and industry for doctoral students and graduates (that&amp;#39;s what I&amp;#39;m doing).&lt;/p&gt;
&lt;p&gt;Formal methods like abstract interpretation or other techniques are used in systems like Astree (developed in France) that proves the absence of bugs in systems used in Airbus planes. There are also similar systems used in BMW cars and healthcare systems. There are also software verification tools used by NASA.&lt;/p&gt;
&lt;p&gt;So unlike what you said, proving the correctness of a program doesn&amp;#39;t involve those steps. It&amp;#39;s a totally formal procedure that is hard to explain in a comment but you can read a book entitled Principles of Program Analysis on that.&lt;/p&gt;
&lt;p&gt;You also mentioned that proving the correctness of a big software system is very difficult. It is, indeed, but that&amp;#39;s done many times for many big systems and I mentioned some examples above.&lt;/p&gt;
&lt;p&gt;I hope this helps clarifying the issue.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8265023" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8264995</link><pubDate>Fri, 20 Jan 2012 15:16:02 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8264995</guid><dc:creator>A</dc:creator><description>&lt;p&gt;&amp;quot;One problem I have with the agile mantra of &amp;#39;Red, green, refactor&amp;#39; is that if you have a failing test but you don&amp;#39;t know why it failed then it is useless.&amp;quot;&lt;/p&gt;
&lt;p&gt;Maybe worse than useless. If a test asserts failure without a message and without a clear test name its worse than useless. If a test blows up in an unexpected manner, not just a failed assert, it can be a good thing because it shows that you have a coverage problem.&lt;/p&gt;
&lt;p&gt;In most of my day to day work, the idea of proofing is moot because the specifications are minimal or non-existent :P&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8264995" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8264992</link><pubDate>Fri, 20 Jan 2012 15:15:57 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8264992</guid><dc:creator>Eric K.</dc:creator><description>&lt;p&gt;@Richard - I would suggest that writing the initial failing test is not useless, even if you don&amp;#39;t know (or care) why it fails. &lt;/p&gt;
&lt;p&gt;The point of the initial failing test is to show that the functionality you are testing doesn&amp;#39;t *already* pass, before you write your implementation. Then, when you write your implementation and the test passes, you&amp;#39;ll know it&amp;#39;s your new code that causes the success, and not something incidental or overlooked.&lt;/p&gt;
&lt;p&gt;It&amp;#39;s the *combination* of the initial failing test run and the subsequent passing test that tells the developer what they need to know, not simply the passing test.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8264992" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8264981</link><pubDate>Fri, 20 Jan 2012 15:01:49 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8264981</guid><dc:creator>Tudor</dc:creator><description>&lt;p&gt;About &amp;quot;If you write a method that fails your test because it gives you back a NotImplementedException then you have wasted your time because you haven&amp;#39;t learnt anything.&amp;quot;&lt;/p&gt;
&lt;p&gt;That&amp;#39;s not quite true: checking that the unit test fails when the method is not implemented is also a way to make sure that the unit test is well written from the start, even in the simple of cases.&lt;/p&gt;
&lt;p&gt;Also, it encourages the developer to write the test (executable specification) first, before the code is written, not the other way around, when he might be tempted to write a test that just reflects what the method is already doing, even if that is not the expected behavior.&lt;/p&gt;
&lt;p&gt;So the general rule would be: never add/modify functionality, before writing at least a test first.&lt;/p&gt;
&lt;p&gt;All unit tests don&amp;#39;t prove in a mathematical way that the code is without bugs, just reduce that possibility.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8264981" width="1" height="1"&gt;</description></item><item><title>re: "Re: I have a question about proving code correctness"</title><link>http://weblogs.asp.net/fbouma/archive/2012/01/20/quot-re-i-have-a-question-about-proving-code-correctness-quot.aspx#8264937</link><pubDate>Fri, 20 Jan 2012 14:03:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8264937</guid><dc:creator>Richard Wright</dc:creator><description>&lt;p&gt;Frans,&lt;/p&gt;
&lt;p&gt;One problem I have with the agile mantra of &amp;#39;Red, green, refactor&amp;#39; is that if you have a failing test but you don&amp;#39;t know why it failed then it is useless.&lt;/p&gt;
&lt;p&gt;If you write a method that fails your test because it gives you back a NotImplementedException then you have wasted your time because you haven&amp;#39;t learnt anything. &lt;/p&gt;
&lt;p&gt;But if your test fails for a reason that you weren&amp;#39;t expecting then you have learnt something. Maybe your algorithm is incorrect.&lt;/p&gt;
&lt;p&gt;Blindly following the agile method is pointless, IMHO. But using unit tests intelligently can teach you a lot about your code.&lt;/p&gt;
&lt;p&gt;But, as you say, proving correctness is extremely difficult, if not impossible.&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8264937" width="1" height="1"&gt;</description></item><item><title>re: ORM Profiler release celebration: LLBLGen Pro 100 EUR discount</title><link>http://weblogs.asp.net/fbouma/archive/2011/09/30/orm-profiler-release-celebration-llblgen-pro-100-eur-discount.aspx#7971840</link><pubDate>Sat, 01 Oct 2011 07:11:39 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7971840</guid><dc:creator>FransBouma</dc:creator><description>&lt;p&gt;No not this month, upgrades get the same discount as always. &lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7971840" width="1" height="1"&gt;</description></item><item><title>re: ORM Profiler release celebration: LLBLGen Pro 100 EUR discount</title><link>http://weblogs.asp.net/fbouma/archive/2011/09/30/orm-profiler-release-celebration-llblgen-pro-100-eur-discount.aspx#7971744</link><pubDate>Sat, 01 Oct 2011 04:02:34 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7971744</guid><dc:creator>WayneBrantley</dc:creator><description>&lt;p&gt;Any celebration for upgrades?&lt;/p&gt;
&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7971744" width="1" height="1"&gt;</description></item></channel></rss>
