4 ms·
Ada's strong static typing may also produce less buggy code.
by fuball63 9y ago
Ada's strong static typing may also produce less buggy code.
- rbanffy 9y agoI don't think it helps producing fewer bugs, but it makes writing some kinds of bug much harder.
- RhodesianHunter 9y agoThis two statements seem to contradict each other.
- rbanffy 9y agoYou'll write different bugs in different languages. You can't leak memory in Java (you can, but it's very hard), for instance, as you can in C. In Python, I often write code that barfs when it gets an object of a wrong type because parameter types are simply not enforced. The bugs I write in Lisp are entirely different from the ones I write in C. We'll always write bugs.
- nickpsecurity 9y agoThat's not the point, though. The point is that Ada lets us write without much extra effort: 1. Way fewer bugs in general. 2. Fewer severe bugs that become full-on crashes or hacks. 3. Fewer bugs we cant fail-saif on and/or recover from. Not all bugs are equal by far. Just see Rust's panics vs C's donate-PC-cycles-to-hackers technique.
- rbanffy 9y ago> C's donate-PC-cycles-to-hackers technique. I'll totally use that.
- kqr 9y agoBut if we agree that Ada reduces one kind of bug compared to, say, C, then we'd also have to come up with a class of bugs which Ada makes easier to write, in order to say that the number of total bugs stay constant while one kind decreases. I can't come up with such an example. You're right in that things are rarely black and white, but when it comes specifically to bug prevention, I think Ada is a strict improvement over many alternatives.
- nickpsecurity 9y agoHere's an apples to apples study proving otherwise: http://archive.adaic.com/intro/ada-vs-c/cada_art.pdf http://archive.adaic.com/intro/ada-vs-c/cada_art.pdf The others from that time period by the military and defense contractors showed something similar. In only one case did I see C++ and Ada tie but why wasnt evident. Note this was before automated proving in SPARK, Design-by-Contract in Ada 2012, and co tract/type/property-based testing tech. The numbers would likely be even higher. Of course, one would want a comparison against tech designed for same things in C which are plentiful now.
- rbanffy 9y agoI was talking specifically about the strong typing, but this is an awesome study comparing two languages with strong typing. Thanks for sharing. There probably is a point where the strictness of the typing starts influencing the bugginess of the code.
- irundebian 9y agoC isn't typed strongly.
- rbanffy 9y agoThe parts that allow you to do unsafe casting are easily detected by a static analysis.
- dozzie 9y agoYou'd be surprised how much code you can move from conditional instructions to data types if you have a good type system, and if this type system is a static one, you get it checked before your program even starts.
- vram22 9y agoF# has this too. Other languages too, of course. Heck, even Pascal has a limited form of it - enumerated types and user-defined array types etc. - years ago.