To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Code Critique

Code Critique Having someone critique your code is always a great way to hone the skills. Stop in and post your code to see what your peers may have done differently.

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-30-2003, 02:40 AM   #1
dalecosp
Still needs a yaller jeep
 
dalecosp's Avatar
 
Join Date: Jul 2002
Location: Accelerating Windows at 9.81 m/s....
Posts: 6,140
Regarding code appearance...

I called up my brother the NT sysadmin guy and asked him for help with a CSS issue that turns out wasn't much of one.

He commented on the fact that "I didn't care what my HTML source looked like."

Now, he doesn't have much concept of database-driven/scripted sites ....

How much effort do you go to to ensure that the *HTML source* of your sites are properly 'tabbed' and 'newlined', etc., particularly when you're trying to whip stuff out at the lowest cost for the client?

Form or function, or both?
__________________
dalecosp ---------------- "God doesn't play dice." --- Albert Einstein

Getting Help at All! --- Collected Solutions to Common Problems --- General Bulletin Board Guidelines --- Debugging 101 --- Coding Forum FAQ --- Search the board --- T.F.M. (the 'friendly' manual, in English) --- Newbie FAQ
dalecosp is offline   Reply With Quote
Old 09-30-2003, 02:42 AM   #2
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
None at all, unless there's a need to(HTML mail, etc). My highly non-standardized way of doing things again tells me functionality is better than pretty. They don't nned to be lookin at that stuff anyway

-my two cents
LordShryku is offline   Reply With Quote
Old 09-30-2003, 02:57 AM   #3
Nehle
Junior Member
 
Join Date: Sep 2003
Posts: 17
I often write for functionality at first, if I have time after that, I try to make my sites both XHTML and CSS validated. Takes a couple of extra hours, of course, but I like to be certain my sites works on any webbrowser (except that IE has some CSS problems, but screw them :P )
Nehle is offline   Reply With Quote
Old 09-30-2003, 02:58 AM   #4
Moonglobe
Better fan than rebelo!
 
Moonglobe's Avatar
 
Join Date: Apr 2003
Location: brain://localhost:left-side
Posts: 2,381
just a hobbiest myself, but that could soon change..... in any case if it's just for me i try and make things pretty.......... if it's not perfect i don't mind. If i was getting paid then i agree with LordShryku totally.
__________________
there's no place i can be, since i found serenity.
Moonglobe is offline   Reply With Quote
Old 09-30-2003, 06:34 AM   #5
onyx
Member
 
Join Date: Sep 2003
Location: Durham, UK
Posts: 88
I never generally bother to do proper indenting (and when I can be bothered I just get emacs to automatically do it) but I always make my sites xhtml 1.0 transitional and my CSS comply. I never used to do this and converting it all was quite a pain but now I just churn out compliant HTML and CSS without even thinking about it. I certainly think it is good practice to do so to aid understanding, maintainance and complience.
__________________
Sam Rain****

http://www.dur.ac.uk/samantha.rain****/
onyx is offline   Reply With Quote
Old 09-30-2003, 02:09 PM   #6
Nehle
Junior Member
 
Join Date: Sep 2003
Posts: 17
Vim does indent properly for me. And if it doesn't it's an easy command.
I like having properly indented code, makes debugging hell of a lot. easier, and it's also easier for others to understand
Nehle is offline   Reply With Quote
Old 09-30-2003, 02:12 PM   #7
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
Indenting code is one thing....
My PHP code is pristine with it's indentation and formatting. I think he's talking about the HTML code generated from the PHP code though. In which case, I really don't care too much unless I have to.
LordShryku is offline   Reply With Quote
Old 09-30-2003, 04:12 PM   #8
bliss322
Member
 
Join Date: Dec 2002
Posts: 85
"They don't need to be lookin at that stuff anyway"

well, i was about to mention that they just might HAVE to look at it someday.

proper form (server side and client side) is a treat to the person that has to come behind you and maintain your work; whether that's another freelancer or an employee of your client. i work for a large enough company that the other offices often buy third party web apps that i then have to support.

but then LordShryku reminded me about php generated html, so i figured i'd shut up cause i'm guilty there.
__________________
ahhh, learning.
bliss322 is offline   Reply With Quote
Old 09-30-2003, 04:31 PM   #9
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
Like I said. My PHP is all properly indented, and I give plenty of free space in there to keep things well seperated. In fact, I give hell to people that don't do that. But my generated HTML isn't always the prettiest thing to look at....
LordShryku is offline   Reply With Quote
Old 09-30-2003, 05:32 PM   #10
eoghain
Senior Member
 
Join Date: Aug 2002
Posts: 691
Personally for me I like to try and make my HTML somewhat readable. Now I don't do much HTML work anymore but when I did I found it very annoying to try and see what went wrong in my HTML if it wasn't formatted somewhat. Now it may not have been the pretiest HTML but at least the various sections were identifiable for me to track down errors.

But if I don't have to deal with the HTML then I don't bother with any formatting issues. My code looks good and is understandable and that is all that matters.
__________________
Any code examples haven't been tested (unless noted) and shouldn't be used in production environments.
eoghain is offline   Reply With Quote
Old 09-30-2003, 05:40 PM   #11
Sxooter
Chamberlain
 
Sxooter's Avatar
 
Join Date: Aug 2002
Location: Denver, CO
Posts: 4,057
The worst offense to me is the single very long line web page. We've all seen it. A 16k string on one line, no CRs or breaks. ugh.

As long as the html has CRs in it I'm pretty happy.
__________________
PostgreSQL version 8.5 is now in alpha!
Sxooter is offline   Reply With Quote
Old 09-30-2003, 06:27 PM   #12
Nixon
He's so funny!
 
Join Date: Aug 2002
Posts: 247
Hey, I always try to keep my PHP in good form. If its in good form it tends to be easier to update and so on.... HTML I use dreamweaver to do all my html then I manually code the PHP. Dreamweaver sorts most of it out for me.
Nixon is offline   Reply With Quote
Old 09-30-2003, 06:29 PM   #13
LordShryku
kung foo code monkey
 
LordShryku's Avatar
 
Join Date: Aug 2002
Location: Occupational Hypnotherapy
Posts: 7,473
I don't think these people get the difference between coding HTML and generated HTML...

I'm with you Sxooter. I see that stuff all the time with these canned php nukes. Hurts my eyes...
LordShryku is offline   Reply With Quote
Old 09-30-2003, 06:34 PM   #14
dalecosp
Still needs a yaller jeep
 
dalecosp's Avatar
 
Join Date: Jul 2002
Location: Accelerating Windows at 9.81 m/s....
Posts: 6,140
Quote:
Originally posted by eoghain
Now it may not have been the pretiest HTML but at least the various sections were identifiable for me to track down errors.
And that was the gist of my OP ... my brother only codes for his employer's site, (and deals will over a hundred users daily with only one assistant IT dude) but he's real picky about perfect looking HTML and CSS. That's fine ... he's salaried

Me, I've got 8 or more sites either in development or in the maintenance phase, plus a "few fire and forget's" and I've got no one else working, plus I have LAN's in various offices and residential customers calling me everytime they get a virus or a modem zotted by lightning, (which this time of year is more often that some other times...)

If a site works, I don't much care, although I don't like to forget the "\n" 's as Sxooter says ...it's nice if it fits on a screen when viewing source. And, I'm *never* sure that the browser I'm using is "da bomb" when it comes to interpreting CSS (but that's another subject...)

I called my brother 'cause I was adjusting type sizes in CSS and it wasn't doing anything in the browser ... and we needed to figure out what containers were open, and which might be overriding another.

He has a good point, but cleaning up the code is going to take awhile, and some of my clients are probably getting near the point of not being so happy when they get my invoices....

I guess it's like anything else ... use your head in each circumstance.

The source for the page we were looking at last night looks much better today
__________________
dalecosp ---------------- "God doesn't play dice." --- Albert Einstein

Getting Help at All! --- Collected Solutions to Common Problems --- General Bulletin Board Guidelines --- Debugging 101 --- Coding Forum FAQ --- Search the board --- T.F.M. (the 'friendly' manual, in English) --- Newbie FAQ
dalecosp is offline   Reply With Quote
Old 09-30-2003, 08:07 PM   #15
drawmack
Computers can do that?
 
drawmack's Avatar
 
Join Date: Apr 2003
Location: Pocono Mtns PA
Posts: 3,268
There are a couple of important things here

1) I do not generate html from inside of php. I create templates that just have variables in them and then I include those files. This being the case it's very easy for me to format my html properly

2) I validate my xhtml templates before I even start writting php. I do not validate my css because it yells at me for things it shouldn't like leaving out a bgcolor.

3) I like well formated html for me not for them. I often have to look at my html source as part of finding the errors in the php and this is much easier if it's well formated.
drawmack is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 01:02 PM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.