From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a9b0810d3106d9b8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!x37g2000prb.googlegroups.com!not-for-mail From: =?ISO-8859-1?Q?Elias_Salom=E3o_Helou_Neto?= Newsgroups: comp.lang.ada Subject: Re: Fun with C Date: Mon, 18 Apr 2011 12:12:58 -0700 (PDT) Organization: http://groups.google.com Message-ID: <57a1fa4b-4730-41a8-be8a-82061ef9dc22@x37g2000prb.googlegroups.com> References: <27cf3992-4132-4483-9110-adc7a089cd4a@e8g2000vbz.googlegroups.com> <54108d8d-4e7c-4901-bd5e-819d27720d48@a11g2000pro.googlegroups.com> <4daa8fc6$0$7652$9b4e6d93@newsspool1.arcor-online.net> <37428a21-61b4-4cdf-9897-7b84252f8fce@a11g2000pro.googlegroups.com> <4dab6906$0$6893$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: 143.107.183.162 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1303153978 3604 127.0.0.1 (18 Apr 2011 19:12:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 18 Apr 2011 19:12:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: x37g2000prb.googlegroups.com; posting-host=143.107.183.162; posting-account=8auP9QoAAACkSx2qxJhP83KA6-tg78E8 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/534.8 SUSE/7.0.528.0 (KHTML, like Gecko) Chrome/7.0.528.0 Safari/534.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:18865 Date: 2011-04-18T12:12:58-07:00 List-Id: On Apr 17, 7:26=A0pm, Georg Bauhaus wrote: > On 4/17/11 9:35 PM, Elias Salom=E3o Helou Neto wrote: > > > Someone has written a line of code without knowing what it does. Is it > > a language problem? Not that C is spectacular, but blaming the > > language here is not fair. Minimally competent C programmers do know > > about such conversions. > > OK, that's a claim. =A0Michael Barr seem to have found results > contradicting it if the "minimum" is what you minimally > find with professional C programmers. In his netrino.com embedded > C quiz, he found that US takers got at D+ on average. > That's a real world, observable minimum, then. > > I suggest turning to observable facts and away from > normative ontology for a moment. =A0Towards justifiable > language design. > > Whenever a statistical phenomenon is observed, > many start looking for correlations and hypotheses. > Here, we have errors related to the / operation and > the promotion rules of C's $6.3.1. =A0Is there a correlation? > Will the correlation between error rates and language > rules =A0be the same if using another language? > Is that other language intrinsically better or worse, then? > > If there is a correlation between the frequency of a number > of programming errors (in this case related to +,-,*,/ etc) > and the way the corresponding part of the programming language > is defined (in this case operand treatment), then I suggest > the following > > Hypothesis 1: > > A language A is better designed than another B if, > after comparable introduction to the languages, > programmers of an A-group make fewer mistakes than > programmers of a B-group when implementing the same > algorithm. > > If so, then competent, informed language *design* will have to > consider expected error rates when defining the language. > Because the definitions affect error rates. > > A second perspective: > > Definition: The complexity of / (or another language feature) is > the number of concepts that a human mind will have to connect > properly in order to use / (or another language feature) correctly. > > Assumption: =A0Programming is a human activity. > Since programs express human ideas, clear means of expression reflect > programmer intentions better than formally implicit means that > in addition depend on statements outside the language, as is the > case with C's fundamental types. > > I suggest, then, > > Hypothesis 2: > > A language A is better designed than another B if an > understanding and using the language properly is less complex, > that is, in order to express the same algorithm, > > (a) it requires thinking about fewer interconnected, possibly > implicit concepts and > > (b) depends less on statements outside the language. Ok, Ada is better than C, but if you wish we can find a metric whereby C is better than Ada as well. I won't argue on that. Specially, your metric seems to imply that Ada is much better for those who find it hard to think, most people after all. It is just that industry standard is no standard. Hired programmers are dumb and incompetent - because those are cheap, there are lots of them. Look above for someone who say that has been programming professionally in C for 30 years but doesn't know type promotion rules. If you are to design a language for those guys, good luck. I am a researcher, I do not have to, that's why I am happy with C++. Those who have designed C, have done so for people with brain, for real computer scientists. It is not the way to go with professional programmers these days, so don't blame C for its popularity. Of course Ada is a better approach for the masses. You've made your point: programmers, as it happens with people in general, are dumb. Let us create a language for them. However, here is my piece of advice: it won't work. See Ariane 5's example. Ada may give programmers a false sense of security, leading to even more sloppiness. If I knew it well, I guess I would advocate Ada for parallel programming. Even the smartest researcher gets surprised sometimes by the perils of concurrent software and some extra safety here is really welcome. As long as it does not come at expense of performance, of course, since this is likely the goal in parallel software. Surely Ada would be a good and justifiable choice for most industrial programming projects, but this is not what C was planned for - don't blame it. Is an airplane's fault if someone without proper knowledge tries to fly it and kills hundreds? Is a spaceship fault if an airplane pilot feels competent to fly it and ends up killing thousands? Elias.