473,320 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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.

Feb 6 '07 #1
7 1306
"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

"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
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

"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
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

"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tom Szabo | last post by:
Just wandering how can you close a browser remotely. In some web applications the browser closes or refreshes periodically. How is that done and how can it be done through PHP? TIA, Tom
15
by: Reid Nichol | last post by:
Hello, I was wondering if I could control how many bytes are in an int and the byte order. In C/C++ I can use int32 but how do I do this in python? How can I control byte order?
0
by: v I n O | last post by:
hI Geeks Please do let me know how do i find how many instances sql server running on the single machine. or in the n/w my objective should with help of C#/vb.net
4
by: James Salisbury | last post by:
Hi, I was checking my parent's website salisbury.cabrera.net on google by entering villa rent spain cabrera I can see the required site, ranked at 4, but I am concerend by the return at 1 and 5...
2
by: Frances Del Rio | last post by:
http://www.emol.com/especiales/cocina_chilena/comida.asp this page is so neat (goes in pop-up..) how was this done? how do you give a layer (or div, I guess) a semi-transparency so you can still...
4
by: | last post by:
Developing, building, and testing. How do it the best? Learning from the world leader - Microsoft I'm very interested in how the developing/build/testing workflow @ Microsoft looks like. I...
4
by: Supra | last post by:
in vb6 listbox1.remove item 5 how will i do in vb.net? regards
3
by: dba2adm | last post by:
The SNAPSHOT_STATEMENT table function gives the CPU used rows read etc information. How do I know the total number of time the particular statement was executed (as in snapshot_dyn_sql's...
0
by: candra | last post by:
Learn What Hackers Know? -General Hacking Information -Password Security -Scanning, Fingerprinting And Similar Techniques -How Hackers Attack Numerous Internet Services -How Hackers Attack Web...
2
by: belred | last post by:
i just read this blog about how many objects (types) are loaded for a hello world program in C#. http://blogs.msdn.com/abhinaba/archive/2008/09/15/how-many-types-are-loaded-for-hello-world.aspx ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.