Ego and the Art of Programming ActionScript: Default Namespace Tricks.
So I was just minding my own business, getting in what little procrastination I could fit into my busy day, and happened upon the blog of one Mrinal Wadhwa discussing his tip that permits MXML without the mx:. Now I know what you're thinking, and no, Mrinal is not, as far as I know, the kind Namibian man who continues to leave requests in the comments for me to help him transfer millions of dollars of his family's money out of the country.
Seriously, though, I appreciate Mrinal's willingness to help the community, and attempted to add to the discussion by commenting on his post, myself.
I did so enjoy my comment on his blog, and knowing what I've learned recently from The Book about how I can not only put anything I want on my blog, within the boundaries of local propriety, I can put anything from anyone else's blog -- even just mention someone else's blog, and before long, both of us will be raking in the bucks from our AdSense ads.
Wait a minute! I don't have any ads, and neither does Mrinal (maybe because he does, in fact, need to transfer money out of his country like the Namibian fellow who also attempted to entice me with sexual enhancement products, and as such has no need for revenue, or like me, sexual enhancement products). Of course the big question is, if I mention the phrase "sexual enhancement products" a bunch of times next to a bank of AdSense (or similar) ads, would it show a bunch of ads for just that very industry?
Hmmm. That could be fun. I'll look into it, although I'm not sure how well that will play with the significant GIS/Flex/Cartography readership I've carefully cultivated who, by definition, have need for neither Namibian money nor enhancement products.
Meanwhile, I've quoted my response to his entry to ensure, as The Book says, "maximum penetration of the vigorous, if digital, intercourse undertaken elsewhere"... or words to that affect, anyway.
It does make me feel a little ewwey, to be honest. My ego isn't quite so large as to need this extent of stroking, but I'm going ahead with it anyway. Damn the narcissistic implications! You, my faithful readers, are worth it.
>The explicit inclusion of the default namespace prefix both provides an immediately apparent visual cue and lends semantic context to an XML node. Arguably, the first thing a new user learns when initially encountering MXML is the existence of "those blocky things that make the flashy parts and all have the same prefix".
>From that point on, they know, when looking at examples online or in the documentation, that when they see "mx:", it precedes a "blocky thing", or class, that comes from Adobe/Macromedia, rather than from the author of the example they are attempting to understand.
>After some experience writing and using their own classes, and those of others (the far majority of whom employ the "mx:" prefix, serving to reinforce the notion), they arrive at a point that they can comprehend, and even understand that the prefix is superfluous and optional, the methods for omitting it, and the consequences of that decision.
>That said, I can say with (relative) confidence that including a namespace for every MXML node is what many would consider to be a 'best practice' for Flex development. Not so for general purpose XML… but this isn't general purpose XML… this is MXML!
>I would argue this is simply one of those pain-in-the-ass things that may make it infinitely easier to maintain or extend a project in the future… right up there with the use of concise, human-readable, and semantically appropriate variable names, placing spaces between operators and the values adjacent to them, and applying just enough comments to communicate whatever intention the well-written-for-clarity-as-well-as-performance code requires, and doing so during development rather than afterwards.
>I don't know what the 'right answer' is, or even if one exists. But I do know that simply because you can do something (and are even perfectly justified in doing so), doesn't mean you should do something.
>Nice to have the choice, though. Thank you.
Indeed.
about this entry
you’re currently skimming and ignoring “Ego and the Art of Programming ActionScript: Default Namespace Tricks.,”
- published:
- 07.06.07 / 8am
- category:
- actionscript, flex
2 comments
click to care. click to comment. | comments rss [?] | trackback uri [?]