Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Proposal for new section: Code Improvements

by Coruscate (Sexton)
on Jan 23, 2003 at 22:56 UTC ( #229467=monkdiscuss: print w/replies, xml ) Need Help??

Lately, there has been discussion of creating a new section where users could offer a donation in return for answers or code to fix their problem. Several people were skeptical about such a section, especially since money is involved and it would be difficult to draw the line on what should be provided for free and what would benefit from a donation. The section I've dreamed up is nothing of the sort, though I think I started brainstorming from those posts.

I think it would be fun, educational, and helpful for many of us if we could have a section called something like 'Hard Coder' (okay, my name sucks, as I'm not very imaginative. I'm expecting you guys to come up with a half-decent name). This section would allow monks to post code that already gets the job done, but the person would like to recieve advice and guidance as to how the code could be improved. Example advice would be on where and how to go about removing redundancy, adding good programming tidbits (such as -w, use strict, CGI for web-based scripts, etc), and perhaps providing code to replace certain snippets within the script.

So what kind of benifits could we see resulting from such a section? Well, here's a short list I came up with:

  • Helpful: The poster of the original code is going to be very happy to end up with a script that gets the job done faster, more efficiently, and perhaps more securely.
  • Educational: This is a big one! Those assisting in improving the code will not rewrite the script: rather, they will offer advice on where and how to improve things. In this manner, the person will have to rewrite their code themselves, resulting in a great learning experience. This sort of thing on the site might help everyone here learn things they didn't know before. Then there is always the fact that we would see multiple ways in which an attack against code can be done: remember, TIMTOWTDI!
  • Fun and Challenging: Those assisting with the code in question will surely be enlightened to have others make comments and challenge the ideas they post. In this way, the person asking for improvements in their script is not the only one who learns a thing or two.

So it seems to me that a system such as this is a Win-Win-Win situation (3 wins: the person asking for help, the people posting advice, and the spectators who read the thread). The system would work something like this: someone comes along and posts their script. Maybe they even point out where they think their code needs improvement, but they admit they don't know how to go about making it better. Others come along, look through the script and see some 'problem areas/topics'. They reply to the original post, indicating what they have found and suggesting how one could possibly go about fixing it. After people stop adding comments, the original poster finishes the improvements to the script and then posts the resulting code for all to see. If the new code still has some issues, discussion can then continue once again.

This one sounds great to me; I'm interested in hearing other opinions on this matter.

"User error. Replace user and press any key to continue."

  • Comment on Proposal for new section: Code Improvements

Replies are listed 'Best First'.
Re: Proposal for new section: Code Improvements
by Aristotle (Chancellor) on Jan 23, 2003 at 23:06 UTC

    It certainly is a good idea, but I wonder inhowfar the goals differ at all from those of Seekers of Perl Wisdom and/or Meditations? Both of these sections offer a place for this kind of question - SoPW on a different level than Med. My own snippets and idioms I sought advice about went into aforementioned sections. It seemed appropriate to put them there, and they fit right in indeed.

    I think the issue is less one of offering a place for such scrutiny, but rather one of encouraging people to seek advice about their code. There is often a lack of awareness with beginners that makes them unlikely to suspect any problems in their code that might make them seek advice; raising awareness is really what we have to achieve.

    The questions will follow, and we already have the areas to accomodate them.

    Makeshifts last the longest.

      As I was writing the post, I knew that somebody would mention the fact that SoPW would mold to fit the need of something like this, and I'm not sure why I didn't mention some of the specifics I have been thinking about. The actual posting system would differ from that of SoPW and Meditations. Perhaps a textbox for a title, a textarea for the code, which would automatically wrapped into readmore tags in the output, as well as line numbering being added (as in Craft), so that those who reply to the code can make references to line numbers. Then another textarea where the user describes where improvements could be made, but doesn't know how to go about it. In this way, the person must reflect on which topics the improvements can revolve around. Also, wouldn't it be neat if the rewritten code were to be added to the original post (for example, the original author could click a link saying 'post/edit rewritten code' and edit the code on-site. This would also allow members to see the current progress of the code rewriting as they are modifying it). I'm also thinking about something such as adding the final rewritten code to Code Catacombs, but that would result in the code being in multiple places, as well as harder maintenance on the site.

      All of the above would mean actually whipping together some new code, adding a table or two to the databse, etc etc. I'd be willing to (help) do the work, but I'm afraid I don't know anything about the mechanics of the perlmonks code :(

      "User error. Replace user and press any key to continue."

Re: Proposal for new section: Code Improvements
by rinceWind (Monsignor) on Jan 24, 2003 at 10:20 UTC
    Nice thread, Coruscate

    I've thought of a title for the section. How about Workshop. After all, the workshop is an essential part of any monastery. Also, I thought of the French name, which is Atelier - but on reflection, workshop has more meaning to the audience. Workshop also has the connotation of cooperative effort, and work-in-progress.

    In the past, I have had module ideas (solitary pod), which I have posted as meditations. But I like the idea of a specific code section with line numbers and references in the replies.

    How about keeping a revision history - the ability to view any revision and show diffs? That way, people would be able to see how the code has evolved over time, and I think that this would be more informative than just the finished product. <PLUG> My VCS::Lite module could come in handy here. </PLUG> If there's a shortage of tuits in the PMDev team for this one, I volunteer some coding time.

Re: Proposal for new section: Code Improvements
by gmpassos (Priest) on Jan 24, 2003 at 07:32 UTC
    Well, is good, but the idea to involve money not. I think that here are a free place to trade knowledge, not a place to work for others. What we can do is make a section to post a code, and get replys of betters codes of it, than we test the replys and vote in the best, put a 1-5 rank for each reply. This will be good to bring new chalanges.

    What is good too, is a section for "Tips" (well, why not this name), or announce good things to use, that we found. Is like the oposit way that the site works, not a section to post a query for help, but to post what we know.

    Other thing, the site is starting to be slow! I don't know if is the link, or if the DB is too big. Some work need to be done now, or in the future it will crash!

    Graciliano M. P.
    "The creativity is the expression of the liberty".

      Psst... reread my original node again. Nowhere did I say that money would be involved with this idea. I was pointing out one of the negative points about a different discussion that was going on. So I agree with you (and always have), that involving money in any manner whatsoever is a bad idea.

      "User error. Replace user and press any key to continue."

Re: Proposal for new section: Code Improvements
by Anonymous Monk on Jan 23, 2003 at 23:51 UTC
    This section would allow monks to post code that already gets the job done, but the person would like to recieve advice and guidance as to how the code could be improved.

    I always just used the code section.

    Suggestions for improvements are already commonly posted in response. Why not just increase the visibility of the section and further encourage comments? Code is very rarely perfect, constructive criticism should always be invited.

      The guideline for posting to Code Catacombs is that the code should be useful to others. Often I do code that has no meaning whatsoever to anyone else but me (or my company). This new section could be a chance to get some input on how to optimize such a program. (Yes, there's always Seekers of Perl Wisdom but that section requires one to formulate more specific questions. Sometimes I don't know where my bottlenecks are but someone else might.)

      Just my 2 cents...


        The code is useful. It runs, others can learn by reading it, and can adapt it to their own uses. I just post it seeking improvements, which are inevitably provided. :)

Re: Proposal for new section: Code Improvements
by del (Pilgrim) on Jan 24, 2003 at 14:51 UTC
    I like the idea. Fortunately (in my experience - Simple text menu) the practice of code improvement and the opportunity to learn from it already exists on this site.

    Perhaps a new section would be useful, maybe not. In either case, I am optimistic that your post will encourage more of this type of constructive interaction. Thanks.

Re: Proposal for new section: Code Improvements
by Cody Pendant (Prior) on Jan 25, 2003 at 10:12 UTC
    I like the idea of a place to fix up code which already works.

    I got a hell of a lot out of reading those "script doctor" or "script workshop" or whatever they were called, articles by M-J D at

    So much of what goes on here is "my code is broken! Help ME!" that it'd be a nice change of pace to have a section where we post code that already works, but admit that it could probably do with improvement.

    It should also be a change of tone; because so many of the problems we see on SOPW get answered with "use strict and you'd have an error message", "use warnings and you'd already know the answer" and so on, people can be a bit abrupt. If the code works, no matter how clunky, we're in a different atmosphere. The poster's done something humble, put their code on display for the monks, and the people who write back should also be more polite, because nobody's screaming "Help me my script doesn't work!!!" when they've just missed closing a set of damn quotes.

    I know I've got scripts which could be better, but they don't need improvement in the sense of actually doing what they're supposed to do, because they work just fine. They're just probably not great Perl, that's all.
    “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.” M-J D

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://229467]
Approved by gjb
Front-paged by gjb
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2020-09-28 18:54 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (144 votes). Check out past polls.