29, May 2012

Coding Tip - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Coding Tip
« previous next »
Pages: [1] Print
Instabuck - The easy way to sell digital products online

Author Topic: Coding Tip  (Read 1378 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« on: Dec 12, 2005, 04:37:54 pm »

I just thought that should share a coding tip. I use it when coding in PHP, but it would apply to any coding language.

When coding, always test to break the code first and ee that you have caught all the errors first.

For example (a simple example), if you are checking for a certain value in an array, first check that the error reporting works when the value is not in the array. You could even (and I do this quite often) ask someone else to try and break you code.

HTH!  Cool


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #1 on: Dec 12, 2005, 04:45:15 pm »

I am not sure what you are talking about.

Can you explain a little bit more?

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #2 on: Dec 12, 2005, 05:00:17 pm »

Well, when I code, I always check that the errors are caught and that they are handled correctly. I always do this first, because if you leave them to the end, they never get done.


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #3 on: Dec 12, 2005, 05:05:06 pm »

Oh I see.

Something like this would propably help : http://www.webdigity.com/index.php/topic,92.0.Custom+error+reporting+script.html

But you can allways see the php_err log files on the server (if you have access of course)

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #4 on: Dec 12, 2005, 05:17:56 pm »

I was talking about a coding practise or even a habit that I have developed where I check the code/page while I am developing it on the development server.

Another simple example - take querying a database for example. When the query to the database errors or fails to connect, an error message or flag should be set. Now when you coding, you should try and break it to check that you error catching and warning systems are in place and working. If they are, move onto developing the next section of code.

You don't always catch all the errors when developing and the code that I posted in that thread that you pointed to will catch any unforseen errors.


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #5 on: Dec 12, 2005, 05:24:15 pm »

Now I almost got you Smiley (I know I am a really stupid person)

It is allways good to have some debug tools of your own and use whatever possible that will help you examine all the possible actions in a program.

An error catching script will also help a lot, as you can't make a perfect application without testing in a real environment.

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1525
6359 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #6 on: Dec 12, 2005, 05:38:38 pm »

Yeah, something like that!

BTW you are not stupid, you know a lot of stuff that many others know nothing about! We know some stuff that Einstein never know!!! Cool


Last blog : Canonical URL Links / Tags
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 5799
46391 credits
Members referred : 3



« Reply #7 on: Dec 12, 2005, 05:40:26 pm »

Hehehe.right Smiley

Trial and Error my two best teachers Cool
Join us @ facebook or twitter

Last blog : Butterfly Marketing 2.0
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=977
Tags : php databases Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP
Topic: Coding Tip
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 29, 2012, 01:51:46 am





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.