How-to: avoid some code problems in advance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • P Pulkkinen

    How-to: avoid some code problems in advance

    This all below is my opinion, not any official post though...
    =============== =============== ========

    1) Have a debugging/error handling system. It is not so difficult to make, I
    have made one myself and it really often helped us in development.

    2) Test code ALL the time, after every couple of lines, not in big chunks.

    3) Leave debugging features inside, even if you use simple lines like:
    echo "now variable i = $i";
    comment it, when you don't need it, but keep it there!

    4) Name variables in a way that even others understand them
    $person['phone'] is good name , $p['p'] is bad.

    5) Put useful comments here and there. don't think commenting is waste
    of time.

    6) Learn to use error_reporting ();

    7) When you ask questions in a newsgroup, take time to formulate
    your post. Don't push your opinions on where the error
    might be, since if you knew that, you wouldn't have needed
    help in the first place.

    8) Remember "Give-and-receice" principle in newsgroups:
    Give help, give thanks to those who help you =>
    You'll receice help, you'll receive thanks when
    you help someone.





  • Kimmo Laine

    #2
    Re: How-to: avoid some code problems in advance

    "P Pulkkinen" <perttu.POISTAT AMA.pulkkinen@P OISTATAMA.elisa net.fiwrote in
    message news:VZWxh.5736 $8P4.2913@reade r1.news.saunala hti.fi...
    This all below is my opinion, not any official post though...
    =============== =============== ========
    ....
    7) When you ask questions in a newsgroup, take time to formulate
    your post. Don't push your opinions on where the error
    might be, since if you knew that, you wouldn't have needed
    help in the first place.
    Good point. Also good to remember is to try to isolate the problem to the
    shortest piece of code you can. No one wants to debug 200 lines of code in
    their head, hence the abbreviation TLDR (Too Long, Didn't Read!) exists.

    And I'd like to add just one more advice:

    10) Use an editor that higlights syntax! Much easier to spot the missing
    quote, semicolon or some other typo when the syntax is highlighted.

    --
    "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
    http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
    spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


    Comment

    • P Pulkkinen

      #3
      Re: How-to: avoid some code problems in advance


      "Kimmo Laine" <spam@outolempi .netwrote:
      Good point. Also good to remember is to try to isolate the problem to the
      shortest piece of code you can. No one wants to debug 200 lines of code in
      their head, hence the abbreviation TLDR (Too Long, Didn't Read!) exists.
      10) Use an editor that higlights syntax! Much easier to spot the missing
      quote, semicolon or some other typo when the syntax is highlighted.
      VERY good points!

      http://www.hiliteme.com/ is a service for those, who are not working with
      highlighting editor, or in a case where you are working wiht another
      computer, or in a hurry etc.

      Now I got so inspired that I'd like to develop this post into general
      php-debug&newsgroup-faq. Let's see, how many are excited!



      Comment

      • Rik

        #4
        Re: How-to: avoid some code problems in advance

        P Pulkkinen <perttu.POISTAT AMA.pulkkinen@P OISTATAMA.elisa net.fiwrote:
        Now I got so inspired that I'd like to develop this post into general
        php-debug&newsgroup-faq. Let's see, how many are excited!
        I'm all for a major rewrite of http://php-faq.com/. I'll contribute when I
        can :-)
        --
        Rik Wasmus

        Comment

        • P Pulkkinen

          #5
          Re: How-to: avoid some code problems in advance


          "Rik" <luiheidsgoeroe @hotmail.comkir joitti
          viestissä:op.tn b3a8dmqnv3q9@mi sant.kabel.utwe nte.nl...
          I'm all for a major rewrite of http://php-faq.com/. I'll contribute when I
          can :-)
          Well, that looks excellent work! I will not bother to rewrite something that
          has already in excellent process.

          I could imagine it would take you about 15-N minutes to write a widget, that
          sent the plain text version of the FAQ on 1st day of every month to this and
          the other newsgroup...:-)




          Comment

          • Rik

            #6
            Re: How-to: avoid some code problems in advance

            P Pulkkinen <perttu.POISTAT AMA.pulkkinen@P OISTATAMA.elisa net.fiwrote:
            >
            "Rik" <luiheidsgoeroe @hotmail.comkir joitti
            viestissä:op.tn b3a8dmqnv3q9@mi sant.kabel.utwe nte.nl...
            >
            >I'm all for a major rewrite of http://php-faq.com/. I'll contribute
            >when I
            >can :-)
            >
            Well, that looks excellent work! I will not bother to rewrite something
            that
            has already in excellent process.
            >
            I could imagine it would take you about 15-N minutes to write a widget,
            that
            sent the plain text version of the FAQ on 1st day of every month to this
            and
            the other newsgroup...:-)
            'the' other?

            I'm watching:
            comp.lang.php
            alt.php
            alt.comp.lang.p hp
            alt.php.sql (well, a bit specialised indeed)

            I've never tried an automated NNTP post before, but it seems there's a
            PEAR package for it. Posting the entire faq would be quite lengthy though,
            not sure that's a good idea. Maybe a 'FAQ of the day'?

            It could benefit from a more 'how to troubleshoot' portion too.
            --
            Rik Wasmus

            Comment

            • P Pulkkinen

              #7
              Re: How-to: avoid some code problems in advance


              "Rik" <luiheidsgoeroe @hotmail.comwro te:
              'the' other?
              maybe there are some more good than I know, but when i searched my
              newsserver, I found comp.lang.php and php.general to be very active and
              useful for me.
              I've never tried an automated NNTP post before, but it seems there's a
              PEAR package for it. Posting the entire faq would be quite lengthy though,
              not sure that's a good idea. Maybe a 'FAQ of the day'?
              That could be. Also one option is to make wholly/partially link-based faq
              that would lead to your website. That would be shorter.
              Also, process of defining the MOST typical questions from just typical
              questions.
              It could benefit from a more 'how to troubleshoot' portion too.?
              Especially. Trouble-avoiding, trouble-shooting and trouble-handling.


              Comment

              • Kimmo Laine

                #8
                Re: How-to: avoid some code problems in advance

                "Rik" <luiheidsgoeroe @hotmail.comwro te in message
                news:op.tnb7o9t hqnv3q9@misant. kabel.utwente.n l...
                >P Pulkkinen <perttu.POISTAT AMA.pulkkinen@P OISTATAMA.elisa net.fiwrote:
                >
                >>
                >"Rik" <luiheidsgoeroe @hotmail.comkir joitti
                >viestissä:op.t nb3a8dmqnv3q9@m isant.kabel.utw ente.nl...
                >>
                >>I'm all for a major rewrite of http://php-faq.com/. I'll contribute
                >>when I
                >>can :-)
                >>
                >Well, that looks excellent work! I will not bother to rewrite something
                >that
                >has already in excellent process.
                >>
                >I could imagine it would take you about 15-N minutes to write a widget,
                >that
                >sent the plain text version of the FAQ on 1st day of every month to this
                >and
                >the other newsgroup...:-)
                >
                'the' other?
                >
                I'm watching:
                comp.lang.php
                alt.php
                alt.comp.lang.p hp
                alt.php.sql (well, a bit specialised indeed)
                >
                I've never tried an automated NNTP post before, but it seems there's a
                PEAR package for it. Posting the entire faq would be quite lengthy though,
                not sure that's a good idea. Maybe a 'FAQ of the day'?

                Well it might be a good idea to promote it at least some way, because I've
                been reading this group for a couple of years now and this is the first time
                I've seen the faq. Given that it isn't the official group faq, I understand
                it though. If it is promoted as the official unofficial alt.*.php faq then
                it certainly ought to be posted in the group in some format on regular
                basis. But in that case it should also cover some aspects of news groups
                posting, not just php (NO SHOUTING, speak english, don't post 300 lines of
                code, be polite, etc...)

                --
                "Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
                http://outolempi.net/ahdistus/ - Satunnaisesti päivittyvä nettisarjis
                spam@outolempi. net | rot13(xvzzb@bhg byrzcv.arg)


                Comment

                Working...