Brad Fitzpatrick (brad) wrote,
Brad Fitzpatrick
brad

pig latin: perl vs. C++

I went to help out at my littlest brother's high-school programming class today. Freshman intro to programming... they learn C++. Painful, but I can't think what the best language to learn on would be. I suppose simplified C++ isn't so bad... mix of high-level and seeing how the machine actually works, kinda.

Anyway, their project was to write an English to Pig Latin converter. I explained how to setup one function w/ a little state machine to tokenize the sentence into words, one function to pigify the word once boundaries are found (including "qu" support, -ay vs -way suffixes), etc. Also showed them how to use the debugger. (Visual Studio)

So after their 3 pages of code (small monitors) I showed them how it's just one line in Perl and walked them through each character of the Perl version briefly. *evil grin*
Tags: perl, tech
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 25 comments