- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Design By Contract
Thu, 2010-07-08, 16:10
I searched the mailing list archive and I could not find a discussion
about Design by Contract in Scala.
So my question is, if Design by Contract has been or is being considered
for inclusion in a future version of Scala and if not, why not. I know
there are some libraries that try to implement DbC as a library but I
think they are missing a very important point: Contracts are part of the
method signature or class interface and not of the implementation.
Therefore contracts are also inherited and this is not possible without
Scala is a really great language and for sure much more powerful and
expressive than Java. Its functional programming features would allow
developers to write very concise and expressive contracts. I have found
design by contract to greatly reduce debugging time and lead to less
bugs in my software in general. So in my opinion the addition of DbC to
Scala would make an already great language almost perfect.
On a related note:
I like the fact that Scala does away with Java-style checked exceptions.
As suggested by this slightly outdated paper
(http://www.springerlink.com/content/264g7772m8237180/) the use of
contracts seems to greatly reduce the need for exceptions.
I'm curious about your opinions.