<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d11473797\x26blogName\x3dDesign+by+Contract\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dBLUE\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttp://aabsdotnet.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://aabsdotnet.blogspot.com/\x26vt\x3d-2923818330935120734', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>
How to design and build a DBC system using C#, and NVelocity.
Previous Posts


Design by Contract
Tuesday, March 15, 2005

What I'm gonna cover

When I get the time I intend to start off this blog by exploring the following ideas:
  • Developing a design by contract system for C#
  • History of Design by Contract
  • Code Generation Systems XSLT vs NVelocity
I'm producing a Design by contract system that's in early alpha. It uses NVelocity, and declarative programming. It lets you write code like this:
[Dbc, Invariant("Prop1 >= 1")]
    public class MyTestClass
        public MyTestClass()
        Prop1 = 10;    
        #region property Prop1
        int prop1 = 0;
        [Requires("value != 1561")]
        public int Prop1
                return prop1;
                prop1 = value;

        [Requires("arg1 > 10")]
        [Requires("arg2 < 100")]
        [Ensures("$after(Prop1) == $before(Prop1) + 1")]
        public void TestMethod(int arg1, int arg2, string arg3)
            Prop1 = Prop1 + 1;
"MyTestClass.TestMethod.Prop1 == " + prop1.ToString());
During the rest of the project I'll show you how I expand this system to work with Aspect Oriented Programming, and Static and Dynamic Proxies. I'll also explore the best ways of implementing the control logic under the hood. Till then, I guess we're stuck with Asserts or ifs at the beginning of methods.

Post a Comment

Powered for Blogger by Blogger templates