Code-switching while coding
April 9, 2008 12:43 PM Subscribe
Code-switching while coding: if you speak more than one language and are a programmer or a web-developer, do you write code in one or the other or both?
I find myself using both English and Spanish for class, function and variable names, for example, as well as for comments. This is probably not a best-practice, but quite natural if you're bilingual.
Do you do this? Do you have a system or just do it randomly?
I find myself using both English and Spanish for class, function and variable names, for example, as well as for comments. This is probably not a best-practice, but quite natural if you're bilingual.
Do you do this? Do you have a system or just do it randomly?
Do you have colleagues who might have to debug your code someday? If so, using the language that they speak (whether that's spanish or english) will make life easier. Descriptive variable names aren't helpful if they're in a foreign tongue.
posted by chrisamiller at 12:50 PM on April 9, 2008 [1 favorite]
posted by chrisamiller at 12:50 PM on April 9, 2008 [1 favorite]
I only speak English, but I work in a global company with a lot of people for whom English is a second language (their first languages vary). Everyone I work with writes code and comments in English. Sometimes we have problems with spelling errors in the code or people not understanding what a word means, but even programmers with a very basic understanding of English get the hang of it pretty quickly.
In my experience, the vast majority of code owned by the company I work for is written in English, regardless of what country it was written in or what languages the programmers spoke. The few exceptions have been major headaches, because it's very difficult to find someone to maintain large amounts of legacy code written in Portuguese (for example).
posted by burnmp3s at 1:03 PM on April 9, 2008
In my experience, the vast majority of code owned by the company I work for is written in English, regardless of what country it was written in or what languages the programmers spoke. The few exceptions have been major headaches, because it's very difficult to find someone to maintain large amounts of legacy code written in Portuguese (for example).
posted by burnmp3s at 1:03 PM on April 9, 2008
If you speak it, and everybody who will read the code understands it, then code is in English. The language keywords are in English, and hence the code should be as well.
One of the worst programming jobs I had involved debugging, refactoring then eventually just rewriting from scratch a code base written in Norwegian. Nothing against Norwegians, but when comments are in a (norwegian) developers shorthand, variable names have no spaces to delimit words, and the automated translation tools suck, it's a nightmare and a half.
posted by cgg at 1:13 PM on April 9, 2008
One of the worst programming jobs I had involved debugging, refactoring then eventually just rewriting from scratch a code base written in Norwegian. Nothing against Norwegians, but when comments are in a (norwegian) developers shorthand, variable names have no spaces to delimit words, and the automated translation tools suck, it's a nightmare and a half.
posted by cgg at 1:13 PM on April 9, 2008
I'm the only native English speaker on my team and we code in English. I can't imagine if we had code in Russian, Ukarainian, Chinese, Spanish and Portugese.
posted by atomly at 1:21 PM on April 9, 2008
posted by atomly at 1:21 PM on April 9, 2008
Your ego's getting in the way. Code as if you didn't have one; write primarily for the user, secondly for the maintenance programmer, and never for yourself.
So write your comments in the language your maintenance programmers are expecting.
posted by Leon at 1:32 PM on April 9, 2008
So write your comments in the language your maintenance programmers are expecting.
posted by Leon at 1:32 PM on April 9, 2008
This is probably not a best-practice, but quite natural if you're bilingual.
It is neither a best practice nor is it natural for all bilinguals.
A quick review of your past comments on metafilter shows them to be 100% English. Why would comments in code be different than a mefi comment, obvious snarks aside?
posted by vacapinta at 1:46 PM on April 9, 2008
It is neither a best practice nor is it natural for all bilinguals.
A quick review of your past comments on metafilter shows them to be 100% English. Why would comments in code be different than a mefi comment, obvious snarks aside?
posted by vacapinta at 1:46 PM on April 9, 2008
I once tried to maintain an 18,000 line javascript library with all the comments and variables were in a backcountry dialect of romanian, which was apparently the original programmer's milk language.
Comment and use english as variable names; most people in IT understand English or have resources to translate/look up words well enough to be able to understand it. Let's put it this way: In business, it's a microsoft/java world with a little bit of linux... but pretty much every active business programming language today uses structures and rules inherited from C. So if you can read C, there's a good chance you can read most of the code that's being written right now. The same holds true for English.
posted by SpecialK at 1:50 PM on April 9, 2008
Comment and use english as variable names; most people in IT understand English or have resources to translate/look up words well enough to be able to understand it. Let's put it this way: In business, it's a microsoft/java world with a little bit of linux... but pretty much every active business programming language today uses structures and rules inherited from C. So if you can read C, there's a good chance you can read most of the code that's being written right now. The same holds true for English.
posted by SpecialK at 1:50 PM on April 9, 2008
And I blame any typos in the above post on the cold medicine I just took. Gah, you can tell I'm a 'merricun.
posted by SpecialK at 1:51 PM on April 9, 2008
posted by SpecialK at 1:51 PM on April 9, 2008
Response by poster: It's odd how people will interpret an abstract question as a request for advice or authorative statements of the "Code is in English!!!!" variety.
posted by signal at 1:54 PM on April 9, 2008
posted by signal at 1:54 PM on April 9, 2008
Work in the UK, semibilingual, comment in English, as do others in the company who do not have English as their first language.
Naming conventions aside, I sometimes find myself thinking in my first language about a piece of code or whatever, especially if it's something I've done in a past job in other places. Then old habits (variable/class names etc.) can surface easily without thinking, but I always translate back to English before committing the code for the sanity of others. I doubt other people would find Finnish swearwords in comments amusing, even if they could understand them...
Also, some concepts are easier to handle/understand in other languages than English. Even though I "think in English" during daily routines, some things just come naturally, esp. if it involves counting simple numbers with my fingers (no sniggering, please).
posted by phax at 2:37 PM on April 9, 2008
Naming conventions aside, I sometimes find myself thinking in my first language about a piece of code or whatever, especially if it's something I've done in a past job in other places. Then old habits (variable/class names etc.) can surface easily without thinking, but I always translate back to English before committing the code for the sanity of others. I doubt other people would find Finnish swearwords in comments amusing, even if they could understand them...
Also, some concepts are easier to handle/understand in other languages than English. Even though I "think in English" during daily routines, some things just come naturally, esp. if it involves counting simple numbers with my fingers (no sniggering, please).
posted by phax at 2:37 PM on April 9, 2008
I avoid all non-english in my code assiduously. Sometimes it's tempting, but it's bad business down the road. I've had to maintain fortran (77-no long names) code from someone who did half of their thinking in Russian, and that's a rough trip.
posted by a robot made out of meat at 2:38 PM on April 9, 2008
posted by a robot made out of meat at 2:38 PM on April 9, 2008
Keep this in mind: code is for people. The computer doesn't care what things are named or how the code is formatted.
If you want your code to be maintainable then that will dictate certain practices, one of which might well be a single language. If you code for a company then there should be guidelines (coding standards may be too strong a term) around this.
So, think about the next person to work on your code and imagine what will make his/her life easier. That concept alone will change a lot of how you write.
posted by trinity8-director at 2:50 PM on April 9, 2008
If you want your code to be maintainable then that will dictate certain practices, one of which might well be a single language. If you code for a company then there should be guidelines (coding standards may be too strong a term) around this.
So, think about the next person to work on your code and imagine what will make his/her life easier. That concept alone will change a lot of how you write.
posted by trinity8-director at 2:50 PM on April 9, 2008
Best answer: Maybe this will help (taken from old class notes on the topic of code switching).
There are four basic types of code-switches:
1. sequential unmarked code switch — this is done in a conventionalized exchange where there has been some outside force necessitating the change (ex. the code must be written in a new language now, to accommodate a reader who does not know the original code language). This is done to maintain the status quo and assure that all readers continue to understand.
2. unmarked code switch — very rare, but occurs in a conventionalized exchange where all readers are bilingual and the switching would be part of the standard. This switching symbolizes the dual identity of all.
3. marked code switch — this disturbs the status quo, and is done to re-negotiate power or re-negotiate the set of rights and obligations. Doing this draws attention to the speaker.
4. Exploratory code switch — done in an unconventionalized exchange, where there are no expected norms or you do not know which code is appropriate.
For your example, it sounds like you are asking your question because you are stuck in #4. Others may be reacting to this because they may assume you are doing #3, or they may fear that you will do #3. Ultimately, if you code-switch, and you attempt to do it in a #2 environment, since you have access to a dual identity, others who do not have the dual identity (bilingualism), will see that as a marked code choice. So, in the future, if you must code switch, try to do #1 type where it applies.
It sounds like others are telling you that the standard choice is English, so that makes it the code for the conventionalized exchange of (coincidentally) writing code. Personally, I would try to avoid code switching at all costs, and only do so when it would be a choice that would maintain the status quo, rather than disrupt it or exclude others.
posted by iamkimiam at 3:59 PM on April 9, 2008 [1 favorite]
There are four basic types of code-switches:
1. sequential unmarked code switch — this is done in a conventionalized exchange where there has been some outside force necessitating the change (ex. the code must be written in a new language now, to accommodate a reader who does not know the original code language). This is done to maintain the status quo and assure that all readers continue to understand.
2. unmarked code switch — very rare, but occurs in a conventionalized exchange where all readers are bilingual and the switching would be part of the standard. This switching symbolizes the dual identity of all.
3. marked code switch — this disturbs the status quo, and is done to re-negotiate power or re-negotiate the set of rights and obligations. Doing this draws attention to the speaker.
4. Exploratory code switch — done in an unconventionalized exchange, where there are no expected norms or you do not know which code is appropriate.
For your example, it sounds like you are asking your question because you are stuck in #4. Others may be reacting to this because they may assume you are doing #3, or they may fear that you will do #3. Ultimately, if you code-switch, and you attempt to do it in a #2 environment, since you have access to a dual identity, others who do not have the dual identity (bilingualism), will see that as a marked code choice. So, in the future, if you must code switch, try to do #1 type where it applies.
It sounds like others are telling you that the standard choice is English, so that makes it the code for the conventionalized exchange of (coincidentally) writing code. Personally, I would try to avoid code switching at all costs, and only do so when it would be a choice that would maintain the status quo, rather than disrupt it or exclude others.
posted by iamkimiam at 3:59 PM on April 9, 2008 [1 favorite]
+1 for "code should be in English", but consider your usage.
First, it is very hard to learn programming without learning some English, mainly because language keywords are in English, and most common languages originated in the English-speaking world (C, C++, Java, Perl, and yes, Python -- Guido wrote the documentation in English, not Dutch). So English wins by default if there is a doubt.
But consider your usage and development model. Are you the sole developer (and can reasonably predict that no one else will ever, ever look at your code)? Then pick whatever you are most comfortable with, and be consistent. Is your code open-source, or are you considering open-sourcing it at some point in the future? Then, English. Are you developing code for a company or organization? Then, their rules override yours.
posted by the cake is a pie at 5:02 PM on April 9, 2008
First, it is very hard to learn programming without learning some English, mainly because language keywords are in English, and most common languages originated in the English-speaking world (C, C++, Java, Perl, and yes, Python -- Guido wrote the documentation in English, not Dutch). So English wins by default if there is a doubt.
But consider your usage and development model. Are you the sole developer (and can reasonably predict that no one else will ever, ever look at your code)? Then pick whatever you are most comfortable with, and be consistent. Is your code open-source, or are you considering open-sourcing it at some point in the future? Then, English. Are you developing code for a company or organization? Then, their rules override yours.
posted by the cake is a pie at 5:02 PM on April 9, 2008
This thread is closed to new comments.
posted by themel at 12:47 PM on April 9, 2008