High on my wishlist: Design by Contract (DbC)

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

High on my wishlist: Design by Contract (DbC)

Post by dell_jockey »

Something I like most about Eiffel, an object oriented programming language is 'DbC - Design by Contract'.

DbC is used outside Eiffel as well. There are toolkits/libraries to add DbC to Java, and more recently, a new ObjectPascal based compiler added DbC as well.
Check out this new ObjectPascal compiler here: http://www.chromesville.com/

For more information on Eiffel, check out:
http://smarteiffel.loria.fr/
http://www.visual-eiffel.com/
http://www.eiffel.com/

To learn more about DbC, what it is and what advantages it offers, check out the following links:
http://en.wikipedia.org/wiki/Design_by_contract
http://www.artima.com/intv/contracts.html
http://archive.eiffel.com/doc/manuals/t ... /page.html

There's a lot more available on DbC, just check out:
http://www.google.de/search?hl=de&q=%22 ... t%22&meta=

I'd like to see "Design by Contract" added to PureBasic.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Would overly complicate things imo!
And things like these seems more geared towards critical applications!
Like autonomous manufactoring, industrial applications etc etc.
Where any form of failures must be handled automatically.
If it can be added as a 3rd party library then go fo it.
but adding it to PureBasic itself...I'd rather have PureBasic 4.0 instead :P
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Rescator wrote:Would overly complicate things imo!
And things like these seems more geared towards critical applications!
Like autonomous manufactoring, industrial applications etc etc.
Where any form of failures must be handled automatically.
If it can be added as a 3rd party library then go fo it.
but adding it to PureBasic itself...I'd rather have PureBasic 4.0 instead :P
No, it would not overly complicate things, at least not for us compiler users. For Fred to implement it, would be another story.
DbC is not just meant for critical software. Eiffel-programmers use it for any trivial piece of software. Using the correct pre- and postconditions as well as a correct invariant, you can ensure your software to work as designed at the module/function/object level. Also, when a contract is violated, a compiler can give precise information as to what went wrong and where it went wrong.
Also, DbC is not a runtime thing. It enables the compiler to catch errors, before they are shipped to your customers. Also, because the DbC-clauses are inside your sources, they document the way the caller/callee-interface should work and what limits apply.
The overhead of adding DbC is rather small, so that most of the Eiffel applications and libraries are distributed with the DbC-clauses left in.

As for me, PB 4.0 is obviously clearly defined in the minds of those longing for the product, but an actual implementation spec sheet hasn't come to my attention. Meaning: comparing a concrete proposal for a language extension with a product that I can't yet put my fingers on is hardly meaningful at this junction in time.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

dell_jockey,

If you want affordable DbC with a good Windows compiler check out Lingo.

http://www.lingolanguage.com
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Hi GedB,

you get free DbC by either using SmartEiffel or VisualEiffel, see the links above. So getting DbC is not the problem, that's how I learned to appreciate it in the first place.
It's high on my wishlist for PureBasic, because I'd like to see DbC added to my favorite language, rather than having to switch development tools yet again :)

Thanks for your link anyway, I'll check it out the coming days.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

SmartEiffel is a powerful compiler, but I dropped it when the developers decided to break compatability with the GOBO libraries.

It is also rather weak on the GUI front. The new Vision library is a very clever implementation but totally unusable. Wrappers such as the one for Fox just aren't maintained.

To be honest I haven't tried the VisualEiffel. It doesn't give the impression of being supported.

Its a real shame, because Eiffel is such a great language. I wish EiffelStudio could be an affordable option.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

I feel the same about SmartEiffel. It's a great compiler, but breaking GOBO compatibility wasn't a smart move at all.
The Vision library does indeed need a number of iterations, before it will be really usable. I know the team is revisiting this library, now that SE 2.1 is released.
EiffelStudio is indeed way overpriced. I'd never consider using it because of this.
VisualEiffel went the OpenSource route a couple of months ago. Frieder Monninger seems to be responsive to my enquirys/requests, so I'm going to give Eiffel a second chance because of this....
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

I'll have to give Visual Eiffel another look then.

Does it have a full CECIL interface?

The contrast between SmartEiffel and PureBasic always strikes me.

PureBasic is the work of one man with a day job, while SmartEiffel has several programmers and funding.

Yet PureBasic grows so much quicker.

I suspect that SmartEiffel suffers from an over complicated core.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

SE is built by a rather small team, whose interests are firmly rooted in academia. For them, it's much more interesting to implement yet another new technology (often breaking compatibility with prior releases), rather than to create a product that is really stable, debugged and ready for showtime in production shops.
Even while SE is the official GNU Eiffel compiler, the development team is rather closed and not all too responsive to input from 'out there'. If they had a commercial interest in the success of SE, things would evolve much more quickly.

The apparent 'slow' development is all the more suprising if you consider that the SE team only has the Eiffel front-end to develop. For other readers: SE creates ANSI C , which is compilable on a large number of target platforms.

As to VisualEiffel: give it a shot. I don't know about CECIL, the help file (on my Win32 platform) doesn't mention it. It's part of the language specification, so I reckon it should support it. Ask Frieder at mailto:info.ot@object-tools.com

By the way, did I mention that the free VisualEiffel download also includes DisplayMachine? :)
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

CHROME, the ObjectPascal compiler sporting Design-by-Contract has gone final. Check out http://www.chromesville.com/
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Interesting. Not too badly priced, either.
Last edited by GedB on Wed May 11, 2005 9:40 pm, edited 1 time in total.
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

GedB, that's what I thought too. I'm going to delve into this compiler the coming weeks, to find out if it fits my bill.
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

I don't have time. I've got to set to work on my entry for the Eiffel Struggle.
Post Reply