Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Perl Exercises

by Herkum (Parson)
on May 18, 2006 at 12:55 UTC ( #550232=note: print w/replies, xml ) Need Help??


in reply to Perl Exercises

If you are going to mention bugs, why not focus on writing tests? It is amazing to me that this area is so broadly ignored by programmers. An even better place to start would be writing modules that would follow the format of a CPAN distribution. Requiring a,

  • README file, force them to write notes about anything special about module.
  • Changes file, force them to keep track of their changes to their code.
  • Build.PL file, gets them thinking of their code as a building block that other programs/modules can use.
  • a t directory with a standard set of tests (like Pod and Pod-Coverage). It is easier to write tests if they know where those tests will be and what can be expected.

The tests get them into the good practice of writing interfaces for their code instead of writing code and then try to figure out how the interface works. It gives them examples of how to write code in general.

To often I see programmers write modules without any documentation, working examples, testings or ANYTHING THAT IS NOT CODE! It leads to crappy, buggy and ultimately unmaintainable code.

Why? Reading code is hard, when code be explained in english in a few sentences and be read in a minute might take 10 or 20 minutes of reading code to figure out how it is supposed to work. The reason for this is code has no frame of reference, writing documentation is supposed to do that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (9)
As of 2020-05-29 21:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (171 votes). Check out past polls.

    Notices?