Eccentric Flower talk:201108/How My Light Is Spent
From Eccentric Flower
Comments on Eccentric Flower:201108/How My Light Is Spent
...and here I was bitching about my inability to get Excel (sans programming) to allow me to parse about 30,000 records in exactly the manner I wanted! ha!!
And please tell me that your comments really are as snarky as all that. I'd LMAO if I read one of our programmers' code and it had comments that were half as useful and amusing.
-- 01:15, 19 August 2011 (BST)
That is actual code. All I did was paste it in. Nor did I doctor the comments for this audience. All my code looks like that. If I don't comment code, then three years later when I have to dust it off and replace its guts (as I did this time), I'll have no idea why I did what I did.
-- 01:35, 19 August 2011 (BST)
Dan: I kinda knew you would.
I don't actually mind the XML. It's a pretty well-defined block of XML, it's easy to write out to, and the guy who wrote the DTD answers email fast and is a good guy. It's a much better situation than trying to get help/answers for the database which is the INPUT to this routine!
-- 01:39, 19 August 2011 (BST)
"Wind the frog!" is a personal joke of long standing. You will find it in Toy Story. It often turns up in my code at the point when all the mise-en-place is done and it's time to actually start putting data in the Cuisinart.
-- 02:11, 19 August 2011 (BST)
I'm a little surprised that you're using print statements to write the XML, but that may be because I've been burned more by poorly-escaped XML than I have by poorly-designed third-party libraries. :)
-- 04:37, 19 August 2011 (BST)
I gather you mean print statements as opposed to some XML-writing library? Two reasons:
1. Too much opaque overhead. I like to know what code is doing. The only times I install libraries like that are when it's too big a pain to parse it or write it myself. I simply don't trust other people's modules well enough. With the print statements I can see and format exactly what I'm writing - and there's not enough of it to justify hauling in a library just to send XML. (I don't write XML in any other code I own. Just this one script.)
2) Perl XML libraries all seem to work on the basis of "First you build an elaborate nested data structure, then you send that whole structure to the XML library and it spits out the XML file for you." hashes of hashes of hashes of hashes ... I did not need or want to take that approach here.
As a counterexample, for my code which must read JSON, I *did* use a library, because JSON is much more of a pain in the ass to parse properly than XML. And the library works fine, but taking apart the elaborate data structure it creates is just as hellish as I anticipated - iterate through keys in a hash via pointer until you find the array of hashes which has the actual data rows, then iterate that array via pointer which you must cast to hash because each array element is actually a hash pointer, then iterate through the keys in each hash via pointer ... urghl.
I love Perl's structural flexibility, but sometimes when trying to walk into deep structures, I do wish I was still writing in a language with a 'struct' keyword. I sometimes miss being able to say year.term.course.max_enrollment instead of $years{$term}->{$course}{'max_enrollment'}. On the other hand, these days if I tried to write anything in C it would take twice as long, and it's not well-suited for the environment I work in anyway.
Other languages? I speak PHP. It's like Perl but with JavaScript brain damage thrown in and [deliberately poor] separation between code, template, and output. Python combines some of the worst features of Perl and C++ and adds whitespace-based termination to boot. Any language where a block is delimited by indentation instead of delimiter characters is a bad, bad, bad language. (In a proper language, code will compile even if you remove all the leading and trailing whitespace and render it as one big block.) C++ is a clusterfuck of OO that big-project progammers like with justification because it keeps their team from stepping on each other's toes as much, but for a one-man shop, all that overhead and opacity leads to brainrot. (In my lexicon, OO may mean "object-oriented" but also means "overhead and opacity," where I have to load fifty cryptic black-box object/class libraries to do what I want to do.)
Java, of course, is the worst of all possible worlds - nasty, brutish, AND slow.
All other languages currently in anything like active use are impractical novelties (the kind of thing a friend used to disparage as "teaching languages") or old relics.
There, that's the rant you didn't get in Twitter the other day. Every time someone picks on me for Perl, I ask what alternative they offer, and then I go off and secretly laugh.
-- 15:50, 19 August 2011 (BST)
May I quote "Every time someone picks on me for Perl, I ask what alternative they offer, and then I go off and secretly laugh." publicly?
Some day I will dig enough into Moose to figure out how to do its automatic accessor methods in a way that's compatible with XML::Parser(Style=>Tree)'s output, but until then... well...
I keep going to Python, thinking that the simple class member notation is the right thing. I keep writing voluminous mountains of code that seems to be wonderfully maintainable and reusable and all those "...ble"s, and then I go solve a problem in 10 lines of Perl and by the time I get back to the Python I'm thinking "WTF? Why didn't I just use Perl and be done with this."
Or use C++ and actually have performance -n- type safety -n-shit.
The thing about Java is that its awfulness seeps out into the applications that use it. You can tell a Java app, both by how hard it is to admin it, and how clunky it is to use.
Oh, and my one suggestion: those "department" tags seem like they should be coming out of some sort of array.
-- 16:46, 19 August 2011 (BST)
May I quote "Every time someone picks on me for Perl, I ask what alternative they offer, and then I go off and secretly laugh." publicly?
Sure.
Oh, and my one suggestion: those "department" tags seem like they should be coming out of some sort of array.
Yeah, they probably should. The original code was better and then I found I couldn't send multiple departments for a single course, so that was a hasty last-minute job.
-- 17:11, 19 August 2011 (BST)
I add snarky comments all the time at work. For instance (I can do this, as this is a protected site, and even if it does goes public, it's a comment about some third party code we're forced to use):
/*------------------------------------------------------------------- ; You might be thinking, "Oh, callback? You must be meaning to use ; spm_notify() to register a callback to the NewNet SS7 stack." And in ; this case, you would have been right, for at one point I *did* use ; spm_notify() here, but not anymore. ; ; "But why not? That's what it's there for, right?" you ask. ; ; "Ow!" you say as I hit you witha clue-by-four. ; ; "No, grasshopper," I say. "It's there to *temp* you. To lure you into ; the firey pits of 'unintended multithreaded programming.' Heed my ; warning, and do *not* use spm_notify(), for spm_notify() is unto like ; programming a signal handler, where you do not know the execution ; context of the call and therefore, bad juju can happen at the drop of a ; bit." ; ; "Buy why would NewNet make such an API?" ; ; "Because they know not what they do. That, and the code is most likely ; older than you are, from the ancient days of Unix, when the Old ; Testament (the original K&R) ruled the land, and Streams (TM) seemed ; like a neat idea (it wasn't). And we know not the secrets of the ; codebase, since NewNet is loathe to reveal them to mere licensees." ; ; "Ah." ; ; "Ah, indeed." ;----------------------------------------------------------------------*/
And if that wasn't snarky enough, I (along with another developer) add snarky messages to the revision control log (revision control is a piece of software that you store source code in and it allows you to retrieve any version in the past):
"Okay, I'm stupid. That's what I get for being too close to the problem and my cardboard programmer flew off to Rachel Nevada to commune with the UFO New Age Hippies. Or something like that.
"Anyway, I broght this upon myself for confusing tps.encode() (which encodes a TPS packet) with tps.escape() (which URL encodes a text string). I found this out by setting a breakpoint on tpslua_escape() and when I ran a test, found it didn't trigger!
"Oh man. How embarassing.
"Anyway, I got a new version of the TPS simulator going (this one can run outside the SS7Sim and thus, doesn't need to be run exclusively on sol anymore so that's good) so maybe I can now progress on what I was trying to work on.
"I just love side quests. And by "love" I mean "loath more than "Highlander 2", and "Highlander The Source". If you have to ask, by all means, watch "Highlander" and *then* "Highlander 2" and "Highlander the Source". *Then* you'll understand how deep my hatred of side quests like this are.
"You have been warned."
-- 22:50, 21 August 2011 (BST)
And just to clarify a few terms. SS7 is protocol used to manage telephone calls between telephone switches. NewNet is a company that provides an implementation of the SS7 protocol that isn't worth the electrons to run it.
Yes, we have a TPS component, that actually generates TPS reports. I am not kidding (a fellow cow-orker named it that intentionally.
And if you think "Highlander 2" was the worst movie in the series, it's way better than "Highlander the Source". You have been warned.
-- 22:57, 21 August 2011 (BST)
"Side quests" in this context is great. That's the problem with what I'm doing right now - I'm trying to progress toward a goal but I keep having to stop and do side quests!
-- 23:12, 22 August 2011 (BST)

DanLyke:
I've tried and failed to write a couple of responses here. A few suggestions for some clean-up, some sympathetic snark about XML, stuff like that, but really, none of that matters.
What I'm really trying to say is simple: I feel for you.
-- 23:23, 18 August 2011 (BST)