From: alex b. <en...@tu...> - 2001-05-24 03:25:36
|
dude, good nick. onwards.. > this is slightly off topic... but my boss and i disagree on the "preferred" > coding style. he is an asp-guy and i am for php so maybe that makes > adifference.. ill let you decide since i am hardly the expert: I will refrain from the, uh, comparison (for the moment) > we have an asp application in use at work.. it uses a lot of > document.write"<table><tr><td>some data here</td></tr></table>" type of > coding, which works like the php echo (as far as i can understand). i dont AGH! > like this style at all, it makes the code hard to read.. (plus playing with > the quotes is a serious pain in the rear end). then in the code there is a > part where the programmer actually did it "my way" which means close code > tags and do html as plain html and open code tags when theres code to spit > out. my boss says this is bad and slows it down. > so which way is faster? i know echoing html is considered bad coding style > (at least with php) There's probably, oh, _maybe_ 0.0001 seconds difference in a fairly large application between closing tags and "echo". One of the reasons echo is _specifically_ mentioned in the binarycloud code standards is because it effectively makes the code useless. Why? well, if I want to integrate your code with all your echos into my site, but I want to _change_ the look of your application, I am now screwed. If you had separate template files, I could just make new copies of those and be on my merry way. The reason I am so rabidly in favor of xslt is because it is a fully xml compliant way of cleanly abstracting presentation from logic. This is a huge boon to any project for a number of reasons, not least of which that the code is maintainable, and you can make multiple stylesheets for the same collection of data. And your code starts to be elegant. You start to enjoy it... wheeee so, your boss is wrong :) the best thing you can do is generate xml from your application and run it through xsl, but if you're not willing to do that at least separate your markup from your logic. _alex |