22, November 2008

Coding Tip - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ 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

Author Topic: Coding Tip  (Read 682 times)
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« on: Dec 12, 2005, 05: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 : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8250
42487 credits
Members referred : 3



« Reply #1 on: Dec 12, 2005, 05: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 Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #2 on: Dec 12, 2005, 06: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 : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8250
42487 credits
Members referred : 3



« Reply #3 on: Dec 12, 2005, 06: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 Visit through proxy

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 Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #4 on: Dec 12, 2005, 06: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 : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8250
42487 credits
Members referred : 3



« Reply #5 on: Dec 12, 2005, 06: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 Visit through proxy or twitter Visit through proxy

Last blog : Free Unlimited Bandwith and disk space to good to be true?
Global Moderator
Internet Junkie
*****
Gender: Male
Posts: 1523
6847 credits
Members referred : 8


Gimme all your cookies!!!


« Reply #6 on: Dec 12, 2005, 06: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 : Site of the Month - August 2007
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8250
42487 credits
Members referred : 3



« Reply #7 on: Dec 12, 2005, 06:40:26 PM »

Hehehe.right Smiley

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

Last blog : Free Unlimited Bandwith and disk space to good to be true?
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....

Topic sponsors:
Get a permanent link here for $1.99!


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?
Nov 22, 2008, 06:50:00 PM





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!


Forum Statistics
Total Posts: 37.740
Total Topics: 7.651
Total Members: 4.397
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: Janai

41 Guests, 5 Users online :

10 users online today:



Readers

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