Fixing programmers
Fixing programmers
Posted Mar 18, 2019 21:46 UTC (Mon) by rweikusat2 (subscriber, #117920)In reply to: Fixing programmers by mathstuf
Parent article: Cook: security things in Linux v5.0
Posted Mar 18, 2019 22:11 UTC (Mon)
by Cyberax (✭ supporter ✭, #52523)
[Link] (9 responses)
Posted Mar 18, 2019 22:29 UTC (Mon)
by rweikusat2 (subscriber, #117920)
[Link] (8 responses)
As person who spends a seriously lot of time working with other people's code (and has done so for about 15 years), I can assure you that I don't give $random_small_quantity_of_money for documentation of "programmer intent", especially not in form of otherwise uninformative comments. I need to know what the code does, not what someone believed it should be doing.
Posted Mar 18, 2019 22:33 UTC (Mon)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Correctness checking is TRIVIAL, it's not even worthy of mentioning. Checking of intent is anything but. And that's exactly why modern computer languages try to make it easier for developers to express their intent through code.
Posted Mar 18, 2019 22:39 UTC (Mon)
by sfeam (subscriber, #2841)
[Link]
Posted Mar 19, 2019 12:24 UTC (Tue)
by anselm (subscriber, #2796)
[Link] (5 responses)
The goal of computer programming is to write code that does what it is supposed to be doing. You can use the code itself to figure out what it does, but you can't use the code itself to figure out whether it does what it is supposed to be doing.
It's very easy to write code that does something. Writing code that does what it it supposed to do is a lot harder, and requires outside context so you can determine when you're done. This is why in Real Life™ we have comments, specifications, unit tests, and so on – all to be able to figure out whether code does what it is supposed to do.
Posted Mar 19, 2019 14:14 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link] (4 responses)
Posted Mar 19, 2019 14:31 UTC (Tue)
by NAR (subscriber, #1313)
[Link] (3 responses)
How can you check correctness when you don't know what that code is supposed to do?
Posted Mar 19, 2019 14:43 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link] (2 responses)
Posted Mar 19, 2019 14:55 UTC (Tue)
by NAR (subscriber, #1313)
[Link] (1 responses)
You're making the assumption that this particular access was not intended. So intent matters.
Posted Mar 19, 2019 14:59 UTC (Tue)
by mathstuf (subscriber, #69389)
[Link]
Posted Mar 19, 2019 10:02 UTC (Tue)
by NAR (subscriber, #1313)
[Link] (3 responses)
Let's say I have this code snippet:
Posted Mar 19, 2019 21:44 UTC (Tue)
by neilbrown (subscriber, #359)
[Link] (2 responses)
Yes it is.
Posted Mar 19, 2019 22:03 UTC (Tue)
by pizza (subscriber, #46)
[Link] (1 responses)
Posted Mar 19, 2019 23:24 UTC (Tue)
by neilbrown (subscriber, #359)
[Link]
Sorry to correct you, but I think you mean "It is correct that 'The Therac-25 killed three people' ".
And this is the point - when people start using broad terms like "intent" and "correct" without ensuring that all corespondents are using them in the same sense, you can hardly expect a useful conversation to result.
(wouldn't it be great if people would think about what they write, instead of just writing about what they think).
Fixing programmers
Fixing programmers
Fixing programmers
So you need to know the intent. Duh. You're just deluding yourself at this point.
I believe you have this backwards. What the code does can be determined in the absence of comments. The intent, not so much. That is why comments are valuable for bug-finding. Any place where the documented intent does not match the observed actual behavior is candidate for causing problems.
Fixing programmers
Fixing programmers
Fixing programmers
what the intent was actually doesn't matter and correctness is all that counts.
Fixing programmers
Fixing programmers
that allows you access to something else that you normally wouldn't be able to access.
Fixing programmers
Fixing programmers
Intent doesn't matter. Correctness does.
Fixing programmers
a = b + c;
Is it correct?
Fixing programmers
Your statement "I have this code snippet: a = b + c" is self-evidently correct.
Fixing programmers
Fixing programmers
