Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: TMTOWTDI... and most of them are wrong

by biosysadmin (Deacon)
on Jun 27, 2005 at 04:40 UTC ( #470151=note: print w/replies, xml ) Need Help??

in reply to Re: TMTOWTDI... and most of them are wrong
in thread TMTOWTDI... and most of them are wrong

Having taught a course in Perl for a couple of years at school, I was consistenly amazed at the number of weirdly thought out programming ideas that my students came up with. For example, I once had a student who wanted some help thinking out a programming assignment. The task was to write a subroutine that took a 3-letter sequence of DNA, and translate that into the corresponding amino acid sequence. I gave it as an exercise in using hashes (which I had just lectured on that week). Basically, the student wanted to use two arrays of DNA and amino acids as an associative array, so that to translate AAA to amino acids, you would look up the array position of the AAA element in the DNA array, and then find the amino acid at the corresponding position in the amino acid array. To me, this is a perfect example of a "way to do it" that shouldn't be used, because:
  • It's not as efficient as using Perl's built-in hashing-function.
  • It's significantly harder to read and understand for other programmers.

A quick re-hash (hah!) of the lesson on hashes set the student on the right path.

Anyways, wrongness is in the eye of the beholder, but I think that it's a good idea for a programming language community (whether it be a work environment, a course, or a site like PerlMonks) to recommend and enforce some sense of quality in programming.

I wouldn't cite C or C++ as hallmarks of programmer discipline either. I've seen some stuff with pointers that would make my CS professors absolutely cringe. :)

  • Comment on Re^2: TMTOWTDI... and most of them are wrong

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (7)
As of 2020-06-01 17:14 GMT
Find Nodes?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?

    Results (5 votes). Check out past polls.