Design by Contract
21 posts • Page 2 of 3 • 1, 2, 3
Re: Design by Contract
I have read that Spec# is partially implemented in the .NET 3.5 but its not possible to use it because all its classes are marked as internal. So I got felling that MS is planning to support DbC in the next main release of .net framework.
Spec# in .NET 3.5 - http://geekswithblogs.net/Podwysocki/archive/2007/12/10/117542.aspx
Well, I think MS is slowly working on adopting all successful open source projects. For instance NAnt vs MSBuild, NUnit/MbUnit vs MSTest framework, log4net vs entlib (logging block), IoC containers (eg. Castle Project) vs rather new Unity.
IMO its only a question of time when they realise that having DbC and AOP in .NET framework would be cool
Anyway do you know LinFu? Its a framework for .NET that allows programmers to use some advanced programming techniques like duck typing, IoC, proxies, AOP and even DbC.
Here is a tutorial describing its potential
http://www.codeproject.com/KB/cs/LinFuPart1.aspx
Libor
Spec# in .NET 3.5 - http://geekswithblogs.net/Podwysocki/archive/2007/12/10/117542.aspx
Well, I think MS is slowly working on adopting all successful open source projects. For instance NAnt vs MSBuild, NUnit/MbUnit vs MSTest framework, log4net vs entlib (logging block), IoC containers (eg. Castle Project) vs rather new Unity.
IMO its only a question of time when they realise that having DbC and AOP in .NET framework would be cool
Anyway do you know LinFu? Its a framework for .NET that allows programmers to use some advanced programming techniques like duck typing, IoC, proxies, AOP and even DbC.
Here is a tutorial describing its potential
http://www.codeproject.com/KB/cs/LinFuPart1.aspx
Libor
- blahetal
- Posts: 13
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: blahetal
Re: Design by Contract
Nice lib. LinFu looks nice, and the contract examples seems like a path to follow. In my code i inject the verifications for NonNull/NonEmpty directly in the IL code. But i dont want that the user, do the same thing with some business contract. Maybe some translation of th IL from a custom contract to the IL of the target method/class/whatever. Only if we want to add this capabilities at compile time.
Now im trying to add the NonNull attribute to return types (to the method actually) too.
Cheers.
Ignacio.
Now im trying to add the NonNull attribute to return types (to the method actually) too.
Cheers.
Ignacio.
Ignacio Vivona
- cocotapioca
- Posts: 19
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Ignacio Vivona
Re: Design by Contract
Ill made some more coding and then ill upload the code to the project page.
Ignacio.
Ignacio.
Ignacio Vivona
- cocotapioca
- Posts: 19
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Ignacio Vivona
Re: Design by Contract
I'm not likely to be able to spend very much time on improving my code in the near future. Anyway, what Ignacio and LinFu are doing seem to be better approaches. If anyone want to take over my code, feel free.
/soren
/soren
Soren Skovsboll
- soren
- Posts: 15
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Soren Skovsboll
Re: Design by Contract
Hi people!
I'm trying to add the NonNull to return values. My idea is to rewrite the method adding the verifications before the Ret OpCode. To do this i'm reading the instructions of the method body and putting then in a list. But when i try to iterate over the list, all the instructions are Ret (but when i store then in the list were the proper instructions).
What's happening?
Someone have another approach?
Cheers.
Ignacio.
I'm trying to add the NonNull to return values. My idea is to rewrite the method adding the verifications before the Ret OpCode. To do this i'm reading the instructions of the method body and putting then in a list. But when i try to iterate over the list, all the instructions are Ret (but when i store then in the list were the proper instructions).
What's happening?
Someone have another approach?
Cheers.
Ignacio.
Ignacio Vivona
- cocotapioca
- Posts: 19
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Ignacio Vivona
Re: Design by Contract
You should use an advice of kind AfterMethodBodySuccess. The value being returned is in the variable context.ReturnValueVariable.
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
Re: Design by Contract
I pack everything (well, the code so far) as a plugin and i wanna upload it to the project page. How is the process to do that?
The license stuff is like postsharp/laos, the public attributes are unde LGPL 3 and the weaver is under GPL 3.
Distribution -> Zip file, installer later
Cheers.
Ignacio
The license stuff is like postsharp/laos, the public attributes are unde LGPL 3 and the weaver is under GPL 3.
Distribution -> Zip file, installer later
Cheers.
Ignacio
Ignacio Vivona
- cocotapioca
- Posts: 19
- Joined: Sat Jan 12, 2008 4:55 pm
- Full Name: Ignacio Vivona
Re: Design by Contract
Good news! Communicate me your Google account id (e.g. [unused] gmail account) and I will make you a project admin.
Gael
Gael
Gael Fraiteur, project leader
got good support? consider donating to the project.
got good support? consider donating to the project.
- gfraiteur
- Site Admin
- Posts: 674
- Joined: Tue Dec 18, 2007 3:09 pm
- Full Name: Gael Fraiteur
- Company: postsharp.org
21 posts • Page 2 of 3 • 1, 2, 3