Page 1 of 2
Dirty Code
Posted: Mon Jul 09, 2007 11:43 am
by TheMoose
So one of the people testing out a new aspect of my company's portal came to me with a bug today which was a relatively easy fix. So I open up the page in my favorite text editor Editplus, and get to fixing it. Then I realize I can't find the right DIV, for some reason it seems out of place.
Then it hits me.
Someone else opened my page in Frontpage or Visual Studio and went to Design View, because there are endless amounts of:
Code: Select all
<p style="margin-top: 0; margin-bottom: 0"><font face="Arial">MY STUFF HERE</font>
I hate how it dirties my code!
I don't understand why it would even add that inside a DIV tag that has a class with CSS styling. I don't need to make it a new paragraph, I already set the font, stop assuming I want code there

Posted: Mon Jul 09, 2007 12:16 pm
by Chris Corbyn
I'd never let anyone near my markup with a WYSIWYG editor. They do make an utter mess.
Posted: Mon Jul 09, 2007 12:23 pm
by TheMoose
Oh how I wish, but it's my boss and he uses one of those 2 programs to publish from our dev server to our live server.
I haven't even checked my other files that I've been working on, as I've been too busy cleaning this one file, which is now almost 1700 lines long because of the dirt that was thrown in it.
Posted: Mon Jul 09, 2007 12:29 pm
by Chris Corbyn
TheMoose wrote:Oh how I wish, but it's my boss and he uses one of those 2 programs to publish from our dev server to our live server.
I haven't even checked my other files that I've been working on, as I've been too busy cleaning this one file, which is now almost 1700 lines long because of the dirt that was thrown in it.
Sounds like you need subversion

Posted: Mon Jul 09, 2007 12:31 pm
by TheMoose
d11wtq wrote:Sounds like you need subversion

He just recently had an epiphany of how useful XML can be. For some reason, I don't think he'll know what Subversion is, let alone be willing to use it.

Posted: Mon Jul 09, 2007 12:33 pm
by Chris Corbyn
TheMoose wrote:d11wtq wrote:Sounds like you need subversion

He just recently had an epiphany of how useful XML can be. For some reason, I don't think he'll know what Subversion is, let alone be willing to use it.

Sounds like you need a cup of tea

Posted: Mon Jul 09, 2007 12:35 pm
by Luke
I used to have a boss like that, except he wouldn't even have given xml a chance... he "doesn't understand why anybody would need anything but internet explorer" either.

Posted: Mon Jul 09, 2007 12:37 pm
by TheMoose
Tea....beer....either will work
However on a lighter note, I also had a recent epiphany because of Begby's question about value objects and models. So now I get to implement it with some of my own projects. Luckily it doesn't involve dirty code, and does involve a decent CVS system (aka, not Frontpage or VS).
EDIT: Ninja, did you used to work for my boss? About 3 months ago I was able to persuade him to install Firefox to at least debug his code since it actually gives messages instead of the IE "Error 500: there's an error, but we don't know what it is". And as soon as he saw that I was using AJAX for some of my projects (nothing out of the ordinary, just things like search suggests, etc), he all of the sudden started trying to do it also. Except it wasn't AJAX. It was merely JS showing a "loading..." screen until the page loaded, then it disappeared. There was no data request or response.
Posted: Mon Jul 09, 2007 12:52 pm
by Oren
I hate stupid bosses

Posted: Mon Jul 09, 2007 5:24 pm
by Jenk
I don't, stupid bosses are easy to convince - you just have to know how.
That's not to say I dislike bosses with a clue, though. They are equally great.
Posted: Tue Jul 10, 2007 7:17 am
by superdezign
Jenk wrote:I don't, stupid bosses are easy to convince - you just have to know how.
That's not to say I dislike bosses with a clue, though. They are equally great.
I hate bosses in the middle. They understand some, but completely misunderstand others. I could have sworn that you could upgrade an only PHP 4 to a newer PHP 4 simply by overwriting the current files and restarting the server. He wouldn't believe me (and neither would his star ASP programmer). Then there'd be times when he'd throw around unaccepted acronyms as though anyone in the office knows what he's talking about.
I had a clueless project leader. She was fun. I could tell her anything. She was strange though... No matter what, she'd print something out. Send us an e-mail, ask us if we got it, then print it out. Look at a site as it's in production, find a mistake, print it out, and circle it. I used to think all of the printer ink messages were spam, but now I think they've requested them.

Posted: Tue Jul 10, 2007 10:51 am
by smudge
Way back when, when I was just learning the basics of HTML, I was using Frontpage. Then I got to reading books and tutorials, learning the right way to do things, and decided that FP's code was the ugliest, most repulsive code on the face of the earth. Since I didn't really know my way around editors, I just used notepad for a year or two, using windows explorer to do uploads. Then I was introduced to dreamweaver. Although it's not the best programming environment, It amazingly doesn't make any dirty code! It even came with commands to cleanup microsoft code and automatically format and indent your code. So, to d11wtq, wysiwyg editors are not necessarily bad. It's just the microsoft ones that make me shudder.
Posted: Tue Jul 10, 2007 11:09 am
by superdezign
smudge wrote:Way back when, when I was just learning the basics of HTML, I was using Frontpage. Then I got to reading books and tutorials, learning the right way to do things, and decided that FP's code was the ugliest, most repulsive code on the face of the earth. Since I didn't really know my way around editors, I just used notepad for a year or two, using windows explorer to do uploads. Then I was introduced to dreamweaver. Although it's not the best programming environment, It amazingly doesn't make any dirty code! It even came with commands to cleanup microsoft code and automatically format and indent your code. So, to d11wtq, wysiwyg editors are not necessarily bad. It's just the microsoft ones that make me shudder.
I'm going to have to disagree with you. DW's looks better than FP, but it still can't compare to hand-written code. I hate working with anyone that uses design mode because I always end up rewriting the whole things since it's not in a position to simply be edited.
Posted: Tue Jul 10, 2007 11:24 am
by Luke
I agree - design mode is terrible. Dreamweaver is terrible come to think of it.
Posted: Tue Jul 10, 2007 12:07 pm
by RobertGonzalez
DW, like FP, suck. Of course, that is a biased opinion. I am a professional developer, so you can take that for what its worth.
DW and FP have their place, but for folks that like clean code, hand writing it is the only way to guarantee that it will be clean. I learned HTML from a magazine using notepad and have not looked back since. In fact, I have never used anything that write my code for me.