High Integrity Software 238
High Integrity Software | |
author | John Barnes |
pages | 448 |
publisher | Addison-Wesley |
rating | 8 |
reviewer | Jack Ganssle |
ISBN | 0321136160 |
summary | The book describes a language that insures programs are inherently correct. |
What is SPARK? It's a language, a subset of Ada that will run on any Ada compiler, with extensions that automated tools can analyze to prove the correctness of programs. As the author says in his Preface, "I would like my programs to work without spending ages debugging the wretched things." SPARK is designed to minimize debugging time (which averages 50% of a project's duration in most cases).
SPARK relies on Ada's idea of "programming by contract," which separates the ability to describe a software interface (the contract) from its implementation (the code). This permits each to be compiled and analyzed separately.
It specifically attempts to insure the program is correct as built, in contrast to modern Agile methods which stress cranking a lot of code fast and then making it work via testing. Though Agility is appealing in some areas, I believe that, especially for safety critical system, focus on careful design and implementation beats a code-centric view hands down.
SPARK mandates adding numerous instrumentation constructs to the code for the sake of analysis. An example from the book:
Procedure Add(X: In Integer);
--#global in out Total;
--#post Total=Total~ + X;
--#pre X > 0;
The procedure definition statement is pure Ada, but the following three statements SPARK-specific tags. The first tells the analysis tool that the only global used is Total, and that it's both an input and output variable. The next tag tells the tool how the procedure will use and modify Total. Finally a precondition is specified for the passed argument X.
Wow! Sounds like a TON of work! Not only do we have to write all of the normal code, we're also constructing an almost parallel pseudo-execution stream for the analysis tool. But isn't this what we do (much more crudely) when building unit tests? In effect we're putting the system specification into the code, in a clear manner that the tool can use to automatically check against the code. What a powerful and interesting idea!
And it's similar to some approaches we already use, like strong typing and function prototyping (though God knows C mandates nothing and encourages any level of software anarchy).
There's no dynamic memory usage in SPARK -- not that malloc() is inherently evil, but because use of those sorts of constructs can't be automatically analyzed. SPARK's philosophy is one of provable correctness. Again -- WOW!
SPARK isn't perfect, of course. It's possible for a code terrorist to cheat the language, defining, for instance, that all globals are used everywhere as in and out parameters. A good program of code inspections would serve as a valuable deterrent to lazy abuse. And it is very wordy; in some cases the excess of instrumentation seems to make the software less readable. Yet SPARK is still concise compared to, say, the specifications document. Where C allows a starkness that makes code incomprehensible, SPARK lies in a domain between absolute computerese and some level of embedded specification.
The book has some flaws: it assumes the reader knows Ada, or can at least stumble through the language. That's not a valid assumption any more. And I'd like to see real-life examples of SPARK's successes, though there's more info on that at www.sparkada.com.
I found myself making hundreds of comments and annotations in the book, underlining powerful points and turning down corners of pages I wanted to reread and think about more deeply.
A great deal of the book covers SPARK's syntax and the use of the automated analysis tools. If you're not planning to actually use the language, your eyes may glaze over in these chapters. But Part 1 of the tome, the first 80 pages which describes the philosophy and fundamentals of the language and the tools, is breathtaking. I'd love to see Mr. Barnes publish just this section as a manifesto of sorts, a document for advocates of great software to rally around. For I fear the real issue facing software development today is a focus on code ueber alles, versus creating provably correct code from the outset.
You can purchase High Integrity Software from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, carefully read the book review guidelines, then visit the submission page.
hmmm (Score:5, Funny)
Not to be confused with C.A.M. Hoare's famous and profound statement: "Want to see my boobies?"
question (Score:5, Insightful)
Or do they sit around thinking of methodologies to write books about?
Those who can, do, those who can't, teach?
Comment removed (Score:4, Insightful)
Re:question - Answer (Score:2)
Those who can, do. Those who can't, teach.
Those who can't teach, teach gym.
(At least according to Woody Allen).
myke
Re:question (Score:5, Informative)
SPARK Ada came from Praxis Critical Systems. (http://www.praxis-cs.co.uk/). Go take a look. You can read about how SPARK Ada is used in things like aircraft, and (increasingly) in the automotive industry.
Re:Reminds me of the real estate guys (Score:2)
Re:question (Score:2, Funny)
Yes. And I regularly see job adverts specifying SPARK.
Re:question (Score:2, Interesting)
These people have successfully used SPARK on many projects. They also provide the tools making the SPARK approach feasible.
The SPARK approach causes discomfort for many software developers because its approach diverges from that of the various agile development processes.
If you read the book you will discover that the author's claims are supported by real data from real projects.
The SPARK approach is extremely formal. It has frequently been used on the safety critical portions of larger sys
A _review_? (Score:5, Insightful)
Re:A _review_? (Score:4, Interesting)
Re:A _review_? (Score:2, Interesting)
heheh (Score:4, Funny)
"High Integrity Software"
SCO should adopt that as their motto.
But what.. (Score:4, Insightful)
Re:But what.. (Score:3, Insightful)
Re:But what.. (Score:5, Insightful)
In the early days of compilers, one of the claims for compilers was that they would make mistakes impossible. Of course, all they did was make one class of stupid assembler mistakes impossible.
The reason for the verbosity of COBOL is the idea that it would be so like business English that management could read it, if not write it.
Eash time we get a tool that removes one class of mistakes, all we do is increase the systen m complexity until the level of mistakes returns to the previous level of near-unacceptability. "Snafu" is the normal state of the programmers universe - it is only a case of how large a system you build before it all fouls up.
Having said that, Design By Contract is a good idea. While accepting that it is always going to turn to ratshit, you might as well do so at a higher level as a lower one. However, it isn't new: look at Eiffel and Aspect Java for instance.
Re:But what.. (Score:5, Insightful)
Yeah, the article's statement, "The book describes a language that insures programs are inherently correct," is really misleading. Very few real-world programs have ever been proved correct, and the reasons for that are language-independent. Very few real-world problems even lend themselves to a precise mathematical statement of what "correct" would mean. What would it mean for mozilla to be "correct?" Even if your code is running a nuclear reactor, the code can only be as "correct" as the accuracy of the assumptions and engineering data that went into the spec.
In many real-life projects, the nastiest bugs come from requirements that change after the first version has already been written. Proving that a program correctly implements a spec doesn't help if the spec changes.
Re:But what.. (Score:3, Insightful)
That's the beauty of this system. You can close out the issue in your bug tracking database anyway:
"CLOSED: Not a bug; behavior as designed."
Re:But what.. (Score:3, Informative)
A search on Google for formal methods [google.com] will give you a lot of stuff. The first site [ox.ac.uk] that comes up is a good starting point.
Note that at some point, one has to hope that what the client wants is what he has described. A tax calculation programme will not be of use if he really wanted a custom
Re:But what.. (Score:4, Informative)
In real life that's what usually kills people.
_Safeware_ by Nancy Leveson looked at several software-related disasters. Only one disaster, the Therac radiation machine that fried several patients, was the result of actual bugs (and those bugs were race conditions). The rest consisted of software obediently and disastrously doing exactly what it was supposed to do, like the black lab at #7 in http://www.dorsai.org/~walts/darwin.html.
If you build safety-critical software be sure to have some organized way to flush out what-if questions and hidden assumptions.
Car Whores? (Score:2, Funny)
public class interfaces (Score:2, Interesting)
Re:public class interfaces (Score:5, Insightful)
me neither, me too...
my understanding is that the contract has hard requirements on specific input and specific output for results. all of which are defined prior to executing that code. something like "we require an incomming integer with a value that is between zero and fifteen. we gaurantee that an integer value will be returned that is either zero or one"
with a public class interface you can write a peice of code that does this, but it won't gaurantee anything. it's up to the developer to exhaustively test all situations and make sure that it happens. in a contract based language, i would guess that the program either won't compile, won't run, or will fail in obvious ways in the development stage if the requirements are not met. i'm not sure how they handle requirements that aren't met.
Re:public class interfaces (Score:2, Informative)
or a ot of other languages with data validation written at the begging and ending of each method
Re:public class interfaces (Score:5, Informative)
Anyhow, DBC is totally distinct from object orientation. In DBC, each component in your software comes with a "contract" that states "if I am called when the _preconditions_ are true, I promise that after I run the _postconditions_ will be true."
The preconditions and postconditions are a group of logical statements, hopefully ones which are useful to your program
Let me give a little example.
function: sqrt( x )
preconditions:
- integer (x)
- positive (x)
postconditions:
- result > 0
- result * result x
Do you see what's happening there? Without knowing
Adding in object orientation support to DBC is a little more complex, but I won't go into that unless asked.
Traditional DBC systems, including Eiffel, couldn't verify your contracts, so most of them would translate the contracts into code, and include that code in the executable; if a contract failed, the code would throw an exception or otherwise fail. SPARK is interesting because it can detect contract failures without running the code; it can also detect when your contracts fail to promise enough.
-Billy
Re:public class interfaces (Score:2)
Proving sqrt() correctness? (Score:2)
Re:Proving sqrt() correctness? (Score:4, Informative)
i.e. Y, your sqrt, is no more than X when squared, but increase it by 1 and it is more than X. You require X to be non-negative.
Assuming that your implementation implements an initial guess at Y and then repeatedly increments it, you would specify a loop invariant that shows that your guess at Y (say 'Z') is such that (Z+1)*(Z+1) For more information on what's practicable in a customer-specified system, read the peer-reviewed publications...
Disclaimer: SPARK hacker for 6 years
Re:public class interfaces (Score:3, Insightful)
Anyway, I see nothing new in DBC in SPARK not already in Eiffel.
Re:public class interfaces (Score:2)
I also wasn't talking about Eiffel's support for DBC; I was describing DBC in general, or more accurately DBC without OO support. I didn't claim that OO isn't possible with DBC (on the contrary, I stated that it was, and I would explain it if asked). I didn't claim that Eiffel didn't have OO.
And finally, the huge thing that's new in SPARK that isn't in Eiffel i
Re:public class interfaces (Score:2, Insightful)
The code gets written and it turns out to have bugs anyway. We go back to examine everything and notice missing details in the contracts. We fix those problems, the code gets re-written and the cycle continues. In the end we've not achieved much in the way of program correctness, efficie
Re:public class interfaces (Score:2)
The rest of your post absolutely requires the absence of a tool like SPARK. Throw SPARK into the mix, and all your grounding assumptions are absolutely wrong -- the specifications _do_ describe the interfaces, and the interfaces _do_ work together, and the code _does_ implement the specifications, and there are no possible exceptions.
Trivial examples a
Re:public class interfaces (Score:3, Interesting)
int mod(int num, int den)
This lets you add
den != 0
(den = 0)
Then the compiler could automatically write the check for division by 0, and could optimize it out in cases when it can stat
What horseshit (Score:4, Insightful)
Now, is there a language to ensure that your boss asks you to program the right thing?
Re:What horseshit (Score:2)
Never underestimate a BOFH.
References to the story (Score:5, Informative)
Here [praxis-cs.co.uk]is a PDF that contains samble chapters of the book reviewed.
Also from the same site is the following text and links for those of you wanting "real world examples":
"Industrial Experience with SPARK [praxis-cs.co.uk] (PDF 234kb) Dr. Roderick Chapman, Praxis Critical Systems Limted. Presented at ACM SigAda 2000 conference. This paper discusses three large, real-world projects (C130J, SHOLIS and the MULTOS CA) where SPARK has made a contribution to meeting stringent software engineering standards. "
"no obvious deficiencies" (Score:5, Funny)
Wrong order - first test, than code (Score:5, Insightful)
Eurofighter (Score:5, Informative)
SPARK is used heavily in the safety critical software in the Eurofighter amongst other projects. It is a complete pain to type all of the annotation, takes forever to run the tool and it very rarely comes up with any real problems in the code. I would pay good money never to have to go near it again. It was used to meet contractual requirements, not engineering requirements.
One neat trick is to generate a large proportion of the annotation from the output error messages. Sort of defeats using the tool though but since it doesn't find much anyway the time freed up can be used to do some real testing.
Re:Eurofighter (Score:4, Interesting)
> requirements, not engineering requirements.
There be dragons.
> One neat trick is to generate a large
> proportion of the annotation from the
> output error messages
That's classic. It makes sense, though - kind of like running a code reformatter rather than running a "code format checker". Every night, the code gets reformatted to meet the style guide... no nagging emails, just silent enforcement.
Re:Eurofighter (Score:2, Interesting)
Re:Eurofighter (Score:2)
In order to really ensure that the code does the right thing, the contract has to be about as detailed as the code itself. This means that you end up writing the same thing twice, with possibilities for errors in both copies.
If you relax the contract to only partially describe what needs to happen, you create opportunities for bugs to go undetected, and lose the certainty the contracts were meant to provide.
Re:Eurofighter (Score:2, Interesting)
Re:Eurofighter (Score:5, Insightful)
This type of unprofessional crap is the reason people have such low expectations of software. You didn't want to use the tool because it was a "pain to type"?! If the length of time it takes you to type your code is a bottleneck then you're not doing enough thinking before you type. The extar effort requierd to type more verbose code is close to zero. You're coming across like an aeronatical engineer would if they tightened a critical bolt to only 90% of the required torque because it was less effort.
By saying very rarely comes up with any real problems" means it found some, and those problems may have been easily been overlooked by other types of testing. And what are problems wouldn't be "real" in saefty critical code?! Yes, there are other tools besides SPARK that could have been used but the principles should have been the same.
Don't ever forget you're talking about a serious piece of hardware and there's a human being sitting in the pointy end. If I was a pilot of something that had a bug in it's safety critical software because of your lack of pride I would kick your ass.
Re:Eurofighter (Score:2, Interesting)
I think people have such low expectations of software because for the most part, software doesn't meet their expectations, and the expectations people have of software are often unrealistic. Software is like everything else - built with the trade off of cost versus utility.
Re:Eurofighter (Score:2)
You didn't want to use the tool because it was a "pain to type"?!
Boilerplate code, near cut-and-paste code, and highly verbose code produce greater errors, and induce programmer fatigue.
In addition, they make the code harder to understand at first glance.
That's quite important. Much is made of how unreadable Perl can be, but sitting down and trying to figure out the logic and nuances behind a bit of C code is often much, much worse. This is because the C is usually more verbose to do the same thing.
Re:Eurofighter (Score:5, Interesting)
Re:Eurofighter (Score:2, Interesting)
Lockheed has done some really cool things over the years, but I just don't buy this. If they could positively identify the defect rates of these programs, they could just get rid of the bugs in the first place, in the SPARK projects *and* in the C projects. It's more likely they've got some sort of automated checked that catches exactly the same sort of thing that SPARK itself does.
Really, it looks like the SPARK program basically
Re:Eurofighter (Score:2)
And
VLISP sounds much more interesting (Score:2)
Why not use a language that's smart enough to prove code written in a useful language, not just a toy?
Ok... (Score:3)
Re:Ok... (Score:4, Informative)
I would have been interested if all this instrumentation had been grafted onto a language like Java, or C++. But to have to switch to Ada just to be able to add in instrumentation that helps in code analysis?
Switching languages is a tiny effort compared to the change required to design your code for static validation. The SPARK people strongly recommend against trying to "switch" to SPARK; if you want the benefits, you have to code with it from the start. It's kind of like taking a 100,000 line C program written by 30 programmers over 10 years and trying to "switch" it to C++ -- it's theoretically possible, but in practice it's easier to start over.
And what they did in Ada would have been impossible in C++. It's significant that SPARK code will run EXACTLY the same on all compliant Ada compilers. No platform dependancies, no ambiguities, no undefined behavior... ALWAYS the same. You simply can't possibly define a subset of C++ which would be able to make those promises. I don't know if it would be possible with Java; since there's no formal specification of Java, probably not.
It's also funny that he WOW's at the idea of no dynamic memory allocation...
I felt that way too
The reason they did it is simple, though -- they wanted to be able to set absolute bounds on when a SPARK program will or will not fail (throw an exception). There's no way to do that with dynamic memory allocation as it's defined in Ada and most other languages.
Yes, that's limiting; no argument. But for some problems, particularly ones solvable by programs managing their own memory, the limitation doesn't matter compared to the benefits -- a SPARK program can execute without any runtime support code.
Why not just use a type safe language?
No such thing -- type safety is an uncomputable problem.
If you meant strongly typed, that's easy; Ada was already strongly typed. SPARK just guerantees that the programs will always run the same, and SPARK's verifier guarantees that the types are chosen and described correctly.
-Billy
Re:Ok... (Score:3, Insightful)
And what they did in Ada would have been impossible in C++. It's significant that SPARK code will run EXACTLY the same on all compliant Ada compilers. No platform dependancies, no ambiguities, no undefined behavior... ALWAYS the same. You simply can't possibly define a subset of C++ which would be able to make those promises. I don't know if it would be possible with Java; since there's no formal specification of Java, probably not.
I'm not sure what you meant by formal specification here. As I recal
Re:Ok... (Score:2)
You're right that the phrase "formal specification" was a bad choice on my part. Ada doesn't have an official formal specification (although SPARK does); what Ada has is a highly formal official specification, automatically verified by an extensive
Re:Ok... (Score:2, Funny)
Yes, I admit it! It's true that I have not kept up with developments in Ada. I'm still scared by horror inflicted by the original version. And the trauma produced by the Ada design philosophy which produced languages like VHDL.
OK, so they added objects, interfaces and other wonders of modern languages. But it still does not change the fact that Ada is not exactly in the main stream. To continue my walk out on the limbs of issues with which I am only shallowly familiar, I'll speculate that very few
Re:Ok... (Score:2, Interesting)
Theorem proving languages (Score:2, Informative)
Alloy's cool because you can use it to model code at a very abstract, high level (much like SPARK, it seems), although with Alloy you aren't tied to any specific language. The downside is that since the model isn't embedded in the code
Re:Theorem proving languages (Score:3, Insightful)
This industried ability to continually re-invent the wheel never ceases to amaze me.
Let's go back to lisp and smalltalk every frikken language since then is just a rewrite of one or the other anyway.
Re:Theorem proving languages (Score:2)
Alloy lets you model a system (Alloy code isn't executable), and statically prove properties about the model. Once you verify the model, you prove that it's correct for all possible runs (but you still have to implement it correctly).
Programming by Contract? (Score:4, Insightful)
This seems rather a waste of time. You either first describe exactly what the code does, then write the code, or you write a simplification of what the code does, then the code.
In the first case, you write the exact same thing twice, in different languages. That sounds like an immense waste of time to me.
In the second case, your specification does not cover every aspect, which introduces loopholes, defeating the purpose of the contract.
In either case, you get in trouble if there are errors in the contract.
Re:Programming by Contract? (Score:2, Interesting)
For example, will this work with your favorite sorting algorithm? Presumably all sorting algorithms for sets drawn from a given domain will have the same pre and post conditions, but very different algorithms.
Re:Programming by Contract? (Score:2)
It uses acl2 [utexas.edu], a lisp language based prover.
Re:Programming by Contract? (Score:4, Interesting)
Re:Programming by Contract? (Score:2)
And that's exactly where the loopholes are. In functional programming, all there is to a function is what goes in and what comes out. However, I SPARK being a subset of ADA, I think we can safely assume there will be lots of side effects, and reliance on side effects. This makes specifying only pre- and postcondi
Re:Programming by Contract? (Score:4, Interesting)
It's not a waste of time to describe what a function does. It's essential to keep "what" a function does distinct from "how" it does it. That's the whole point of interface versus implementation.
Consider a function with the following contract: Now, can you see how that's useful? And do you see that this tells you something _completely_ different than what you'd know if you read the actual source code for that function (perhaps an implementation of Newton's method)?
In the second case, your specification does not cover every aspect, which introduces loopholes, defeating the purpose of the contract.
That's what SPARK's automatic verifier is for -- to prove that there are no loopholes.
-Billy
Re:Programming by Contract? (Score:3, Informative)
You could, in theory, use to do design by contract, but you'd have to be very careful to put your assertions in the right places, make sure that none of them have side effects, and manually do a few other things that a DbC language automatically takes care of for you. It'd be risky, but it's possible. It becomes MUCH harder when you add object orientation, though; managin
Re:Programming by Contract? (Score:2)
That's like saying disk mirroring and ECC is a waste of time.
The value of writing things twice or thrice is when it turns out it's not the same thing after all. Then you know you have a problem (whether you can fix it there and then is a different problem
If it's significantly easier to write one of the "checks" that'll be rather useful.
Free download of a similar system for Java (Score:5, Insightful)
The best available modern system for formal verification is the Extended Static Checking system for Java [hp.com] developed at DEC SRL. This was developed at DEC before HP shut down that research operation. It's still available as a free download [compaq.com].
What all this machinery does is put teeth into "design by contract". With systems like this, you can tell if a function implements its contract, and you can tell if a caller complies with the contract of each thing they call. Before running the program.
Developing in this mode means spending forever getting rid of the static analysis errors. Then, the program usually just runs. That's exactly what you want for embedded systems. But it's painful for low-grade programming like web site development, where "cosmetic errors" are tolerable and time-to-market matters more than correctness.
Re:GNU Nana for C++ (Score:2)
No, he's just the publicity guru of them. He came late to that technology. C.A. Hoare is probably the "father", back in the 1970s.
Re:Free download of a similar system for Java (Score:2)
If you're involved in that, you might want to look into how we avoided the "false axiom" problem that makes ESC/Java unsound. ESC/Java has an Oppen/Nelson type prover. So did we. But we also used the Boyer-Moore theorem prover, which understands recursion, to prove more difficult theorems. This removed the need for users to add "axioms".
There's so much that could be done in this area. We really do know in theory how to eliminate bugs. Somebody needs to make
Sounds like Resolve (Score:3, Interesting)
The basic idea was that they added a whole ton of syntactic sugar to C++ (not by structured comments, but by adding a bunch of key words that were #defined into nothing). I'm curious if this is related to that work at all. (At the time I was convinced that it was total crap, but several years of experience have shown me what they were trying to accomplish, if poorly.)
Why not make the tester the compiler? (Score:3, Interesting)
Re:Why not make the tester the compiler? (Score:3, Informative)
> to get both the test and the code that
> passes the test!
This came up on the Extreme Programming list a while back. I think the Java IDE IDEA [jetbrains.com] does something like this, in that you can write a test and it'll generate the source code for the method signatures that you're trying to test. Then you fill in the implementation. *Disclaimer - I haven't used that feature so I don't know how well it works*
One problem with this, though, is that code can pass a test but s
Software deserves more respect (Score:4, Interesting)
Since so much of what we depend on these days is powered by software, I can't help but feel that industrial software development should be taken under the wing of Engineering. Why, you say? Well, professional fields like medicine, law, and engineering associate a duty to public safety with the job, and the regulatory bodies for the professions ensure that individuals who practice irresponsibly will lose their profesional status.
There is no such accountability for software development. Look at Microsoft Windows, that our banks and governments rely upon! I think such a product would be much higher quality if the coders working on it were professionals and had to adhere to Codes; violating their professional duties would mean severe personal consequences. And the firm itself (Microsoft) would be legally liable if it produced a shoddy, dangerous product!
Re:Software deserves more respect (Score:2, Insightful)
Secondly, we have the entire legal syst
Re:Software deserves more respect (Score:2)
UNIX:
runs databases (commercial)
runs manufacturing equipment (industrial)
runs handheld portable units (specialized) and I've seen it used on a SPRC box as a controller for BAS (big ass switches)
and it is currently easy to get a copy of Linux, BSD or Solaris running in your bedroom.
Your arguments do not hold water.
Re:Software deserves more respect (Score:2)
Re:Software deserves more respect (Score:2)
Re:Software deserves more respect (Score:2)
Delphi Assert (Score:2)
1. Global vars: BAD.
2. Borland Delphi has had some of this for while with the assert [about.com] function.
It's basicly a way of making sure that all the things that can't go wrong, actually doesn't.
Re:Delphi Assert (Score:2)
I believe the instrumentation shown in the article is intended to be read in by an analysis tool, which should, in theory, find errors/inefficiencies that you as a programmer may not have noticed, and hence wouldn't have represented within asserts. But, as has been mentioned before in another comment, such errors are rare enough to not justify having to migrate to Ada and write so much extra instrumentation.
using ada is enough (Score:5, Interesting)
For example ada already had constrained types (x
The ada compiler checks alot of things during compile time that I've never seen before.
constraint errors are exceptions in ada (Score:2)
In our ada code constraint errors are handled by the exception handling. Also note that a lot of our messages/values are comming from hardware from external hardware, so we have little control over what we're getting, so read in the message into unconstrained types and then convert. We test each potential incomming message against max/min theoretically posibly values. So we think we have most of it handled.
I'm not saying I'm against the idea of SPARK, it just seems to duplicate all
Ummmmm... (Score:4, Interesting)
Basically the only excuse you could possibly have for writing something in SPARK is extremely critical code (ie, if it fails, many people die). Even then I'd be skeptical it would provide much benefit, but at least it would provide some ass-covering ability.
For a alternatve view of the practicality of correctness proofs, see chapter 4 [cypherpunks.to] of Peter Guttman's thesis. IIRC there was a book review of it on
"No programming language can save you from yourself."
- Me
Re:Ummmmm... (Score:3, Insightful)
My Dad hand-patches microcode on 60s-era safety systems in a chemical plant for a living. It's pretty intense.
Perl is pretty far from a B&D language, but I'd sure hate to see an autopilot written in perl, no matter how productive or satisfied it made the coder.
The happiness of the coder is not really the issue. If we could get safe, secure, reliable software by coding them in restrictiv
Re:Ummmmm... (Score:2)
I'm sorry, but that statement is factually incorrect.
Pratt & Whitney collected metrics on jet engine controller software devel
Re:Ummmmm... (Score:2)
The military controllers were all in Ada, the civilian engine controllers were in various things, with C/C++ heavily represented. The team capabilities were about equal across the board. After they crunched the data down, they discovered that Ada was giving them twice the programmer productivity and 1/4 the defect density.
On an offtopic note, I remember a study comparing Fortran 77 and C in a scientific/techical setting, and the conclusion of that was that Fortran codes had 1/2 the defects of comparable
Newspeak (Score:2, Interesting)
SPARK seems to be an extreme example. Though I've never used it, I venture to guess that in a quixotic effort to avoid all bugs SPARK only buries real bugs underneath a mountain of its own pedantry.
Eiffel and Sather (Score:2, Informative)
I needed this six months ago (Score:4, Funny)
IMHO the only way to go (Score:2, Insightful)
"The true measure of a good coder is not how complex his code is, but how simple."
Today's software systems become bigger, bigger, and bigger. Maybe single components are simplified, debugged or optimised, but not a system as a hole. The results we see today, in many systems, a single slip in one place, can screw up the entire system.
IMHO the logical way to combat this, would be to design software using methods that can
Re:IMHO the only way to go (Score:3, Informative)
Proving non-trivial programs correct is nearly always intractable, if not strictly speaking impossible. We simply don't have the computing power to do it for larger programs, and (IMO) we probably never will.
Re: the limits of proof (Score:2)
To expand on the point made above...
Let us assume that we have a magic proof system that will prove that our software matches our specification.
So what do we use to define the specification? Certainly not a natural language like english. Natural languages are full of ambiguity. So we'll use a formal specification language. However, such a language is basicly like a programming language, perhaps supporting more mathematical formalism (maybe single assignment). While our formal proof system can prove
Homeland Security (Score:2, Insightful)
Knuth said it best... (Score:3, Interesting)
Agile methods (Score:3, Insightful)
I have to disagree here, the agile methodologies I'm aware of stress automated unit testing to ensure the code that follows meets the specifications. They are agile because the "contract" enforced by the unit tests allow you to see what you have broken easily after a change. If your unit tests pass then you've either not broken anything or your test coverage is insufficient. It seems that these SPARK "tags" have some of the benefits and all the problems that a good suite of automated unit tests provides.
I do however like the idea that your assumptions and dependencies are explicitly mentioned nearby where they occur. These are things that definitely sting you, especially in code you are new to (written by someone else.) All the little interdependencies and unexpected side-effects that make their way into code can really make life difficult sometimes.
I have a feeling though that this would take discipline, and if all team members were skilled and disciplined then you would likely have much of these things stated anyway.
Oracle PL/SQL packages do something similar (Score:2)
This enables procedures to be public in scope (present in both PACKAGE and PACKAGE BODY) or private in scope (present in PACKAGE BODY only). Other elements, such as user-defined data types, constants and cursor definitions, can be part
25 years after the first type inferencing systems. (Score:2)
Re:Just a toy, or what? (Score:2, Informative)
Re:Another ADA proselytizer (Score:2)
Re:Check out D (Score:2, Interesting)
Yes D is interesting. Only, like Eiffel, it concentrates only on procedural contracts and lacks type contract.
SPARC, being based on Ada does have type contracts:
type Day_Of_Month is range 1 ..31;
BTW: The example won't work. It does not take into account the fact that math.sqrt(x) only calculates an approximation - which is truncated to long. Correct examples have been posted before - by SPARC hackers.
It is not a good sign that the D developers made such an obvious mistake.
With Regards
Martin