Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail From: Rui Maciel Newsgroups: comp.lang.java.programmer Subject: Re: Teaching kids to program (in Java) Date: Fri, 13 Apr 2012 14:06:28 +0100 Organization: Aioe.org NNTP Server Lines: 56 Message-ID: References: <4f87624e$0$287$14726298@news.sunsite.dk> Reply-To: rui.maciel@gmail.com NNTP-Posting-Host: AqItoBXOUTdaiWbH4r55cA.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@aioe.org User-Agent: KNode/4.7.3 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:13518 Leif Roar Moldskred wrote: > In my not particularly humble opinion, Java is too crufty to make for > a good introductory language. There are too many old sins and too > many idiosyncrasies in the language that are likely to confuse or > stump someone who doesn't already know how to program. > > (Why isn't the first element of an array at position 1? The term "array" refers to a collection of objects which were allocated in a continuous memory segment. A reference to an array points to the first object of the array. The array index represents the offset with regards to the first element. So, index 0 means a zero offset from the first object of the array (i.e., address of first object in the array), index 1 refers to the object which is 1 object size after the first object (address of first object + 1 object size), array 2 is two objects, and so on. This isn't an "old sin" or an idiosyncrasy. It's exactly what the programmer intends to do. If the programmer isn't aware of that then it isn't a shortcoming of the programmer language; it reflects a lack of understanding regarding what he is doing and what he is trying to do. And this does not mean that the language doesn't make for a good introductory language. > What's the difference between int and Integer? The former is a primitive, while the latter is a reference to an object of type Integer. This is covered in any introductory tutorial. > Why doesn't System.out.println( > "Value: " + 01234 ) work? Why do you believe it doesn't work? You've used an octal integer literal to express the value of an integer number. You get exactly what you asked for. > Why do I get a NullPointerException on the > line "System.out.println( factorial( inputValue ) );"? You have to be a bit clearer with that, as you haven't defined inputValue or factorial(). > What is a Null Pointer, anyway?) I don't believe it is reasonable to accuse any programming language of being "too crufty to make for a good introductory language" if the only problem which has been pointed out boils down to ignorance regarding how to use that programming language. No programming language, no matter how appropriate it might be as an introductory language, enables you to write any code without first learning how to do it. Rui Maciel