ToString() and cultural insensitivity

It was a scramble going through my entire code base. We’re talking thousands and thousands of lines of code here.

Luckily there was the Find function. And that the search string was fairly unique. And that the code change was fairly contained.

So what was I getting all hyped up about? Someone submitted a bug report telling me the SetRowHeight() function of my spreadsheet library didn’t work. What?!?! I tested that thing and it worked fine!

“What do you mean by it didn’t work? Was the row height changed to a wrong value, or something else” I asked.

“It completely failed. I can’t even open the Excel file.” was the answer.

Oh cranberry. Oh flying fishball hashbrown cranberry.

So I asked the person to send me the resulting Excel file that was generated. I looked through the contents, and found this: “40,2”

Shouldn’t that be “40.2”, I wonder.

And then I looked at the person’s name real close. I guessed the person’s somewhere in Europe that uses the comma as a decimal point character and the period as the thousands separator.

I proceeded to set every numeric variable that uses the ToString() function to have ToString(System.Globalization.CultureInfo.InvariantCulture). There were other changes I made based on this knowledge, but that ToString() was the main change.

Now this isn’t a post telling you about ToString() and thinking about how your program works in different cultures and so on (The biggest one I know is the Turkish “i”. That one seems to be a nightmare for upper and lower casing changes). The lesson I want to tell you is that no matter how much you check your software, the moment an actual user (in my case, a programmer) uses your software, shiitake mushrooms hit the fan.

You will only really know how good your software performs when other people are using it. You have no idea where they’re using it (like in my case), how they’re using it, or even why they’re using it. This means the sooner you put your software out there, the sooner you know whether your software is actually useful.

It doesn’t mean put out sloppy work. It just means you put out work that’s done to the best of your abilities, regardless of how small that feature list is. If it’s a bug tracking software, make sure it can track bugs easily. If it’s a shoot-em-up game, make sure I can run around easily and shoot enemies/monsters/aliens (fairly) accurately. If it’s a calculator, make sure it can at least add, subtract, multiply and divide before doing all those scientific and accounting functions.

So what software projects are you working on right now? What can you cut out so you can devote more energy to the core of your software?

Responsibility culture

Clearly yesterday’s article struck a nerve. I usually have zero comments on my articles. But for yesterday’s article, I had 2 people commenting! That’s like an increase of 2/0 = infinity percent! Marketing and business people will kill for this kind of return.

I want to thank James Carman and William Saunders for their comments. I’ll return to their comments in a bit, with a bit more clarification about that story. But first, let me tell you another story.

“Don’t say sorry.”

“Vincent, I just want you to know something.” I felt my stomach twisting a little. “This can’t be good,” I thought. She spoke in barely a whisper, like she was afraid other people might overhear her, and I suck at phone conversations, so it’s doubly worse. “You shouldn’t say sorry to those people. It makes you look weak, and they will take advantage of you.”

Those aren’t the exact words, but the essence is there.

This happened like 3 or 4 years ago (I think). I was working as a Systems Analyst, but for expediency’s sake, just take it as I’m responsible for anything tech-related, unless otherwise stated. I work in a small team, as in like me and my supervisor. I mention this because my supervisor gave me a lot of autonomy on how I work. Basically, she just told me “Vincent, I need you to do this.”, or asked for input “Can we do this?”, or “How long would it take?”, and then just let me do my thing. Because she had her own stuff to do.

I know there are people out there who say that managers (or people in managerial positions, say a supervisor) of programmers should be protecting programmers from being disturbed (for lack of a better word). People like Joel Spolsky or Michael Lopp. I support this in general. It’s just that sometimes, the situation doesn’t quite allow that. My supervisor already shielded me from a number of (unnecessary) meetings (for me) and does most of the documentation (for the design, not the code).

So what usually happened was that whenever tech-related problems came up, they email my supervisor. Typically, it’s so technical that she would route that email to me. Eventually, the users learnt that I’m the ultimate person to solve their problems, so they skipped my supervisor. If the task in the email was too big or involved, I will let my supervisor know and let her decide if I should proceed. Otherwise I just solved the problem, sent an email to the user(s) and CC my supervisor (just so she knew about it).

Well, some problem cropped up. I can’t remember if it affected customers or internal users. Ok, it probably affected paying customers, otherwise it wouldn’t have been that big a deal. It might have involved customers in that million dollar deal thing I worked on. I don’t think it was entirely a mistake on my part, but I don’t think that’s important. I felt the important thing was to solve the problem, and then move on.

I solved the problem, and sent an email telling the people involved that the problem’s solved. I also apologised that the problem cropped up. I treat myself as a business working within a business (my employer). If your customer had a problem with your products or services, would you make it right and apologise? I would. It really doesn’t matter if it’s your fault or not. The customer typically doesn’t want to blame you specifically. The customer just wants the problem to be fixed. At least that’s what I’ve learnt from reading business and marketing books.

Apparently, one of the users was concerned for me (thank you!). She called me up personally, and advised me to not apologise. It might make me easier for other people to pin the blame on me (whenever technical problems crop up).

Anyway, I believed that if a program or application was under my care, then I’m responsible for it. It didn’t matter that the source code was written by someone else. It didn’t matter that I didn’t have full control over where the program resided, or what it did, or why it sometimes had problems. I took responsibility for it. I think I read Seth Godin write something on it. Maybe this one.

In our current economic situation, it’s ever easier to blame other people than to take responsibility. Taking responsibility means putting yourself on the line. It’s frightening. Which reminds me of another story. I was once in charge of a task force to find out “why people are afraid to speak up”. I’ll tell you that story another time.

The point is that the corporate culture (back then. I don’t know about now since I left the company) had an in-built blame culture based on fear. I was trying to spread a culture of responsibility, hopefully by being an example. With that, I return to the comments left by James and William.

On blame culture

If you skipped all the way down here, this is the story I told. James said,

Your story is a key example of why I am willing to take a pay cut, rather than work for a business like that.

First off, that company I worked for wasn’t too bad. The department I worked in had very little office politics (such as it was). Maybe it was that my team worked in a different location than headquarters. I typically go to the office with the feeling that I’m making a difference to my users. Even if I don’t directly contribute to the bottom line, I think of it as helping my users, who do contribute to the bottom line (the sales staff particularly).

That said, William had this to say,

That situation would make me want to quit. Large scale operational inefficiency goes way above/beyond people in our position, yet can sometimes directly impede us getting our jobs done. […] Really I think it should not be your concern how much the man-hours cost to get what you need done, especially since a whole team of people seemed to be fine with lobbing a bunch of blame your way.

The blame part happened because in the meeting, other departments were involved. Now that outsourcing project involved taking a bunch of the company’s work functions and bundling them together to be handled by the Cheng Du staff. Many other departments were involved. I got dragged along because the program I’m responsible for (see, see?) was involved (albeit a small part).

My supervisor was a nice person. It just so happened that she wasn’t around that day. My associate director and senior manager weren’t even involved in that program I’m in charge of. They might have gone along to the meeting just to see what the offshoring project was about, and my (program’s) involvement gave them an excuse to join (I don’t know about their intentions, so don’t quote me on this).

So when all eyes turned to me, I took the heat. I don’t remember feeling indignant about it. Just a kind of all-round-sucky feeling. I’m not saying this to protect my behind, or to not burn any bridges. My superiors were generally nice people. It just so happened that those people at the meeting wanted to point their blame cannon and fire at someone. I was the most dispensable. I was even the youngest at the meeting if I recall (have I mentioned my boyishly good looks? *smile*). Someone had to be responsible, and I decided stopping the blame game right then would move the meeting along the fastest. I even took notes on what I could do to improve the situation (that’s what the pen and notepad was for).

With regards to that $375 thing, it turns out to be some company policy. It’s an internal charges thing, and I charged at that rate too (or more specifically, my department charged that. Everyone charged at that rate). Even though opening up network ports and granting network access should be easily done (by a competent network administrator) within say, half an hour, the policy seemed to be that a minimum of 4 hours effort be charged. I’ve learnt to “bunch” up my requests when possible.

I’ve been “consulted” by my supervisor on how long a project would take. I’d give an estimate, say 5 days, and she would charge the department I’m to help. My department technically earned about 30 grand. I don’t get a single cent from that. It’s a “passing money from the right pocket to the left pocket” thing.

And yes, I’ve written such technical requests and viewed requests to my team/department before. That’s why I know the rates.

Dang, I should probably be a millionaire by now.

Maths, context and culture

I was reading this post by Dan Meyer on pseudocontext in maths problems.

If we invite pseudocontext in our classrooms without condition, it becomes harder and harder to tell the difference between the real and the unreal.

Back when I was young, a lot of maths problems made little sense to me. In those days, the maths syllabus up to primary 6 (at 12 years old, or grade 6 if you’re in America) wasn’t particularly hard. At least to me. I’m not bragging, I’m just saying that the education system made things more difficult by introducing word problems. The epitome of conquering a maths exam paper was solving all the word problems at the end.

Word problems were created to introduce another element into elementary math (to make them difficult?). They added language. Suddenly it was something like:

John, Fred and Ken had $5 total. John bought 10 red marbles and Fred bought 12 blue marbles. If 1 red marble costs $0.10, and 1 blue marble costs $0.15, how many blue marbles can Ken buy if they still want to have $1 left?

Your command of the English language became a factor. But it was still ok, because the wording usually formed a pattern. It was marbles, people’s ages, number of apples or oranges in the basket, or some such. In a normal situation, if I really wanted to know your dad’s age, I’d just go ask him. I don’t really need to infer that your dad is 2.5 times your age, and then I figure the answer out (assuming I know your age).

Students here kill each other with A’s

Now if you don’t already know, it’s bloody competitive here in Singapore. Students are afraid of not doing well in school, of heads shaken by their friends, teachers, parents and relatives. Parents send their children to tuition classes (in addition to the normal school classes), regardless of their children’s grades. If the grades are bad, then improve them. If they’re great, great! Now perfect them. Go do your ten year series!

I went to tuition classes till I was 10 years old (primary 4 or 4th grade). I stopped because my dad couldn’t afford to pay for the classes. Being able to eat and pay the bills were more important. It’s a good thing I was disciplined enough to get good enough grades (and imbue enough motivation for all subjects, not just maths).

When I was in university, to supplement the cost of education, I looked into giving tuition. I was surprised that everyone from primary one to university level (?!) were asking for help. Let me just say, I make a lousy tuition teacher. I don’t really know the current syllabus well enough to help the students. Once, I brought up the subject of video games, using the position of battleships to illustrate … something. I can’t remember. I think it was x- and y-coordinate stuff. I was trying to interest the young boy I was teaching. It fell flat. I suck…

The Singapore Math Method

Which brings us to curriculum. It turns out that under the Singapore maths curriculum, Singapore students rank high for maths internationally. It’s so good that America has adopted the method. There’s even a name for it: Singapore Math Method. Let me tell you, I’m simultaneously amused and confused.

I’m even more surprised that Israel adopted the method in 2002, translating the textbooks to Hebrew. I was browsing in the bookstore reading Start-up Nation (Amazon link). It told a story of how Israel, being surrounded by hostile countries, had to innovate hard. Their brightest people are in the universities doing research and are also in the top military ranks. The book told a story of how the “flat” nature of their military translated to their way of doing businesses, in particular start-ups. My friend Christopher told me that per capita, Israelis were the richest in the world. It’s their culture that made them more inclined to creating wealth. I was also told about the Jewish mother syndrome… So I’m a little surprised that this group of people want to know about our (Singaporean) method of teaching maths.

I still believe in solving real world problems. I believe we’re not injecting enough curiosity into our students. That Singapore Math Method seems to have less force-feeding of concepts, and more of coaxing the student to question. The Singapore culture doesn’t seem to require curiosity for the students to do well (have I mentioned the parents are bloody competitive?). Hopefully, that’s changing.

This is going to be a cynical view, but I think most Singaporeans are striving for wealth, and wealth alone. Wealth translates to a better life. There’s nothing wrong with that. Singaporeans strive hard to attain wealth so they can forget about (seemingly) miserable lives. Ok, let me take that back. Apparently, Singapore is one of the happiest places in the world. There’s a “but” though…

Singapore ranks high on evaluated happiness, but not on experienced happiness

Alright, this is starting to depress even lil’ cheerful me…

So. Problems are formulated, and then given to our students to solve. But they have to learn how to formulate problems too, and that comes from asking questions, from being curious, from being disciplined and persistent. And that comes from cultural and societal influences, not from educational systems.

Math, culture and programming languages

Can a programmer’s background determine whether he’ll be a great programmer? By background, I mean his upbringing, the values learnt, his primary (and perhaps secondary) spoken/written language and so on.

I don’t know. However, I have arguments for and against the proposition. Let’s start with…

Learning to count

You think counting is easy? Apparently not. Recently I read a book, Outliers by Malcolm Gladwell. According to Gladwell, American children the age of four can, on average, count up to fifteen. Chinese children at that age can, on average, count up to forty.

His reasoning is that, the system of naming numbers is different in English and in Chinese.

For example, think about counting from twenty to thirty (I’m deliberately using the English form instead of the Arabic numerals to highlight the difference). You have twenty, twenty one, twenty two and so on till twenty nine and thirty. How about thirty to forty? Thirty, thirty one, thirty two and so on till thirty nine and forty.

Consider counting from ten to twenty. Ten, eleven, twelve, thirteen and so on till eighteen, nineteen and twenty. The pattern is different and irregular.

Before I show you the Chinese method of counting, let me show you the first 10 numbers, shown by the Arabic numeral, the English name and the (closest) Chinese pronunciation I can give:

1 one (yi, like in “yeast”)
2 two (er, like in “brighter”)
3 three (san, “sahn”)
4 four (si, do a short hissing sound with the s)
5 five (wu, “woo” and keep it short)
6 six (liu, “li” and “ou” as in “shoulder”, and string li-ou together quickly)
7 seven (qi, “cheese” without the s, and shorter in length)
8 eight (ba, as in “barter”)
9 nine (jiu, “gi” as in “gin” and “ou” as in “shoulder”. Like that of six.)
10 ten (shi, like that of four, with the h)

There are actually 4 tonal inflections for a Chinese character pronunciation, and we’ll ignore that for this discussion.

So to count in Chinese from ten to twenty, we have shi, shi yi, shi er, shi san, shi si, shi wu, shi liu, shi qi, shi ba, shi jiu, er shi. They are literally “ten”, “ten one”, “ten two”, “ten three” and so on till “ten nine” and “two ten”. There’s an implicit “one” in front of the “ten”, so it’s “one ten one” for eleven. For twenty three, it’s “er shi san”, or literally “two tens and three”.

Gladwell says this gives structure to the counting system, so children are able to grasp larger numbers quicker. The faster you can count to larger numbers, the more operations you can do on them. Additions, subtractions, summations and so on.

Ok, I’m not saying the Chinese number naming system is better than the English system. It’s just different. Gladwell says this difference also makes memorising short number sequences easier. For example, I can remember my Identification Card Number (equivalent to the Social Security Number in America) easier in Chinese than in English.

It explains why when someone asks for my phone number in English, I have a problem. Because I’m mentally translating my memory of the phone number from Chinese to English. Did you know it’s kinda hard to say out 8 digits in English while translating them from a Chinese memory? I can even mentally picture the numbers. It’s the speaking out that’s taking up mental processing time.

Gladwell also made a point about Cantonese (a Chinese dialect) pronunciation of numbers. So I tried saying out numbers in Cantonese (yes, I’m multilingual), and wow, it is easier to say and memorise! The Cantonese pronunciation of numbers are short in length, which makes it easier to spit them out *smile*

And the relation to programming? Programming is made up largely of counting and solutions formed from abstract ideas. When I first learned C, I was surprised that many fellow students had difficulty counting the number of iterations in say,

for (i=0; i<10; ++i)
{
	if (i>7) break;
	// do something
}

Counting and iterating leads to lists of data, or sets of data. In SQL, you can manipulate sets of data as if it’s one unit, abstracting away the fact that the data is actually iterated one by one. For example, you can select information from another data set, or a subquery as it’s known.

Of course, there are still some people who have difficulty visualising SQL data sets as one unit, hence their need to iterate over that one record by one record at a time, even when there’s no need. What does that tell you about these people?

Hard work is valued

Gladwell also made a point about culture. That successful people seem to grow up with a culture of valuing hard work. The ability to think on a problem long enough to come up with a solution.

He said something worth thinking about. There’s a educational researcher by the name of Erling Boe at the University of Pennsylvania. Boe says that one can know if a child will do well in math without asking that child a single math question.

The example in the book was a fictional Math Olympics. Before the test, there was a questionnaire to be filled in. There were tons of questions inside, none related to math. Boe asserts that a child who finishes that questionnaire will also do correspondingly just as well in the math test.

It’s a question of perseverance, the willingness to put one’s mind to work, even if one doesn’t feel like it.

Hard work is something valued in the countries of “wet-rice agriculture and meaningful work”, as Gladwell puts it. Based on the research of Boe, the top countries are Singapore (yay!), South Korea, Taiwan, Hong Kong and Japan. Though I’m not so sure of my fellow countryman’s motivations… The parents and children could be driven more by the race for top scores rather than the culture passed on by our forefathers.

Well, I haven’t read much on Boe’s research, but the hardworking nature of my countrymen is fairly accurate. Students are willing to study for long periods of time (most of them anyway…). Adults are willing to work just a little longer, a little harder at work. For example, I recently knew that my friend worked overtime till 4 am at the office. Personally, I think that’s crazy, but to each his (in this case, her) own.

The native language

There was a question in StackOverflow about coding in other spoken languages, which was highlighted in Jeff and Joel’s recent podcast.

The reserved words in a programming language are fixed. Usually they are in English, though there are programming languages in say Chinese. I didn’t know there was a Chinese version of BASIC!

Once, I took up an SQL reference book, written in Chinese. I want to mention that I cannot read a programming reference book written in Chinese. That is to say, I can certainly read the Chinese characters, but I can’t understand the heck what it means.

I need a reference book written in English for SQL, because the native (human) language for SQL is English! Unless there’s a variant I don’t know about…

I’ve seen some code written in Spanish before, I think. Can’t remember. Anyway, the native language for the programming language (C, I think) was English, so the code reads fine. The variable names look different, but I didn’t have too much difficulty.

My guess is that my math background prepared me for abstract notions and symbols, and still be able to work with them. So I treated variables named in a foreign language as just another symbol. And continued to read the code based on that.

And this brings me full circle to…

So does background really matter?

I am unfamiliar with how an American (or English, or French) grows up. I don’t really know the values valued, or the culture surrounding the upbringing of a child.

I do know mine. I’m brought up learning two languages (English and Chinese), two Chinese dialects (Hokkien and Cantonese). I taught myself to read Japanese characters. I’m brought up around people who wake up before dawn to work, and work long hours, regularly and consistently and over long periods of time.

Personal values, personality, genes and luck. I agree they play a part in the makings of a great programmer. In particular, I believe that one’s background influences personal values and personality, so in that sense, background does matter.

And specifically, I think my math background makes grasping programming concepts easier for me.

Of course, everything you’ve just read could be hogwash, because I’m still telling (interesting, I hope) anecdotes to illustrate points as Joel points out vehemently. I haven’t read a lot about computer science and its history in America (or pretty much anywhere in the world). I research just enough so that what I write is as true as I understand it (sometimes I don’t research at all!).

I admit that I’m still naive and easily impressed. I still pretty much trust what I read as true. It’s only when I start internalising the information that I really think about them.

So what do you think?