SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Zealot joazito's Avatar
    Join Date
    Mar 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    In "why doesn't my code work" threads, should you point out irrelevant code mistakes?

    In this past week I've seen lots of posters asking for help with their non-working code, and I'm not sure if I should point out mistakes or bad coding style that is completely unrelated to what they're asking. It's not 1 mistake or 2, it's usually more in the region of 5 or 6.
    Now I haven't tried to inform them they should probably be doing it differently, for these reasons:
    • I'm lazy;
    • It's not what the poster asked for;
    • It might hurt the poster's feelings;
    • It seems no one else is doing it!

    What do you think?
    Last edited by joazito; Apr 20, 2005 at 17:08. Reason: corrected title typo

  2. #2
    SitePoint Wizard Rick's Avatar
    Join Date
    Oct 2002
    Location
    Lancashire, UK
    Posts
    3,847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    moved to a more appropriate forum
    Rick

  3. #3
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do. I point out double quote vs single quote issues, I point out short tags vs proper PHP tags issues, etc.

    BUT, when I do point those issues out, it's only as a closing paragraph in the post, and I always make sure to actually help their problem too.

  4. #4
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Nathan helps people
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  5. #5
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I find myself just rewriting their code for them to make it better, heh.
    Mike
    It's not who I am underneath, but what I do that defines me.

  6. #6
    SitePoint Wizard silver trophy someonewhois's Avatar
    Join Date
    Jan 2002
    Location
    Canada
    Posts
    6,364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mike
    I find myself just rewriting their code for them to make it better, heh.
    I think that doesn't help people. If you do that, they won't learn. They'll just take it. You have to explain it to them and make them fix it themselves.

  7. #7
    SitePoint Wizard gold trophysilver trophybronze trophy dc dalton's Avatar
    Join Date
    Nov 2004
    Location
    Right behind you, watching, always watching.
    Posts
    5,431
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I try not to rewrite it myself ... When I was teaching I found that is the WORST thing you can do as they dont learn how to fix it and end up making the same mistakes over and over.

    But to the original topic yes I point out the other problems I see (usually)

  8. #8
    ~unplugged Ainslie X11's Avatar
    Join Date
    Feb 2005
    Location
    Langley, Virginia
    Posts
    1,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I look for problems I haven't come across before, then 'try' and fix it for them. I find it helps with the (endless) learning process, and if it happens to help someone else, all the better

  9. #9
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by someonewhois
    I think that doesn't help people. If you do that, they won't learn. They'll just take it. You have to explain it to them and make them fix it themselves.
    I guess I'd care more if I was their teacher Haha, nah, I rewrite it for my sanity I guess
    Mike
    It's not who I am underneath, but what I do that defines me.

  10. #10
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I always point out poor coding practices and possible SQL injection issues. So many new PHP developers out there are unaware of the major security issues they leave themselves open to when working with MySQL

  11. #11
    SitePoint Zealot joazito's Avatar
    Join Date
    Mar 2005
    Posts
    121
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok so the consensus is you should point them out to them, BUT... should you only do it as a note after you contribute to solving the problem they request, like someonewhois said?

  12. #12
    SitePoint Wizard Dean C's Avatar
    Join Date
    Mar 2003
    Location
    England, UK
    Posts
    2,906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why? We should all strive to pro-actively develop ourselves as programmers/designers or whatever you do. If people give me comments on particular code I use then I'm always grateful for any tips or pointers they can give regardless of whether my problem is solved or not Every little helps!

  13. #13
    Free your mind Toly's Avatar
    Join Date
    Sep 2001
    Location
    Panama
    Posts
    2,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by joazito
    It might hurt the poster's feelings
    Not at all. People look for help all the time, but they will always appreciate any good advice that could improve the way they code, as long as you mention it in a polite way.

    On the other hand, if you tell people that their coding styles suck and that they should be killed because of it (yes, I've seen that kind of posts), then you will definitely hurt some feelings.
    Community Guidelines | Community FAQ

    "He that is kind is free, though he is a slave;
    he that is evil is a slave, though he be a king." - St. Augustine


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •