Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Looking for examples of well-written modules

by stvn (Monsignor)
on Aug 27, 2004 at 03:06 UTC ( #386231=note: print w/replies, xml ) Need Help??


in reply to Looking for examples of well-written modules

I'm looking for a list of well-written Perl modules.

This is a very difficult request, because of TIMTOWTDI one mans well written code is another mans crap. Personally Austen puts me to sleep and I think Hemingway can be a pompous homophobic ass, sure they can write well, but the subject matter and style don't appeal to me. I would rather a whirlwind of sex and insight with Henry Miller or a good drug-induced paranoid romp with Phillip K. Dick or enjoy a good graphic novel by Joe Sacco or Art Speigelman or one of my all time favorites Alfred Bester whose work always leaves me wishing he had written more. But hey, thats whay I enjoy reading, which is just a highly subjective opinion coming from a complete stranger.

Code I think (as you indicate as well) is much the same. I personally enjoy reading code, I get a lot of satisfaction from it and I agree with you that I find it a valuable learning experience. But given the choice I like to read code in functional languages (or code written in a functional style). Standard ML is a favorite of mine, along with Erlang and sometimes Haskell (LISP and Scheme just have to many parens to make them enjoyable to read). My code, although almost always OO, leans towards that functional style too. To those of the more imperitive persuasion, this may make my code akward and difficult to follow. Some people out there like reading C, personally it just gives me a headache (although I find I have to do it a lot, so I am getting more used to it).

So I guess my point is that you may have a hard time finding good modules to read if you go looking for them. I would instead suggest that you try reading the modules you use often first. Since you know what they do from the outside, you are better prepared to understand them from the inside. And don't worry so much about the good code/bad code thing as sometimes reading bad code can be a valuable learning experience too. And just like books, if you find an author you like, you can try reading their other works too.

... Things you've written yourself that you'd self-nominate for closer public scrutiny.

I was a fine arts painting major and we would many times have daily critiques and I used to really enjoy when I got blunty honest yet constructive criticism. So I don't mind throwing my work up for public scruitiny at all, here is my page on CPAN. I think I am the most happy with Tree::Binary right now, but that might a honeymoon thing since its my most recent one. But anyway, feel free to fire away.

-stvn
  • Comment on Re: Looking for examples of well-written modules

Replies are listed 'Best First'.
Re^2: Looking for examples of well-written modules
by hv (Parson) on Aug 27, 2004 at 10:25 UTC
    This is a very difficult request, because of TIMTOWTDI one mans well written code is another mans crap. Personally ...

    I agree, and I think that regularly reading and thinking about the code/text of a wide variety of authors will improve your command of any language.

    An interesting approach might be to take a few example modules with which you are not familiar, throw away the author's documentation (the pod that is, not the comments), and then try to write the documentation for the module based on the code and any comments.

    Doing this you could hope to learn a lot both about good and bad code style and about good and bad documentation style; maybe also a bit about what aspects of a module should or shouldn't be documented. If you're doing it right I'd expect you also to spot some bugs in the process, which will give you a good opportunity to pay some tuition fees in the form of bug reports and patches. :)

    Hugo

      An interesting approach might be to take a few example modules with which you are not familiar, throw away the author's documentation (the pod that is, not the comments), and then try to write the documentation for the module based on the code and any comments.

      Interesting idea, a little on the insane side, but nice idea. You might even want to just find a module with little or bad documentation, and email the author to see if you can re-write it for them.

      Another good way to get to know a module is to work on it's test suite. The Phalanax project is a great place to do this. I spent a week or so a little while ago working on modernizing the DBI test suite, and in the process learned a lot about how that module is architected.

      -stvn

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2021-01-15 18:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?