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=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Teaching C/C++ from Ada perspective? Date: Tue, 3 Jul 2018 09:56:29 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <856189aa-fa00-4960-929e-174f352310ad@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 3 Jul 2018 09:56:29 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="ce2f6ac4d8fe7ffb360f1ac6781f895f"; logging-data="13536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180KlByLCc4isZZpDMYfggEdxyIs3w8ZcA=" User-Agent: Pan/0.141 (Tarzan's Death; 168b179 git.gnome.org/pan2) Cancel-Lock: sha1:ulmODnUyyguWZw7RsU8eGIvCtI4= Xref: reader02.eternal-september.org comp.lang.ada:53524 Date: 2018-07-03T09:56:29+00:00 List-Id: On Sat, 30 Jun 2018 11:04:29 -0700, kouaoua16 wrote: > Hello, > > Ada is my programming language of choice. I have used it much in > scientific programming. At an University I am asked to teach programming > but in C and C++ to fist year students. After having spent some years > with Ada, I'm relecutant to "throw away" my good programming habits from > Ada and embrace C/C++. I would like to know if there exist(s) good > book(s) at introductory level for C/C++ that may go in the spirit of Ada > so that I won't feel wasting my time and energy teaching C/C++? > > Also I will start the above course with Algorithms in which I have > little knowledge. Any suggestions for good books on this topic? > > In some ways Steve McConnell's "Code Complete" may be a good book to look at... While it focusses neither on algorithms nor on teaching one specific language, it is strong on good practice for creating readable, maintainable programs. He does have a few nice things to say about Ada - regrettably, usually in the past tense. But much of what he pushes as "good practice" (which is optional in C or C++) would be enforced by Ada - many of his "bad" examples simply wouldn't get past an Ada compiler - many more than he gives Ada credit for. I also like Luke's idea of teaching Ada and C and C++ in parallel - if you have to teach algorithms too, this idea may be supportable; you can introduce a safe and highly readable version of the algorithm in "pseudo- English" like "for i in my_array'range loop ... end loop" before describing how it maps onto C and where the pitfalls are (arrays don't contain their bounds, the lower bound is always 0 and you have to pass the upper bound separately; don't forget it's one less than the length, security features, etc etc, - and how it maps differently to C++. Last time T looked, that was "don't use arrays, use std::vector instead", but that's probably obsolete now. You don't even have to mention that the "pseudo-English" version will compile and run without the landmines... -- Brian