By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,825 Members | 1,429 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,825 IT Pros & Developers. It's quick & easy.

How-to: avoid some code problems in advance

P: n/a
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.

Feb 6 '07 #1
Share this Question
Share on Google+
7 Replies


P: n/a
"P Pulkkinen" <pe*************************@POISTATAMA.elisanet.f iwrote in
message news:VZ*****************@reader1.news.saunalahti.f i...
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
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Feb 6 '07 #2

P: n/a

"Kimmo Laine" <sp**@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!

Feb 6 '07 #3

P: n/a
Rik
P Pulkkinen <pe*************************@POISTATAMA.elisanet.f iwrote:
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
Feb 6 '07 #4

P: n/a

"Rik" <lu************@hotmail.comkirjoitti
viestissä:op***************@misant.kabel.utwente.n l...
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...:-)


Feb 6 '07 #5

P: n/a
Rik
P Pulkkinen <pe*************************@POISTATAMA.elisanet.f iwrote:
>
"Rik" <lu************@hotmail.comkirjoitti
viestissä:op***************@misant.kabel.utwente.n l...
>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.php
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
Feb 6 '07 #6

P: n/a

"Rik" <lu************@hotmail.comwrote:
'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.
Feb 7 '07 #7

P: n/a
"Rik" <lu************@hotmail.comwrote in message
news:op***************@misant.kabel.utwente.nl...
>P Pulkkinen <pe*************************@POISTATAMA.elisanet.f iwrote:
>>
"Rik" <lu************@hotmail.comkirjoitti
viestissä:op***************@misant.kabel.utwente. 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.php
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
sp**@outolempi.net | rot13(xv***@bhgbyrzcv.arg)
Feb 7 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.