Chad Perrin: SOB

29 July 2009

Language Deathmatch: Basic vs. Logo

Filed under: Geek — apotheon @ 05:17

(addendum: I’ve also written Language Deathmatch: Small Basic vs. UCBLogo, for those who are interested in my take on such an implementation vs. implementation comparison.)

Google has announced the development of a BASIC variant called Simple, aimed at being an LFM, and intended for use in Android development. My initial reaction was “Why BASIC?” This feels surprisingly like a case of those who are ignorant of history, or at least in denial about it, being doomed to repeat it. Why use a crappy LFM reputed for its encouragement of bad habits, instead of one that is also clearly an LFSP?

(For more about the difference between LFMs and LFSPs, you could take a break from this to read Michael Vanier: LFM and LFSP. If you already need a break from this, though, there’s something wrong.)

A few people in reddit discussion disagreed with me, but that’s not exactly a very good venue for developing a clear comparison of BASIC and Logo for the purpose of demonstrating the unsuitability of yet another BASIC variant for educational purposes when better options are available.

BASIC

BASIC, influenced by ALGOL and FORTRAN, was created by John George Kemeny and Thomas Eugene Kurtz to serve the purpose of an educational programming language for people who weren’t science students. In the 1980s, it shipped with quite a few home computers, and was as a result the first programming language many people — including me — encountered and used.

Initially, there was not much of a natural learning path from BASIC to other languages. In the ’80s and ’90s, however, some more powerful descendants of BASIC have been developed, most notably including Microsoft’s Visual Basic.

Logo

The LISP family of languages — including Scheme and Common Lisp — also includes Logo. Where Common Lisp never pretended (as far as I’m aware) to be anything other than a language for experts, Scheme was created specifically as both a simplified notation for demonstrating principles of computer science and a practical programming language that can be used to get Real Work™ done. Beneath the level of Scheme, however, lies Logo, which was specifically created as an educational language for children.

The inventor of Logo, Seymour Papert, said in Redefining Childhood: The Computer Presence as an Experiment in Developmental Psychology, that:

[M]ore important than having an early start on intellectual building is being saved from a long period of dependency during which one learns to think of learning as something that has to be dished out by a more powerful other. Children who grew up without going through this phase may have much more positive images of themselves as independent intellectual agents. Such children would not define themselves or allow society to define them as intellectually helpless.

Logo was designed from the very beginning as a means of not just handing data to children and expecting them to memorize it, but giving children the tools of autodidactism and helping enable them to explore new concepts and learn new things for themselves. That’s a pretty good beginning, I think. In addition to that, however, there is also a natural path of progression from Logo to Scheme or Common Lisp, and the wealth of excellent computer science texts and classes that use Common Lisp and especially Scheme as tools of learning ensures that there’s always more to be learned with a minimum of additional preparation by moving to a drastically different, more capable language.

Even better, there are dialects of Logo itself that are suitable for much the same uses as Scheme and Common Lisp (though they tend to lack library support). UCBLogo in particular is a stand-out example of excellence, going so far as to provide even metaprogramming macros, and is far from the only Logo dialect to do so. Logo has also been adapted to other uses, such as LEGO Mindstorms programming — and what’s more educationally encouraging in a programming language than the ability to program your LEGO blocks?

Logo’s initial design was optimized for use controlling robots, including a device called a “turtle” that could be made to wander around on the floor drawing lines like a particularly high-tech Etch A Sketch. Since then, a turtle graphics feature has been added to most Logo implementations, allowing the educational value of the turtle to be included with Logo even where a physical turtle is impractical, adding an even more immediate educational feedback capability to the language implementation.

In some respects, unfortunately, Logo has been a victim of its own success as an educational language aimed at children. It is, in fact, a better designed general purpose language than many languages that have been used professionally by adults for many years, but it is still regarded largely as a “toy” that’s only suitable for children. Turtle graphics in particular has been both a great boon to people who wish to introduce children to programming concepts and a limiting factor for the recognition of the Logo language itself, as most people who have heard of Logo seem unable to even distinguish between turtle graphics and the Logo language itself.

Comparison

Truth be told, I can’t even think of anything bad to say about Logo. It even manages to overcome the common complaint about LISP languages by being less cryptic in the names of its language primitives, and in eschewing parentheses for simple operations.

Meanwhile, famous computer scientist Edsger W. Dijkstra has had some well-known harsh words to offer about BASIC, in EWD898: The threats to computing science:

I think of the company advertising “Thought Processors” or the college pretending that learning BASIC suffices or at least helps, whereas the teaching of BASIC should be rated as a criminal offence: it mutilates the mind beyond recovery.

He has said so on more than one occasion. In EWD498: How do we tell truths that might hurt?, he said:

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

This may be a bit of hyperbole (at least I hope so, for my own sake), and he has had similarly scathing things to say about APL, COBOL, and FORTRAN. One might wonder if he just hates languages whose names are acronyms or initialisms.

Still . . . if his intent was to point out that BASIC suffers some deeply troubling issues — particularly as an educational language — he’s right. He’s especially right when BASIC is compared to other possibilities, such as Logo.

Some comparative benefits and detriments of each language follow:

  • Turtle graphics capabilities give Logo a significant advantage over BASIC for a low bar to entry.

  • Old-school BASIC is a line-oriented programming language that doesn’t just fail to provide any more advanced capabilities for students who have moved beyond the most simplistic early stages of learning to program, thus limiting the amount of continuous progress one can make before having to change tools, but even specifically encourages bad programming practice. The addition of arbitrary labels to make goto statements easier to use is far from an ideal way to teach people to program well.

  • A good Logo implementation, as an effectively feature-complete LISP, scales upward indefinitely. Aside from specific descendants of BASIC that are not even recognizably BASIC any longer, BASIC doesn’t scale up at all, really.

  • The complete inability to avoid doing anything in a global scope in early BASIC dialects is substantially limiting, to put it kindly.

  • Visual Basic, despite being an unrecognizably modified variant of BASIC, still suffers serious shortcomings (yes, some of those have changed in recent versions, but other problems have arisen). Worse yet, in order to solve the problems of more primitive, older dialects of BASIC, it has utterly ceased to be an appropriate tool for education of young children.

  • To “solve” the problem of modern BASIC descendants that are unsuitable to use as educational languages for children, Microsoft has come up with Small Basic. It is indeed a greatly simplified language, easy for young people to pick up quickly, but it has unfortunately reached that point only by having most of the benefits of other modern BASIC descendants cut out of it.

  • Logo to Scheme and/or Common Lisp provides a more natural growth path than BASIC to any modern BASIC descendant that is actually good for anything in the Real World™.

Conclusion

I think that pretty well sums it up. I’ll add additional notes if I get any comments that warrant inclusion. As things stand, though, I can’t think of a single reason to favor BASIC over Logo as an educational language.

27 July 2009

Statistics 101 Lab: Examples

Filed under: Cognition,Geek,Liberty — apotheon @ 12:49

For some reason, a number of people who read Statistics 101: US Gun Crime vs. UK Knife Crime completely missed the key points. In summary, those points are:

  1. Comparing crime rates of two locations with significant cultural, legal, and geographical differences, situated in very different surrounding environs, will not provide meaningful statistical evidence that legal restrictions on firearm ownership reduce any crime rates. This is because other factors (such as those cultural, firearms unrelated legal, geographical, and environmental differences) can very easily overwhelm the differences that may be caused by any legal firearms restrictions.

  2. There is nothing magical about “gun crime” that makes it necessarily a good thing to reduce the rate of “gun crime” without any regard for the effects on crimes related to other factors than firearms. As I said in discussion following Statistics 101: US Gun Crime vs. UK Knife Crime, if you get murdered:

    [You’re] not going to much fucking care whether the act was committed with a gun, a knife, or a sharpened kewpie doll.

In case clearly spelling out the point about regional crime rates here, in summary, is not enough to make the point obvious to readers, I’ll offer some more regional examples of the sort of statistical comparisons I would reject as not sufficiently rigorous to provide evidence as good as a comparison of conditions before and after a significant change in firearms laws:

  • Illinois and Indiana are neighboring States — much closer and, as two States within the US, at least theoretically far better choices for a comparison of violent crime rates and gun laws than the US and the UK. All crime rate statistics are per 100K per year.

    Statistic Illinois Indiana
    2007 Total Violent Crime 533.2 333.6
    2007 Murders 5.9 5.6
    2007 Forcible Rapes 31.9 27.5
    2007 Robberies 179.7 124.1
    2007 Aggravated Assaults 315.7 176.4
    1960-2007 Avg. Murders 8.59 6.07
    1960-2007 Max Murders 11.8 8.9
    1960-2007 Min Murders 4.8 2.8
    Carry Laws No Concealed Carry
    Carry Prohibited in Vehicles
    Open Carry: Unincorporated Areas
    Shall-Issue Permits
    Carry in Vehicles with Permit
    Open Carry with Permit
    Ownership Laws Firearm Owner ID
    Handguns Prohibited in Chicago
    No License to Own
    No Handgun Restrictions
    Sources IL Crime Rates 1960-2007
    IL Open Carry
    IL Concealed Carry [PDF]
    IN Crime Rates 1960-2007
    IN Open Carry
    IN Concealed Carry [PDF]

    Note as well that the murder rate was higher in Illinois than in Indiana every single year from 1960 to 2007. There is not one single exception to that rule.

Actually, I’m going to stop here, and make this a one-example list for now, because I’m getting too interested in this statistical analysis. That doesn’t mean I’m going to stop working on these stats, or that I will not produce more comparisons, but I’m going to stop working on it for this particular SOB entry because this one table is already getting too long. I’ll make sure to link to more comparisons when I have worked them out. Writing Ruby code to munge the data automatically is turning out to be too much fun.

Anyway, I’ll wrap up with what I planned to use as my final point for this table of data:

Judging by these statistics, the status of both gun laws and violent crime rates in Illinois (one of the most RKBA-restrictive States in the Union), compared with those in Indiana, shows a very strong correlation between strict gun control laws and high violent crime rates. These are neighboring States, within the same federated union of States, both operating under the aegis of the same federal firearms laws — a much closer comparison than between the US and the UK. Only certain municipalities within Illinois, most notably Chicago, even approximate the restrictiveness of UK laws regarding firearms.

Despite this — despite the apparently damning evidence of more restrictive firearms laws causing greater rates of violent crime — I do not consider that as good a comparison as a comparison of crime rates before and after the passage (or repeal) of a new, significant firearms law within a single jurisdiction. The reason is that, even though they are neighboring States, they are still different enough in a number of ways that many other factors are likely to interfere with a “clean” comparison than would do so in a statistical analysis of violent crime rates before and after a change in the law.

I believe that the difference in gun laws between these two states does contribute to the difference in violent crime rates, but that doesn’t mean I’d accept these statistics alone as proof of that. The fact remains that other variables are not sufficiently controlled to make this simple comparison between States and be certain of the results.

23 July 2009

What’s Wrong with National Right-to-Carry Reciprocity?

Filed under: Liberty — apotheon @ 10:21

The two bodies of Congress are arguing over various spin-off versions of HR 197, the National Right-to-Carry Reciprocity Act of 2009. The Senate just rejected one version of the bill.

The text of HR 197 is:

Sec. 926D. National standard for the carrying of certain concealed firearms by nonresidents

(a) Notwithstanding any provision of the law of any State or political subdivision thereof, a person who is not prohibited by Federal law from possessing, transporting, shipping, or receiving a firearm and is carrying a valid license or permit which is issued by a State and which permits the person to carry a concealed firearm (other than a machinegun or destructive device) may carry in another State a concealed firearm (other than a machinegun or destructive device) that has been shipped or transported in interstate or foreign commerce, subject to subsection (b).

(b)(1) If such other State issues licenses or permits to carry concealed firearms, the person may carry a concealed firearm in the State under the same restrictions which apply to the carrying of a concealed firearm by a person to whom the State has issued such a license or permit.

(2) If such other State does not issue licenses or permits to carry concealed firearms, the person may not, in the State, carry a concealed firearm in a police station, in a public detention facility, in a courthouse, in a public polling place, at a meeting of a State, county, or municipal governing body, in a school, at a professional or school athletic event not related to firearms, in a portion of an establishment licensed by the State to dispense alcoholic beverages for consumption on the premises, or inside the sterile or passenger area of an airport, except to the extent expressly permitted by State law.

I have seen arguments against this thing based on the notion that it’s a violation of “States’ rights”, and based on the fact that people don’t want to end up in a national database of CCW permit holders.

  1. “States’ rights” don’t trump individual rights. The individual rights provisions of the Bill of Rights must take precedence over any “States’ rights”. In case anyone has forgotten, the Second Amendment protects an individual right to keep and bear arms, and any federal law that works to protect the right guaranteed by the Second Amendment without otherwise infringing individual rights should definitely be upheld even if the various States don’t like it.

  2. I don’t see anything, in any of the three versions of this bill that I’ve read, that lays the groundwork for any kind of federal tracking of permit holders. What I see is that CCW reciprocity would basically work exactly the way it does now, except that reciprocity would be automatic in every single state that allows for any kind of CCW permit issuance process rather than being decided on a case-by-case basis. That would mean that I still wouldn’t get reciprocity in Illinois or Wisconsin, but I’d get it everywhere else — and that such reciprocity would be handled the same way my current CCW reciprocity with, say, Kansas works: I have a permit from my home state, so it’s allowed, period. There’s nothing in any of the versions of this bill that I’ve read suggesting that anyone needs to sign up for a national CCW permit in addition to the state permit, or that I have to sign up on a national list, or anything like that. Did I overlook something?

The various versions of this bill I’ve seen include:

If you can find anything in any of those that contradicts my understanding of them, or that raises other concerns than those I’ve presented, please let me know.

Older Posts »

All original content Copyright Chad Perrin: Distributed under the terms of the Open Works License