Page 1 of 2

The bad things you do

Posted: Wed Dec 28, 2005 3:57 pm
by alvinphp
So what are the bad things you do in PHP/HTML coding that you know is bad, but you do it anyways? I personally always use <? ?>, I rarely add the closing option tag (</option>) , I usually don't put double/single quotes around attributes in html tags unless it must have it, and I use <b></b> instead of <strong></strong>.

Re: The bad things you do

Posted: Wed Dec 28, 2005 4:23 pm
by foobar
I, and this is very painful for me to admit, use, God have mercy on my soul, W3C standards compliant, I beg for fogiveness, XHTML whenever I am prodded by, may God forgive me, the abominable Lucifer.

Ok, I've said it. You all know, now. To make matters worse, I also always use <?php ?> and correct formatting. I am pittiful and weak, I know, but my lusting for well-formed, portable code is stronger than me. Please don't reject me after these confessions. I AM ONLY A HUMAN! :roll:

Posted: Wed Dec 28, 2005 5:27 pm
by alvinphp
So you completely follow all the W3C standards? If I was to look at your code I would find nothing wrong? Do you also follow the accessibility standards which is also part of the W3C standards? Considering that the most used browser is not compliant it has to be hard to follow the W3C standards completely.

Posted: Wed Dec 28, 2005 5:34 pm
by foobar
alvinphp wrote:So you completely follow all the W3C standards? If I was to look at your code I would find nothing wrong? Do you also follow the accessibility standards which is also part of the W3C standards?
I do, to the best of my abilities. Which has been pretty good so far.
alvinphp wrote:Considering that the most used browser is not compliant it has to be hard to follow the W3C standards completely.
Ever heard of the W3C Validator? It's a great aid. I love standards-compliant code.

[Oh, by the way, if you ever stumble upon the chatscript I made, then that won't be compliant with anything, but my excuse is that it's still in beta and currently on hold]

Posted: Wed Dec 28, 2005 7:52 pm
by josh
Well the title of the thread was not "do you use standards most of the time", it was "what are the bad things you do". You just admited to a chat script that is not standards complaint which contradicts your first post in the thread.

Anyways I use table based layouts on a lot of projects, there are just some places the DIVs can't go, but I'm learning new things in CSS everyday. Another thing I am guilty of is realizing the solution I am coding isn't the best possible choice, but proceeding with it because I am lazy to backtrack. When I design for clients though I try to avoid that when possible and always give em my best 8)

Re: The bad things you do

Posted: Wed Dec 28, 2005 10:13 pm
by Roja
alvinphp wrote:So what are the bad things you do in PHP/HTML coding that you know is bad, but you do it anyways?
I compromise.

Seriously, its a broad answer, but its 100% the right answer. For example, when writing new code, I write to standards. However, for bringing old (ancient) code up to date, I may not give standards compliance my full attention.

Or with new code, I may make a very clean MVC seperation, or use a solid pagecontroller. But with legacy code, I'll compromise and work on seperating the view, but not the rest.

I'm pragmatic, because if I tried to do everything to perfection on the first try, I'd get very little done. Personally, I think that standards, design patterns, and coding techniques are important guidelines that lead to better results. There are however times when each is less important than the overall goal of progress, and if its a binary choice between the two, I'll often take progress over perfection.

Posted: Wed Dec 28, 2005 10:28 pm
by Charles256
i code procedurally? LOL. Mainly I just get lazy sometimes....and code what works,not always the best soluton but it works..

Posted: Wed Dec 28, 2005 10:31 pm
by Buddha443556
Charles256 wrote:i code procedurally?
I don't know that was a bad thing. Heck, count me in on that one! :D

Posted: Wed Dec 28, 2005 10:31 pm
by Charles256
it was a joke ;) no one take it literally or we'll all get modded! :-D

Posted: Wed Dec 28, 2005 11:49 pm
by neophyte
Documenting and commenting: I should do this... :roll: :oops: :roll:

Posted: Wed Dec 28, 2005 11:51 pm
by Charles256
that's what I forget to do! comment! man I am bad about not commenting if I think it's self evident...

Posted: Thu Dec 29, 2005 12:00 am
by n00b Saibot
PHP Short Tags are weak point for me :oops: but I never got burned :wink: I try to maintain the XHTML compatability but may slip outta mind in some pages :?

Posted: Thu Dec 29, 2005 12:45 am
by josh
hmm oh yeah short tags are another one for me...

but if the code is intended to run in many places I go for the long tags, you know how it is..


Another one (very very naughty jshpro2) is assuming queries always work, that is not explicitly checking for a return value of false on things like inserts (unless a query further down the page depends on that query working), so if for some reason a query doesn't go through they would see a *blank* page.. most of these are old habit's that I have since broken, though... just thinking back to things I used to do.

Posted: Thu Dec 29, 2005 3:02 am
by mickd
as long as i know its bad to do, i dont do it.

the only thing i can think of that i know i shouldnt do but i should is not comment my code.

btw, whats wrong with using the <b> tag? is it being depricated and prefered by <strong>? if thats true, i wont be using <b> anymore ;)

Posted: Thu Dec 29, 2005 3:11 am
by RobertGonzalez
I sometimes have a tendency to use if...elseif...elseif...else instead of switches, although I do go back and correct myself if I see this happening quite a bit. I also seem to like to scramble my CSS attributes and end up with things that just look awful. I am pretty good about the rest though (except using tables, but I am checking myself into a rehab clinic next week to break the habit).

From what I've read at w3c, <b> is being depricated along with <i> and <u>. <strong> is now favored in place of <b>, <em> is now used in place of <i> and <u> is being thrown out altogether in favor off CSS underlining. Oh well, I haven't used the old ones for a while (Hey, I did a good thing!, Yippee!).