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?

Lines of programming experience

I’ve written and sent resumes before. Looking at the job requirements listed by some of the companies, I will never meet many of the job descriptions. 5 years of C and C++ programming experience? 3 years of programming experience, involved in at least 2 complete development life cycles?

I daresay I’ve done more in a year than some ideal candidate of theirs with 10 years of experience. Alright, 7 years. Ok, maybe 5 years of experience.

The point is, programming is different from other jobs. The years of experience don’t count in the traditional sense. A manager of 5 years of experience is highly likely to be better than one with 1 year of experience. This doesn’t scale with programming. A veteran programmer with 5 years of experience can very well be worse off than a brilliant programmer who’s been coding only a couple of months.

It’s not the years of programming experience that count. It’s the number of lines of code you write that never see the light of day. And I’m not talking about superfluous stuff like


I mean, you might be paid by the number of lines of code you write, but seriously…

It’s that chunk of code you wrote to test out a concept in a for loop. It’s that printf statement you wrote to check how the output would look like. And those lines of code never make it to your final product. They never get migrated to a production environment. They were probably written to help you, and only you, to automate some task on a temporary basis (generating SQL insert statements come to mind).

I practised till my fingers bled

I was 13, 14 years old. I was in my school’s Chinese orchestra, and I played the zhong ruan. It’s like a guitar, just with 4 strings instead of 6.

I had a lot to learn then. I don’t have a music background, and I wasn’t familiar with Chinese orchestral music or instruments. Luckily, the musical scores were in numbers instead of what’s affectionately known as the “tadpole script”. So a 1 represents “doh”, 2 represents “re” and so on. A dot above the 1 means it’s a “doh” on the next octave. I just find numeric scores easier to read. *smile*

Anyway, one of the hard parts was learning the finger placement. The left hand was to hold down the strings on certain ridges on the instrument, while the right hand held the pick to strum the strings. The strings were taut and thin, and the string with the normal octave was the third one (and the second thinnest).

So after practising for a few weeks, my fingertips on the left hand started to hurt. I could see grooves forming, and there were red patches around them. It’s especially bad for my index and third fingers, since they pressed down the most frequently. And then it happened. The strings cut into my third finger.

I just put on a plaster and continued practising. I couldn’t quite feel the string anymore, which made playing harder. It depends on the sense of touch, since I don’t know if I’m pressing down hard enough. But I practised strumming instead. Did you know using the pick to strum a string back and forth in a consistent manner is very hard?

The point of telling you this entire experience was how determined I was to learn how to play zhong ruan. I knew after a while, the skin on my fingers would harden. I just needed to be patient. I was encouraged to borrow the instrument back home to practise, and I did. I remember lugging that huge instrument case around, and taking a taxi back home. I was just a young boy then, a bit on the thin side, and that case was very large and heavy.

Then I started to appreciate the music. I can follow the 4 beat pattern. After a while, sometimes when I was walking, I would feel the music in my mind, and I would walk to the beat.
1, 2, 3, 4, 1, 2, 3, 4
Right leg, forward, left leg, forward, right leg, forward, left leg, forward

I was living and breathing the music. Then I looked at the scores for the other instruments. I learned how they blended into the overall music, how they fit in. I could visualise in my mind that at a particular point, the cello would come in, graceful and mellow. Then the stringed instruments (that includes me) would bring up the main tune. Then the flutes would fly to the high notes. It’s just beautiful.

Learning how the entire orchestra works made me a better player.

The blood, sweat and tears

Did you know footballers (or soccer players) do weights training? You’d think they’d concentrate on foot work and stuff. It’s about balance. The entire body needs to be trained. Abdominal muscles to stop an airborne ball passed to them. A strong upper torso to maintain balance while the right leg strikes the ball. And I’m starting to get out of my league here… someone more qualified please cite me a scientific reference…

I watched a commercial featuring athletes. A tennis player (Maria Sharapova?) was doing balancing training and “crab dances”. You know, the moving from side to side part. What do you mean you didn’t know tennis players move from side to side a lot? Tsk, tsk… And there’s a Chinese hurdler, lifting his right leg just over a hurdle, then moving his leg back. He’s practising how much to jump and lift, to minimise the energy used for jumping, and funnel it back to running.

Sure, these athletes practise their sport. They also supplement that with complementary training, training that involves other muscle groups and skills. Because having a balanced body, a more responsive body makes them better at their core sport.

So what’s the real experience?

It’s the things you do behind the scenes. So what if you’ve got 5 years of programming experience? A dunce could maintain applications for 5 years and never create anything new or exciting or beneficial.

So start learning about the business surrounding your applications. Then you’ll be able to spot edge conditions that business people never saw. Try out code concepts in small chunks or applications. Then you’ll understand more of what your programming language can do. I mean, changing an integer to a string, then parsing it back into an integer so you can assign it to an integer variable is just stupid.

I practised for months before a music competition or school performance. Athletes practised for months for a sporting event. And all that practice, never really gets noticed.

Using years of programming experience as a benchmark doesn’t work anymore. Technology moves fast. You could get hired and sit tight without contributing anything substantial. 5 years go by and boom, you’ve got 5 years of experience.

Or you could practise the things that speed up your learning curve, that prepare you for a balanced programming skill set, that allow you to face a fast-moving world with uncertain problems. And create something that’s actually useful to the world. So how many lines of programming experience do you have?

There are no shortcuts

Successful people. Senior programmers who can debug without looking at code. Children who can beat the whammy out of you in chess. Secretaries who can spot the missing L in “pubic announcement”.

All of them have shortcuts. All of them use shortcuts. But they’re not successful because of using the shortcuts. They’re successful because of the knowledge gained through hard work, and as a result of that hard work, they created shortcuts.

There’s a difference between using a shortcut and understanding a shortcut.

The ternary operator

This is how the ternary operator looks like

condition ? value-if-true : value-if-false

In code, this will look like

int i = (100 > 90) ? 23 : 57;

and the variable i holds the value 23, because (100 > 90) is true.

Do you know its longer equivalent?

int i;
if (100 > 90)
   i = 23;
   i = 57;

Quite a bit to type isn’t it? My point isn’t about which is better, since both are useful and more readable depending on the programming context. My point is, do you know how they’re equivalent, that they work in the same way?

Using the ternary operator without understanding how the if-else construct work can be disastrous, particularly for new programmers. Debugging can take on a whole new level of slap-your-hand-on-forehead-why-me’s. Knowledge without understanding can be dangerous…

Most make-money-online people don’t make it

After you get over your retort impulse, let me say that the successful online entrepreneurs, businessmen and Internet marketers are great at what they do. The techniques they teach will make you money. It made them money didn’t it?

I’ve read a fair bit on these techniques. I’ve been to their seminars. Hey I’ve even bought some of their products. I came to a stunning conclusion. For all the tips, techniques and shortcuts they gave, it’s still hard work.

The usual situation is that they’ve found the simple solution to solving your problem (making money). They’ve identified the {insert your favourite number below 15} easy steps to making your dreams come true. You buy their product or service. You get zero to dismal results. They tell you that you just have to follow their method a little bit more, a little bit longer. In the meantime, how about some personal coaching to help you in whichever area you’re stuck in. You buy more. Ad infinitum.

That situation may not be true for you. I’m not condemning this process. All teachers do this. I’m sure their product works fine. The problem isn’t with them, it’s with you. Following their shortcuts isn’t enough. You must also understand why and how they used those shortcuts. There’s a lot of hard work behind those shortcuts.

Think about why some lottery millionaires go back to the way they were very quickly. They took the shortcut of lotteries and gained a million dollars. They didn’t understand how hard it was to make a million dollars, and so they lost the million dollars.

Taking shortcuts is easy. Understanding shortcuts is hard.

Ctrl-A, Ctrl-C, Ctrl-V

Can you guess what they are? In the Windows environment, they are the “select all”, “copy” and “paste” shortcuts respectively. Did you know that there are still people who don’t know the shortcut to copying?

There was this one time where I had to walk a user through some setting up of stuff. One of the steps required him to copy everything from one folder to another. And that’s what I told him over the phone, “copy everything from this folder to that folder”. Apparently I should have been clearer in my communication to him, because he didn’t know what to do.

Edit menu ctrl-c

So I told him to click somewhere empty in the source folder without clicking on any of the files and folders, do a Ctrl-A, do a Ctrl-C, then go the destination folder, and do a Ctrl-V. Otherwise he could still be searching under the [Edit] menu, and using the mouse to click on *shock* the “Copy” menu item.

That user might not have to understand the hard work that went into programming that shortcut. He only had to appreciate how that shortcut could make his life easier. Then use it!

Shaving off 20 years

I remember watching this movie where this young man of 14 years old committed some crime. It was quite petty (and I think a misunderstanding’s involved), yet the law in the movie dictated that he be sent to jail. For 20 years.

And it’s not just any 20 years. The technology in the movie was such that a human body could be placed in stasis indefinitely. Here’s the terrible part. The body itself would continue to grow, yet the mind was locked in time.

So this young man emerged from his time prison, 34 years of age, yet 14 years of mind. The time prison was created explicitly to take away prisoners’ life, in terms of memories that could never be formed, and the time that could never be gained.

The law in the movie took away a prisoner’s time, but never gave the prisoner time to repent. There’s no time to learn, to grow and to understand. Only the shortcut of time fled past.

Blink-of-an-eye transportation

I’ve also watched this drama series called “Earth: Final Conflict” where Taelons, an alien race, came to Earth. One of the coolest things in the show was this near-instantaneous transportation device. With a device in the North Pole and another one in the south, you could move between the two poles in the blink of an eye (though I couldn’t fathom why you’re in the poles in the first place…).

We used to have to walk five kilometres. It was hard work. We sweat, our legs tired, our lungs out of breath, and a whole lot of time was gone.

Then came wheels. Shortcut. Man-powered wheels advanced to wheels powered by fossil fuels. Shortcut. It came to the point where you could stand in place waiting for a bus, get up that air-conditioned bus, sit down, not having to do anything, and you still travelled five kilometres. No sweat, no muscle cramps, easy breathing and lots of time saved. Shortcut.

Do you even know how hard it is to walk five kilometres? Can you appreciate the shortcuts our modern transportation have provided?

When we have understood, appreciated and used the shortcuts, maybe, just maybe, we could understand how to take it to the next level and realise that Taelon technology. Where we could move from here to there, in the blink of an eye.

In closing

It’s ok to take shortcuts. You should also understand the hard work that went into those shortcuts. Only then do you not just stand on the shoulders of giants, but be the shoulder for the next giant to stand on.

Otherwise you’d be stuck at the level of using Ctrl-C, and never progressing to implementing a better way of copying stuff.

The people who succeed in using shortcuts, are people who understand the journey and the hard work behind those shortcuts. And if you know a shortcut to understanding shortcuts, let me know.