Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Back to Perl

by demerphq (Chancellor)
on Jan 19, 2005 at 21:39 UTC ( #423513=note: print w/replies, xml ) Need Help??

in reply to Back to Perl

I tend to take a non trivial algorithm I know well and do my best to implement it in the new language. Various examples are: Huffman Encoding, 2-3 Trees, Binary Tree. The good thing about this approach is you dont have to learn a new language at the same time as you learn a new concept, instead you already have a conceptual framework you are comfortable with, and all you need to do is map the programming requirments from the one language to the other.

A good Perl training excercise is to implement a tree structure of some sort as a tied hash. Dont forget to handle the iterators properly. :-)

Good luck.


Replies are listed 'Best First'.
Re^2: Back to Perl
by Xenograg (Scribe) on Jan 19, 2005 at 22:49 UTC
    Good advice. demerphq++

    That is exactly what I did moving from language to language. Everyone has a favorite algorithm, right? :)

    --- The harder I work, the luckier I get.

      Everyone has a favorite algorithm, right? :)

      So which was yours? :-)


        My normal test algorithms are different sort types, insertion, substitution, and even bubble sort.

        For OO langauages I also like to try and implement some of the gang-of-four design patterns like abstract factory or strategy.

        An ideal combination is a strategy pattern implementing different types of sort.

        What ees dis, some kind of hufty?
        I have an O(1) solution to the halting problem! It only works on fast computers though.

        I am an old hand in a matrix-based chatroom game called "The Duel of Swords". It started on AOL but has now moved to the WWW <a href="" target="_new">The Rings of Honor</a>. I gained an edge in the game by compiling scouting reports on prospective opponents. A database is used to manage the many-to-many relationship. The programming thus includes database access, number crunching into a couple hundred accumulators, and output formatting.

        The first platform was an Apple/Claris HyperCard stack. I then used it as my lab project for college database course (Oracle and Java). Now it is a web application using LAMP. Perl modules are CGI, DBI + DBD::mysql, and HTML::Template.

        I would love to show it to you all, but it is password protected. :)

        --- The harder I work, the luckier I get.
Re^2: Back to Perl
by talexb (Canon) on Jan 20, 2005 at 21:00 UTC
      I tend to take a non trivial algorithm I know well and do my best to implement it in the new language.

    Bingo. When I found myself with some time to spare and a burning need to figure out how OO Perl worked, I created Roff as an OO exercise in about a day. I learned a lot about how to implment a simple OO Perl program, and although I left myself room to expand it into a more complicated group of classes, never did get around to it.

    This follows on from writing a version of roff in C sometime in February 1993 after I broke my leg and was without a computer for six weeks. In a frenzy of 14-hour days, I wrote a really pretty cool version that even did micro-justification on the dot matrix printer I'd rented.

    The nice thing about roff is that you can just keep on adding features to it -- there's no limit to when it's done.

    Which can be a good thing or a bad thing. :)

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://423513]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2020-12-03 02:03 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (49 votes). Check out past polls.