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

(Ovid -- Programming style - Off topic) Re: Silly code reviews and shift

by Ovid (Cardinal)
on Jan 18, 2001 at 22:08 UTC ( [id://52802]=note: print w/replies, xml ) Need Help??


in reply to Silly code reviews and shift

tilly, when we started discussing this earlier, I was going through some of my posts on this site to realize something very interesting. I am a huge fan of structured design. I typically use Warnier-Orr to design my programs. If I'm rushed or given poor specs, I tend to forget about that and put out code that can be read from top to bottom with relatively few functions. This is not good, but I noticed that it seems prevalent in many of my posts here.

By contrast, one program I have has the first few lines of code being the following (I stripped the comments):

#!C:/perl/bin/perl.exe -w use strict; use URI::Escape; use HTML::Entities; use CGI::Pretty qw/:no_debug/; $CGI::Pretty::INDENT = "\t"; my $q = CGI->new; my $table_data = create_table_data(); my $source_code = read_source_code(); create_web_page( headers => [ 'Symbol', 'ASCII Value', 'URL encoded', +'HTML code' ], data => $table_data, code => $source_code ); exit;
That's pretty much the entire logic of the program. Yeah, you can go down into my functions and into their functions, and so on and so on, but you already have a decent idea of what I'm doing. If you view the output of the program, the above code is crystal clear. It's just a matter of filling in the details. I wonder if other monks have a tendancy to post code that answers a question but demonstrates poor programming style.

I think, in future posts, I'll try to focus better on code quality in addition to accuracy.

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

  • Comment on (Ovid -- Programming style - Off topic) Re: Silly code reviews and shift
  • Download Code

Replies are listed 'Best First'.
Re: (Ovid -- Programming style - Off topic) Re: Silly code reviews and shift
by dave_aiello (Pilgrim) on Jan 20, 2001 at 10:27 UTC
    I'm sure that I occupy a substantially lower station than Ovid does in this community, because I feel that I will have a tendency to post more questions than answers in the near future. To that end, I would point out that I crafted the code that I submitted in Why is this link parser only working the first time? as carefully as I could. I did so because I did not want to embarass myself, nor waste the other members' time. As you can see if you follow the thread, I was rewarded with two helpful answers.

    tilly's response, which concisely answered my question, did not need to be written in a clean programming style. In fact, I suggest that a more lengthy, more stylistic response would have been harder for a subsequent Seeker of Wisdom to follow. And the result was that I felt a responsibility to summarize the situation after I followed the advice provided.

    Perhaps it is more important, from a community learning perspective, that at least one side of the code-related question be written in good form.

    Dave Aiello
    Chatham Township Data Corporation

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 19:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found