The online racing simulator
[OT] The Coding Horror Thead.
1
(42 posts, started )
[OT] The Coding Horror Thead.
Coding Horror - A blog about the horror of programming or programming and human factors by Jeff Atwood.

This thread is placed in the programmer section as this blog programmers are the audience for this blog (god, I wish to gouge out my eyes every time I type that word). Jeff Atwood on this site talks about programming in general and the human factors that associate with it. Jeff is a user rights, user privileges programmer. He takes the role of the user when he programs, in an attempt to make the users life as easy a possible. He then also shares these ideas on this site.

This thread is intended to provide a discussion area for fellow readers to talk about each of his articles as they come out.
#2 - ReVoX
uhm, nice, I need read and follow the blog somedays
XML: The Angle Bracket Tax
XML: The Angle Bracket Tax.

I've not used XML myself that much, except in the past few days for the World Championship Signatures (WCS) script that I posted in the Off Topic area of this forum. The xml files them selfs, are simply edited from the source code you can find on the Formula1 website, but changed to give it a more XML fell. This article got me thinking. Are programmer using XML just for the sake of using it, and does XML really suck?

In the example I gave, WCS, I simply used it as a quick and very dirty way of parsing the results from the Qualification session and the Race from the Formula One website, but I still had to copy the source code and parse it into a text document, then also change the structure of the document, and replace Kimi's name with non UTF-8 chars. There are better ways, but this was the quickest. So, I think that XML is simply used for it's simplicity.
Yeah, I read Coding Horror a fair amount, he has a lot of good ideas and puts a lot of effort into his posts (the two reasons actually why I suck at blog posting).

Another couple of blogs I like are Eric Lippert and Shawn Hargreaves blogs. Both are engineers at Microsoft, with Eric working on the development team (EG C# and Visual Studio) and Shaun a part of the XNA team (as well as creator of the Allegro programming library and lead programmer on the excellent MotoGP games).

Edit: Note - Those are both C# focused blogs.

Edit II: Eric's post on not getting questions answered is pertinent to this forum a lot of the time.
Quote from Dygear :XML: The Angle Bracket Tax.

I've not used XML myself that much, except in the past few days for the World Championship Signatures (WCS) script that I posted in the Off Topic area of this forum. The xml files them selfs, are simply edited from the source code you can find on the Formula1 website, but changed to give it a more XML fell. This article got me thinking. Are programmer using XML just for the sake of using it, and does XML really suck?

In the example I gave, WCS, I simply used it as a quick and very dirty way of parsing the results from the Qualification session and the Race from the Formula One website, but I still had to copy the source code and parse it into a text document, then also change the structure of the document, and replace Kimi's name with non UTF-8 chars. There are better ways, but this was the quickest. So, I think that XML is simply used for it's simplicity.

I really like XML a lot, I think it's fantastic. Even just the idea of a language that describes how information relates, is a brilliant one. That's not to say that it isn't misused, which it easily can be. I think in some ways it's like Object-Orientated Programming. A fantastic idea, and when executed well can be a major bonus to a project, but trying to stuff everything into a OOP paradigm is a mistake. This is one of the reasons I've started to use C# less as time goes on, I just don't agree that OOP is the solution to every problem. The same with XML - when executed correctly it's fantastic and a massive boon, but trying to force everything into XML semantics just for the sake of it is a mistake, and will probably do you more harm than good. I guess really this is a people problem, rather than a technological one (EG it's the people misusing the language that are at fault, rather than that the language allows itself to be misused). But no, I don't think XML sucks, I love it!
Awesome post DarkTimes!
I use XML where the structure of the data is as important as the entries - it's very handy for storing/transferring/transforming hierarchical records - but I always try to use concise tag names and few if any attributes (I'd usually rather have another tag than use an attribute) to keep it lightweight and easy for a human to read.

XML becomes especially useful when you're writing "template"-style code for unknown record types. We use that sort of approach in our CMS, so that we can define doctypes on a per-client basis if necessary and they can still be edited/displayed/transformed using the same classes.
For the WCS I am thinking of converting all of those CSV files in one xml file, it think consolidation is good, and it might make it easier over all on the end user to maintain. But there lies the pit fall of XML, it was really never meant to be seen by the end user. So, at that point, am I misusing XML?
I think if the user has to interact with the mark-up in any way then it's not necessarily inappropriate. I remember using old versions of Borland (as was) WordPerfect back in the mid-'90s which featured an SGML-view pane, and it made editing complicated formatting a lot easier than the blind "WYSIWYG" view (which is all you ever got from MS Word).
Quote from thisnameistaken :I remember using old versions of Borland (as was) WordPerfect back in the mid-'90s which featured an SGML-view pane, and it made editing complicated formatting a lot easier than the blind "WYSIWYG" view (which is all you ever got from MS Word).

which is why everyone whos computer savvy uses latex (yes the name is that bad)
It depends on what sort of program you're making and who you expect to use it. For a program aimed at techies, editing an XML file should be a fairly straight-forward task, certainly no harder than editing an .ini file. But then I wouldn't expect my 80-year old grandmother to have to edit an XML file to get her email working.

Really though your user shouldn't have to edit the XML to use your program, it should be there as an advanced feature for experienced users. If you have complex settings you need to ask the user to edit, then make a shiny GUI with lots of buttons and sliders for them to safely play with, and fill in all the info with acceptable defaults before they start. Then if people want to jump into the XML later to do some custom stuff, that options open to them.
I can think of several uses of XML that I've seen in production, which have made me cry.. XML serialised into a DB column (rather than creating a new set of columns in the DB) - at every search the entire rowset of the table was returned and each row's XML was parsed and then sorted... Small quantities of XML gzipped and used as a network protocol over UDP, because "UDP had better performance, and XML is.. Like so cool man"?!!

So yes, it can be over used like any tech, and it's usually over used by people who consider technology X to be the bees knees and will refuse to use any other tech even if it's more suitable - as if they're trying to prove a point In my opinion this is much more dangerous than being overzealous with it and not seeing it..

These blind advocates are the emacs users of the world... *waits for the pain*
I dont like XML, I cant be arsed to flaff about formatting my output. If a user wants to edit sommit they can learn the format its in. Then again i'm the kind of programmer who was happy back in the days when the only way to edit something was to use a hex editor, even not having an offset doesnt bother me.

I do totally relate to DarkTimes comments on OOP though, i'm not a fan of OOP - I use some of it's principles some of the time, way less than I suppose I "should" (in quotes for a reason). My day job has me enslaved to OOP and i've been 2 days stuck on a structural problem in the back end when fundamentally all I want to do is put a table inside a table... but it's not as simple as that is it... oh no... somebody had the bright idea of making everything as obfuscated as hell because "its an object it doesnt matter whats in it"... yeah right.
Yeah that part of OO bothers me a bit - spending time writing methods purely for the purpose of supporting the paradigm seems a bit counter-productive...

I do like the tidiness that results though, and if you can make good use of inheritance you don't really need to write much extra code. I do find that maintenance of OO code is often much easier (perhaps because it forces you to do more thinking in the design stages), and adding features at a later date similarly so.
Hi,

Jeff Atwood from Coding Horror here. I have an ego search set up in Google (don't ask) and I must say this is one of the more exotic results I've gotten.

I just want to make sure you guys have seen this:

http://www.codinghorror.com/blog/archives/001030.html

and this:

http://www.codinghorror.com/blog/archives/000476.html

Notice that I give LFS its props (and of course I own a license for the game) in the first link!

Glad to hear you guys are enjoying the blog, I hope it results in even cooler, better, more awesome versions of LFS for me
Quote from jatwood@wise-ebusiness. :Jeff Atwood from Coding Horror here. I have an ego search set up in Google (don't ask) and I must say this is one of the more exotic results I've gotten.

Welcome Jeff! :up: I'm sure this isn't the most bizarre thing you've come across, but we can make it a bit weirder if you like

Certainly a nice looking rig you've got there! Kinda makes nostalgic for the days of old when I had the space, and definately makes me feel guilty that the g25 is sat o'er yonder gathering dust It's certainly nice to see you're a LFS fan too!

Going back slightly on-topic, keep up the good work with coding horror, it's provided me with some good afternoon entertainment on slow days - it is appreciated
Well, that was unexpected, if indeed it is indeed him. Well Jeff hang around for a little while, I'm sure you will find the information & discussion here interesting.

Back on topic ...
I really can't stand XML placed in a database, along with sterilized php arrays placed into the database. I fell this is cheating, and defeats the propose of the structure of the database. The search function becomes fairly useless when looking for data that is found in this area.

Ok, DarkTime, I'll make a pretty front end for the users so that it edits the csv / xml files for them. I don't think I can offer any advanced features however that could be edited by the xml file tho.
Cleaning Your Display and Keyboard
He plays rFactor - get him!

Quote from Dygear :I really can't stand XML placed in a database, along with sterilized php arrays placed into the database. I fell this is cheating, and defeats the propose of the structure of the database. The search function becomes fairly useless when looking for data that is found in this area.

I have to confess we have used a column in a RDBMS to store XML, and we ended up adding another table to act as an indices for those XML documents (not as bad as it sounds - there is another important relationship between those two tables which would've been unavoidable anyway). Not the most elegant storage method ever but it's an off-the-shelf CMS and it does at least allow us to customise what data gets indexed for each customer. And it's nice to be able to browse that data without having to join multiple tables together, and selection is quick. It works, basically! But we're not proud.
Quote from Becky Rose :I do totally relate to DarkTimes comments on OOP though, i'm not a fan of OOP - I use some of it's principles some of the time, way less than I suppose I "should" (in quotes for a reason). My day job has me enslaved to OOP and i've been 2 days stuck on a structural problem in the back end when fundamentally all I want to do is put a table inside a table... but it's not as simple as that is it... oh no... somebody had the bright idea of making everything as obfuscated as hell because "its an object it doesnt matter whats in it"... yeah right.

You see, I actually am a fan of OOP, a big fan even, but I'm totally with thisnameistaken when he says wasting your time writing objects and methods purely so the code fits into an OOP paradigm seems hugely counter-intuitive. As I've gotten more experienced in programming, I've really begun to see the benefits of multi-paradigm languages. Things that are better as objects can be objects, things which are better as procedural, or functional code, can be. OOP is just another tool in the programming toolbox, and it's not the best nor only tool. I think the comparison with XML comes back, as OOP is most useful when the relationships in the code need to be preserved.

And hi Jeff!
I'm on the side of XML and OOP. Of course, there is a time and place for every practice so you can't use it for everything. A good programmer imo, will always decide which to use based on their job and/or task and not because s/he likes one over the other. For example I really don't think it should be stuck into a DB. There may be a good reason for it I'm sure, but it violates MVC practices and scalability. On the other hand when you want exchange data between DBs, programs or whatever then XML is great. Very flexible! Don't forget XML is not a language, its a markup/syntax for making your own language/format. XML vs XHTML for example. It's not the language that matters most, it all depends on how you use it. OOP is similar in a way. Some basic programs can avoid it and that's all good but I'd like to see someone program a modern, multi-threaded program/game without it. And of course with OOP, kind of like here at work sometimes, it can be easily over-used. Arrg! soo many classes! no comments!? BAH! So again, all depends on how ya wiggle it..

Anyway, on topic.. I read Coding Horror every once and a while along with the Daily WTF. Coding Horror is much better though! More updates, simple, straight-forward and now Jeff is here! Welcome!
Quote from Stuff :soo many classes! no comments!?

That drives me nuts. Or comments where a behaviour is mentioned but there's no mention of why that behaviour needs to happen, or what the hell any of the vars represent. I work with a guy who has the crappiest commenting practices and (after six or seven years of it) I'm starting to think it's deliberate.
Is HTML a Humane Markup Language?

You know, I have to wonder some time, why are there so many flavors of BBCode? I've spent the past 4 years learning BBCode, and what's demoralizing about learning BBCode is that vB's BBCode is different from that of phpBB, and these two are different from that of IPB's BBCode. Drives me nuts!

Three of the most prevalent Bulletin Board systems use their own proprietary flavor of BBCode, last time I checked each handling lists in there own way. If you throw in the likes of the smaller, but still well known SMF you get yet another style! Why can't we just set a standard, and stick with it? I don't know about you, but I hand code all of my post, so this effects me on a daily basis. What about the rest of you?

Do you know HTML?
Do you hand code your BBCode, for vB, phpBB, IPB, & SMF?
1

[OT] The Coding Horror Thead.
(42 posts, started )
FGED GREDG RDFGDR GSFDG