Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,899 members, 7,802,914 topics. Date: Saturday, 20 April 2024 at 03:07 AM

Design By Contract - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Design By Contract (1080 Views)

Contract Html/ui Developer / Follow Me On My Contract / Design By Contract Support In .net (2) (3) (4)

(1) (Reply) (Go Down)

Design By Contract by harryobas: 6:35pm On Aug 10, 2012
Hi guys, i have recently been reading a fantastic book on Dbc (Design by Contract by Example by Richard Mitchell and Jim McKim) which has opened my eyes to the value of contract driven programming (pre-conditions, post-conditions and invariants) and am really surprised by the low number of developers who use design by contract principles to create software. The language used to demonstrate problems in the above mentioned book is Eiffel which is not widely used in development but that should not deter you at all just think of it as a specialized language in which it is easy to represent contracts(the object constraint language (OCL) can also be used to represent contracts). Design by contract is a technique that forces u to think harder and more thoroughly about your programs which is always a benefit. It is not easy to learn but with the above mentioned book the slope of learning curve is substantially flattened.
Re: Design By Contract by mj(m): 7:10pm On Aug 10, 2012
Pls I dnt mind having a copy of that book, sincerely I most time follow the water model to design my software, and that's all. Pls can you send It to me, thanks. Email: oshadami.mj@gmail.com
Re: Design By Contract by harryobas: 7:27pm On Aug 10, 2012
mj: Pls I dnt mind having a copy of that book, sincerely I most time follow the water model to design my software, and that's all. Pls can you send It to me, thanks. Email: oshadami.mj@gmail.com

The waterfall model is a software process model and Dbc is a software design technique usually applied during component-level design which is a software process workflow so Dbc is process agnostic. Which means u can still follow the waterfall model(adapted to your project off course)and apply Dbc in your design workflow. As for a copy of the book sorry i only have it in hard copy.
Re: Design By Contract by farouqzaib: 7:58pm On Aug 10, 2012
In concept, it's one of the trade-offs of Test Driven Development. You write tests before you write code for the feature, this in a way forces you to code to your tests.
Re: Design By Contract by harryobas: 8:47pm On Aug 10, 2012
farouqzaib: In concept, it's one of the trade-offs of Test Driven Development. You write tests before you write code for the feature, this in a way forces you to code to your tests.

I totally agree but i think contracts tend to deal with more general cases and unit tests(type of test performed during TTD) deal with more specific cases. I strongly believe that contracts help to write more effective tests since it removes the need to add tedious repetitive tests for invalid arguments. Contracts specify the minimum you can expect from the function, whereas unit tests attempt to validate the actual behaviour for a particular set of inputs.
Re: Design By Contract by farouqzaib: 9:24pm On Aug 10, 2012
harryobas:

I totally agree but i think contracts tend to deal with more general cases and unit tests(type of test performed during TTD) deal with more specific cases. I strongly believe that contracts help to write more effective tests since it removes the need to add tedious repetitive tests for invalid arguments. Contracts specify the minimum you can expect from the function, whereas unit tests attempt to validate the actual behaviour for a particular set of inputs.

+1!

(1) (Reply)

Introducing My Bus Reservation System. / Femtocell / 15 Characteristics You Should Watch Out When Employing A Programmer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 15
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.