XSLT and your mother don't speak C#

by Lisa Nicholls Sat, July 11 2009 22:56

Being an integration specialist is never dull.

I am going to excerpt from an IM chat with one of the programmers on my team, about an SSIS package we are developing.

He:
I got:
 
A package of type Policy, labelled as ECWISE\XXX 2009-07-03 15:33:17.940, FAILED during its run from 2009-07-03 to 2009-07-03.\r\nHere is the error information: \r\n"\r\n----------------------------------------------------Please do not reply to this automated message.

 
why the \r\n escaped in the mail?
i used the xslt to transform the xml column into a string variable, and later i use this variable as the MailMessage.Body
Me:
how do you set message body on the Send Mail task?
He:
i'm using the script task and using the smtpclient
Me:
You put in the carriage return and newline escaped in your body, what do you expect?
He
i expect a real new line
Me:
Why? That's ridiculous. what do you mean by "real"?
He:
I expect:

Here is the error information: C:\temp31 does not exist!
-----------------------------------------------
Please do not reply to this automated message.

Something like that.
Me:
FOR GOD SAKES
I KNOW WHAT A NEW LINE AND CARRIAGE RETURN LOOK LIKE
I mean: why do you use the word "real"...
What makes \r\n "real" to you?
Think about it.

Sigh.

At this point, everybody who knows me can tell this is a verbatim conversation, right?

To continue:

He:
I used the wrong word, sorry.
Me:
No, don't say "sorry". Figure it out!
Why is \r\n "real"?
Think why you said it.
they are only characters, why are they "real" ?
\r\n is real because...
He:
I thought they are carriage return in text
Me
Really? If you are writing a letter to your mother, and you write \n\r does she interpret it as lf cr?
The letter is text.
[A long pause here]
When you wrote that string in your code what did you do?
did you write x + "\r\n" + y in the script task?
He:
Almost
I'm doing it in XSLT, so concat(x, "\r\n", y)
Me:
<rofl>
That is utterly ridiculous.
Let me ask you about your mother again
Does she read \r\n as CRLF?
He:
Never.
Me:
That's right, never.

So why do *you* read it that way? Why does it seem "real" to you?

I will tell you why, but you will kick yourself... It's because you are a C# programmer .

\r\n is not "real. It is just a convention in some languages. There is nothing "real" about it.
Your mother and XSLT don't speak C#.

  

It's not XSLT's fault, or your mother's.

In XSLT he ended  up using <xsl:text> to force a line break in his text e-mail message. That's okay, but please note you can use properly encoded entity references to create a CRLF in XSLT, just like you can in C#. 

As an interesting side-note, this project was being written in SSIS 2005. SSIS 2005 script tasks don't speak C# either. So, even if we were not using XSLT to formulate the message from the XML source containing the error information, we would have to use a VB convention, not \r\n, to get the job done.

If he were sending the message body as HTML rather than text for this error notice, he'd have to use <BR/>. SSIS 2005 script and HTML are two more environments that don't understand \r\n.

There's always a way to do it. But there is nothing inherently "real" about \r\n, no matter a person who is single-language-centric might think.

I want to be fair and say that this particular programmer is usually very agile-minded as we hook differently-abled types of code to each other in an integrated application. I'm not pointing him out in particular.

We live in the Matrix

I'm trying to say: in the world we live in now, nobody can afford to be language-centric.  I'm trying to say: none of this is real. 

Use what's best for the customer and best for the product. Don't get hung up on what's cool or what a vendor recommends.  Don't get freaked out by the little places, like representation of characters, that are different in each environment. 

Just take a breath, get your bearings, you'll find the right "words" in the right dialect. If what you're trying to express is important, have a little faith and realize there's a way to do it, in any language, no matter where in the world you are. 

And be careful out there.

Tags:

General TechSpeak | Life | SQL Server | XML/XSLT

Comments (23) -

9/1/2009 4:32:04 PM #

Brad

You got that pissed off over such a simple question? You really need to relax. All it would have taken was explaining the correct method, but you had to be a dick. Was this in the documentation? If so did you recommend the person read the documentation for other pitfalls he may come across? No, you got hung up on the use of the word "real". Yes, it may be an inaccurate and strange way of saying it, but it's really clear what the person meant. All it took would have been a simple explanation, yet you had to be a dick.

Don't be an unprofessional arsehole to your colleagues. You're the one who should worry about finding the right words in discussions.

Brad United Kingdom

9/1/2009 7:12:16 PM #

&gt;L&lt;

I wasn't pissed off.  But I wasn't just going to give him a simple explanation; he's my student, not my colleague, and I generally like to lead him to the answer rather than giving it to him -- because he is a very good and promising student, and we have a long relationship and pretty good understanding of each other and how these conversations are supposed to work.  

I do need people on my team to lose "language tunnel vision", because of the kind of work we are asked to do.

I do find that simply giving the explanation doesn't bring us any further on that path, because the individual makes the same mistake next time unless led to think for himself.

And, Brad, I don't like to work with people who think they should be "given a simple explanation" so they don't have to think about the wider context of why the mistake is being made.  I try to kick them off my team as fast as possible, so as not to make them uncomfortable, and so as to continue Getting Stuff Done.  

See spacefold.com/.../...ronym-that-really-counts.aspx; I'm quite serious about this, and I have to be.

>L< United States

9/24/2009 5:58:39 AM #

&gt;L&lt;

No you may not copy this article on your blog.

>L< United States

11/11/2009 5:58:41 AM #

beera

i have solved my problem with your help .thanks a lot for posting such info here.

beera United States

11/16/2009 11:43:02 AM #

powerpoint presentation design

What is the latest version of XML and XSLT? And what is the difference b/w their previous versions?

powerpoint presentation design United States

11/22/2009 7:16:33 AM #

outdoor furniture plans

I agree doing whats best for the customer will end up making a better end product with less customer service issues.

outdoor furniture plans United States

11/22/2009 7:45:03 PM #

J

I don't know why I am writing this other than your article annoyed me.

For one trying to claim the person is single language minded due to \r\n is silly. One \r\n is not a convention of C# it is in fact a convention of C; Two Java, C#, PHP, Python all accept this information as new line and C++ and Perl interpret \n the same as C.  So for a single language mind set we have 5 languages that accept this convention and two languages that almost accept this convention.  

It seems to me you are ridiculing a person over the notion that their experiences says \r\n can be a new line in programming languages just because he hasn't interacted with other languages that say other wise.  A simple example would be you throwing something at a person because they picked up a Japanese book and assume you read it right to left.

Another statement that I find flawed is that XSLT and C# don't talk this is not entirely true (nor entirely false).  An XSLT style sheet can run scripts and last I check C# can be scripted which means XSLT can talk to C#.  In fact many XSLTs that I have been writing utilize C# Script in order to manipulate the XML document being translated in ways that would be more cumbersome if I were to do it in "pure" XSLT.

And last but not least I think the thing that annoyed me the most is the I lead a team and he is my student comment.  Now I could be wrong but typically a person can only claim another as their student if one they are in an academic arena for learning and you are his professor or two the person is genuinely under you for the purpose of learning (mentoring in a company setting).  Frankly if I worked with such a person who happened to be my team lead and he made the assumption that because he held such a title that I was his student and therefore he could insult my intelligence and speak to me how you transcribed the conversation I would be seeking a new place of employment after a visit to HR.  Even if he is under you; he is still a colleague; a person you are suppose to be working with not talking down to.

Anyways I will wrap this up since I have ranted long enough; this rant is not meant to be a trolling insult comment (though trolling can be claimed since I neither know you or have read your blog beyond this)

J

11/22/2009 8:33:42 PM #

&gt;L&lt;

J,

I don't tend to put labels on things in general so I'm not going to label you as a troll based on any rules, don't worry.  You're entitled to your opinion.  And you can be annoyed as you want -- but I'm going to answer you seriously and at length.

In *my* opinion, I neither insult my students nor talk down to them, and I believe that they understand this.  For one thing, the people who really do talk down to them are legion, and they can tell the difference.  For another, they are appreciative of the fact that I actually expect more of them and trust that they are flexible enough to do more than one thing. This, again, is in contrast to how they are usually treated.

It's a little scarey for some people to be held to high expectations, but it also helps them think better of themselves and their own potential.  

I'm also not going to be labelling you as "bad" or "wrong" based on your statement about scripting XSLT using C# (and yes, you can use libraries with XSLT, although in many cases C# would not be an optimal choice, there are better libraries available in other languages, for other processors). However,  in an integrated app, using many different techniques and languages together, there can be real issues with delivering a bunch of DLLs and getting all the permissions and everything else to work in the customer's environment.  In this case, the XSLT is being invoked by SSIS and there are some specific pain points you don't need to know about, but it's better not to use a "crutch" like this when you don't have to.

The analogy I used (regarding my student's mother) was deliberate, and reflects my personal relationship with that individual, which is extremely close.  

The analogy I was asking him to envision, and which he did immediately, was this: My student could write a letter to his mother and (1) require that she understand characters indicating a carriage return or (2) employ some device that automatically translates his characters into the expected carriage return in his editor or  (3) use a different editor just so he can hit the keys he thinks are a "proper" carriage return or (4) learn what is the right key to hit to get a carriage return natively in this editor, which has many other advantages for this situation.

Because he is Chinese and we "talk" on IM, my student has to choose (2) when he talks to me.  I'm very grateful that he can do it, and astonished that he can do it so well. But when he writes a letter to his mother, should he have to go through the same process?  

The analogy was particularly apt, because as he well knows and often comments on, I'm female and his mother's age <g>. (So that's the backstory there, whether you care about it or not.)

Perhaps you, not being either my student or somebody with whom I have a relationship, would like a different analogy more. Suppose you are negotiating for a price with a vendor.  Yes, you could use a translator in the discussion, but if you *could* you would speak the same language to have the most precise and personal understanding without an intermediary or impedance mismatch between language concepts.  It's safest, most accurate, and fastest.  

Yes, there are people who insist on not learning another language, both in life and in code, for their own convenience, for expediency, out of fear of the unknown, or a hundred other reasons.  I don't know what yours are, and they're probably perfectly valid. But they wouldn't suit the kind of work I do and they would make life impossible for the situation that my students, none of whom are native English speakers, find themselves in as employees of an American firm.  Frankly, I apologize to them *daily* for not being able to speak Chinese -- and again I am grateful that they make this huge effort. And they are grateful that I don't treat them like uncreative, low-potential robotic coders, based on language issues, which many other people have done.

Yes, I understand that you haven't read anything else here, and if you don't want to, that's fine. But I do talk about this frequently, and I do speculate on the many sides of cross-language communication quite a lot. So, for a little more insight, you might want to read this spacefold.com/.../...-in-Global-Communication.aspx.

>L< United States

11/22/2009 8:35:40 PM #

&gt;L&lt;

OK for some reason that URL got munged.  Try again (add the HTTP part):

spacefold.com/lisa/post/2008/12/20/Sensitivity-versus-Consistency-in-Global-Communication.aspx

>L< United States

3/30/2010 7:53:56 AM #

Dorsey Kudley

Thanks for your information on XSLT. I am studying this stuff at college at the moment.

Dorsey Kudley United States

4/5/2010 4:50:20 PM #

Jawatan Kosong

Never give up. You did the right thing

Jawatan Kosong U.A.E.

5/20/2010 12:15:22 AM #

Facebook Smiley

For what it is worth - I agree with J. - putting labels on things is a sure fire way to come across all manner of difficulties in life.  That said I appreciate your elucidation on the subject in your reply.

Facebook Smiley United States

5/24/2010 7:14:30 PM #

Wettforum

LOL At first, I thought that the conversation between you and your colleague may be somehow ridiculous, but it really made me laugh. But, if I were in your place, for sure I would be really frustrated or even devastated.

Wettforum United States

6/2/2010 9:12:42 AM #

lijfrente stamrecht

Haha, great chat session.. It looks like one of mine.

lijfrente stamrecht Netherlands

6/28/2010 1:55:10 PM #

iPod Free

I could swear my mother was speaking Visual Basic the other day, though I did have a lot to drink...

iPod Free United Kingdom

7/14/2010 6:35:41 AM #

business opportunity review

Lisa you got someone mad!  I take it the student was not as pissed off as that reader.  Must admit it did come across a little harsh.

business opportunity review Spain

8/5/2010 7:52:03 PM #

Restaurant Consulting

"Just take a breath, get your bearings, you'll find the right "words" in the right dialect. If what you're trying to express is important, have a little faith and realize there's a way to do it, in any language, no matter where in the world you are. "

This is true in more then just programming!

Restaurant Consulting United States

9/1/2010 4:01:10 AM #

Childrens Slide UK

lol "It's not XSLT's fault, or your mother's" made me chuckle! Great posting as usual Lisa!!Smile

Keep up the great work.

Childrens Slide UK United Kingdom

10/28/2010 2:54:44 AM #

Gardening Flowers: Tips and Ideas

Don't know what is wrong what is rite but i know that every one has there own point of view and same goes to this one

Gardening Flowers: Tips and Ideas United States

11/10/2010 9:43:54 AM #

C# help

I'm C# programmer. And I really loled when saw log of your messenger, I understand your programmer. And beleive me - my mother will do the same thing)

C# help United States

7/30/2011 2:09:41 PM #

Nikon D400

haha I just went through the same thing trying to explain things to my non-programmer partner...
thank god i get to use python most days Smile

Nikon D400 United States

12/31/2011 1:10:31 AM #

Basket hampers

It seems that the person you are talking to do not know what he is saying. Smile

Basket hampers United States

2/6/2012 3:22:13 PM #

Werner Gottschlich

In most of above comments I can´t see anything about the  c# programming skills from their mothers. Kepp this blog alive, sometimes I need something to lol...

Werner Gottschlich Germany