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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fef3ad775ef4b0b7 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!bnewspeer01.bru.ops.eu.uu.net!emea.uu.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!ada-augusta.INVALID.demon.co.uk!newsreader From: Mike H Newsgroups: comp.lang.ada Subject: Re: Ada for 1st year students Date: Sun, 12 Oct 2008 00:37:07 +0100 Sender: Mike-h Message-ID: References: <60e0c5f0-1e17-4add-b21e-b1ef622d5233@v13g2000pro.googlegroups.com> <6gj2s5-0f9.ln1@newserver.thecreems.com> <543356bc-7862-45d2-9004-dfef69deab26@79g2000hsk.googlegroups.com> <3m65s5-33u.ln1@newserver.thecreems.com> <606df221-6074-4732-b5e7-de74700b3e9a@t41g2000hsc.googlegroups.com> <158iljyiunpyy$.172hhzc98hoef$.dlg@40tude.net> <9955de2c-f74a-4c2b-b513-56c130a5f1ee@k16g2000hsf.googlegroups.com> Reply-To: Mike Hopkins NNTP-Posting-Host: ada-augusta.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain;charset=us-ascii;format=flowed X-Trace: news.demon.co.uk 1223768322 27185 83.104.138.185 (11 Oct 2008 23:38:42 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 11 Oct 2008 23:38:42 +0000 (UTC) User-Agent: Turnpike/6.03-U (<8c+$+zb077Pti5diXa8NqJs7Yt>) Xref: g2news2.google.com comp.lang.ada:8067 Date: 2008-10-12T00:37:07+01:00 List-Id: In message <9955de2c-f74a-4c2b-b513-56c130a5f1ee@k16g2000hsf.googlegroups.com>, amado.alves@gmail.com writes >And for starting they will even use a package that predeclares >variables I, J, K, L, M as integers, X, Y, Z as reals, etc. That's my >approach anyway, logic first, types later. They just include the >package and voila, by magic, all the variables in the pseudocode are >there for usage in the same way. Later I will explain this magic, by >looking inside the package, and then they will redo their programs >sans that package. I really do think that types are fundamental to good Ada code. When I taught Ada I started with types. Before they even saw a line of Ada code I would get class groups discussing 'time' and 'duration'. - are time and duration interchangeable? - if you subtract a time from a time, what do you get? - what about other operations on a pair of time variables? - what about operations on duration variables - are there any sensible multiplication or division operations Usually the discussions got quite heated and that was the object of the exercise! By the time they were called to order, their minds were much more open to the concept of strict typing (especially those who had had other programming experience such as C). I then gave some simple examples and exercises using a package declaration containing pre-declared integers, minutes and time (time as minutes since some arbitrary event) to demonstrate how errors at compile can be 'friendly'! My 'magic' was to follow that up by showing them the package body code. -- Mike Hopkins