• bvs23bkv33 (unregistered)

    '###FIRST-start###'."\n".'###FIRST-end###'

  • TheCPUWizard (unregistered)

    Been there, done that --- On top of the "Strategic issues", that code [implementation is a nightmare.... Did someone forget the third leg of TDD????

  • Hermit (unregistered)

    He could have written regular xml and replace <>s with ###s in the resulting xml string. No one would have noticed.

  • Derp (unregistered)

    After the first rejection, the only appropriate response is "Okay, do you have a spec, or at the very least a document detailing the format you want the email to be in? No? Okay, I'm not writing anything until I have one."

    Easy.

  • Jaloopa (unregistered)

    Yes, that’s XML, if instead of tags you used ###some-field-start###value###some-field-end#### in place of traditional tags

    Simple then. Generate XML using standard libraries and then do a string replace at the end

  • Robert Morson (google) in reply to Derp

    You would wait for the first rejection to say that?

  • Patrick (unregistered)

    Herbie should be happy that atleast they changed their mind so quickly. Typically various drastic changes and additional requirements appear long after the code has been written, tested and put into production...

  • Sally Flynn (unregistered) in reply to Derp

    That's just what I was coming here to say :D

  • Quite (unregistered)

    I wonder whether this is deep legacy code which invented a txfer format way before xml was the merest twinkle in its parents' eyes.

  • Paul (unregistered) in reply to Robert Morson

    "You would wait for the first rejection to say that?" - Yes, because the first time it was asked they just wanted an order confirmation. While you can have some sort of "marketing and communication" department supplying the text for that, lots of (mostly smaller) companies don't.

  • Tom (unregistered)

    PHP on one side, VB on the other... what could possibly go wrong?

  • (nodebb) in reply to Robert Morson

    After I write the code to generate the human-readable format and get told that is was wrong, my reply would be, "Why did you not tell me that in the first place? I just did 3 hours of billable work for nothing. What is the file format we should generate then? If you don't know, put me in touch with the "Me" over there so we can work out all the details."

  • Derp (unregistered) in reply to Robert Morson

    Yes, because if you let it go wrong first due to a bad request you can cite it as evidence that they're idiots and in the long term gain more authority to tell them no.

  • Derp (unregistered) in reply to Robert Morson

    Also, sometimes the only way to get someone to tell you what is actually is that they want is to give them something they don't want first.

  • What? I'm not giving you my name. (unregistered)

    Extra layer of security by obfuscating xml.

  • Jaloopa (unregistered) in reply to Tom

    PHP to the left of me, VB to the right, here I am stuck in the middle with MUMPS

  • AbaddonsJanitor (unregistered)

    "You just KNOW they were parsing this with nothing but regexes"

    You just made me throw up in mouth a little bit.

  • DCL (unregistered) in reply to Quite

    IIRC standards like EDI (and its siblings X12, ODETTE, EDİFACT etc) existed before XML came along

  • (nodebb) in reply to DCL
    IIRC standards like EDI (and its siblings X12, ODETTE, EDİFACT etc) existed before XML came along

    I think you're right about that. I seem to remember XML was the fix-all for those things. Still waiting for the "fix" part ;)

  • Pulverized (unregistered)

    "It was bad enough to generate it, but Herbie was glad he wasn’t responsible for parsing it."

    So he never wrote any tests and has no idea if his code actually works?

  • anonymous (unregistered)

    Normally they try to shove XML onto things that shouldn't have it, rather than refusing it where it should in fact be used.

  • anonymous (unregistered) in reply to Pulverized

    There's a slight chance that they were given some test cases. Otherwise you can usually check this sort of thing by hand quite easily.

  • anonymous (unregistered) in reply to Pulverized

    There's a slight chance that they were given some test cases. Otherwise you can usually check this sort of thing by hand quite easily.

  • Duke of New York (unregistered) in reply to Pulverized

    While tests of some kind are helpful, Herbie's not really in a position to write tests that will verify acceptance by a parser he has no access to, which processes a language that doesn't seem to be documented anywhere and was discovered by trial and error.

    At the same time, Herbie's code exhibits the kind of brute-force string-banging that is the bane of my existence. Factor that noise.

  • Duke of New York (unregistered)

    Honestly, this post makes Herbie sound like a noob. When the boss says "send a notification to our automatic system", it goes without saying that the notification has to be in the system's own input format, not some random made-up XML schema. There generally isn't a mirror-Herbie waiting around to write the translation code.

  • isthisunique (unregistered)

    That is actually double ended python, not XML and it's actually easier to write a parser for that. It's also more human readable too. More human and machine readable than XML (lack of escaping aside). It isn't particular portable but I would parse anything over XML.

  • isthisunique (unregistered)

    My bad, I thought it was adding a hash on nesting. Still better than XML though. Anything is better than XML.

  • siciac (unregistered) in reply to isthisunique

    Anything is better than XML.

    Nope, SGML, MIME and ASN.1 are all worse. ASN.1 and all the DER, CER, CRT shit spawned from it are particularly horrific, those are the binary formats used in certs. Generally, the whole x.500 standard is a nightmare of biblical proportions.

  • MrAHoleDBA (unregistered)

    In a case like this can you just say 'ok well we don't support this custom format so we'll send it to you via XML and you can modify it to fit your custom format's requirements. I'm sure a dev team that writes a good custom format also can import industry standard formats such as XML and JSON, correct'?

  • ThatGuy (unregistered)

    The real WTF here is that "Herbie" wrote two iterations of the solution before bothering to find out what the requirements were. Frankly, the poor folks on the receiving end of his code have a better WTF to tell than "Herbie" does.

  • löchlein deluxe (unregistered) in reply to siciac

    What, you have a 1.7.4.23.47.11.0815 with ASN.1?

  • Simon (unregistered)

    My attitude would be "here's the data you want, in XML format". If you don't want XML, write an adaptor to turn it into whatever format you need.

  • Yazeran (unregistered) in reply to Pulverized

    I'm quite sure that he tested his work, but I do not think he had any access to the acutal parser (and he likely didn't want access, in order to preserver sanity).

    Who knows what quirks the parser has?

    For all we know there may be a special case buried somewhere where only the 2 outermost # characters are used for delimiters and the inner most pair is included in the actual data:

    ###mangled_tag### Data ###mangled_tag### results in the value '# Data #' being used in the application.... (and as already noted, they are likely using regexes for parsing, neatly discarding the 'extra' # characters on the outside....

  • Uno (unregistered)

    I completely understand the first misunderstanding, because the RTWF is using e-mail for app-to-app communication. Don’t.

  • (nodebb) in reply to siciac

    The worst part of ASN.1 (leaving aside the question of BER versus PER) is that it also infected SNMP, ILMI (which is essentially SNMP over AAL5 ATM frames), H.323, and many other things.

    But PER is the worst. BER is just a binary TLV format - all the information to at least be able to extract the data values is in the encoded stream, even if you don't know what that "7" there means. PER deletes as much of that extra information as it can, on the assumption that anyone trying to read a particular piece of encoded data will know which data definition schematic thing to use.

  • RLB (unregistered) in reply to Derp

    Cute.

    Yes, we have a spec. Here it is. Hands over sample CSV file.

    Next month:

    Here is our new data. Hands over CSV file in slightly different format.

    Yes, this happened to me.

    No, TPTB didn't allow me to tell them to bog off.

  • H. P. Spectre (unregistered) in reply to AbaddonsJanitor

    No need for that. Find and substring works fine.

  • Duke of New York (unregistered) in reply to Simon

    See folks, this right here is your bad role model. The kind of punk who always assumes that his job is someone's job other than his.

  • MiserableOldGit (unregistered) in reply to ThatGuy
    The real WTF here is that "Herbie" wrote two iterations of the solution before bothering to find out what the requirements were. Frankly, the poor folks on the receiving end of his code have a better WTF to tell than "Herbie" does.

    Well it could be that, but I quite often find I've got a middle layer of (mis) management or three and semi-competent business analysts between me and the client/end-user. In my current humiliating whore-ing out of my skills, I don't even know who or what is consuming my data, so I'm reliant on being drip-fed the wrong requirements and "correcting" stuff when I'm told it didn't work (usually without any meaningful indication as to why).

    They've usually written some misleading bullshit functional spec to get the thing signed off by the project board, so you get given that second, the first iteration being based on the misleading summary of it given by your line manager. Then you get some business analyst giving you their incorrect assessment of what's really needed. If you are lucky by the sixth or seventh iteration you get to talk to somebody at the other end of the chain who actually knows what they are doing and has some notion of what is needed.

    Of course at the end of all this, you'll get something working which might or might not make enough people happy along this chain that they all reappear to claim the credit for "another one of my projects has successfully deployed ... who are you? so what was your input on this? Hmm, right, is that a plate of doughnuts over there?"

  • Anon (unregistered)

    The only problem I can see here is not using stringbuilder.

  • Jim Tonic (unregistered) in reply to RLB
    Yes, this happened to me.
    Me too!

    Anyway, I sure hope Bobby Tables' little brother "###contact-person-end######mass-end######order-end###" isn't a customer of theirs.

Leave a comment on “Pounding Away”

Log In or post as a guest

Replying to comment #490859:

« Return to Article