Why you shouldn’t code in Spanish

by Pablo Matamoros - 26 March 2008

TranslationYou might think I’ve gone crazy. Posting about not coding in Spanish in Codespanish.com!

I actually promote the translation of your software to Spanish and other languages. When I say that you shouldn’t code in Spanish I mean don’t use Spanish or any other language than English in your variable names, file names, function names, etc. Programming languages, scripting languages, OS commands, etc., are all based on the English language. So, why would you do any different with your code?

Take for example this PHP code from the post “Building a forum in PHP and Mysql”.


<?php
require(‘funciones.php’);
$id = $_GET["id"];
$citar = $_GET["citar"];
$row = array(“id” => $id);
if($citar==1)
{
require(‘configuracion.php’);
$sql = “SELECT titulo, mensaje, identificador AS id “;
$sql.= “FROM foro WHERE id=’$id'”;
$rs = mysql_query($sql, $con);
if(mysql_num_rows($rs)==1) $row = mysql_fetch_assoc($rs);
$row["titulo"] = “Re: “.$row["titulo"];
$row["mensaje"] = “[citar]“.$row["mensaje"].”[/citar]“;
if($row["id"]==0) $row["id"]=$id;
}
$template = implode(“”, file(‘formulario.html’));
include(‘header.html’);
mostrarTemplate($template, $row);
include(‘footer.html’);
?>

Some of the words might be familiar to English speakers as they have similar spelling in English, for example: configuracion is configuration, but what about mostrarTemplate? Even formulario (meaning form in Spanish) will give a headache to more than one programmer who doesn’t speak Spanish.

You have also to consider that many programmers are not even English speakers. They might speak languages that have no Latin roots at all, for them it is hard enough to interpret English functions like require, echo, etc. Can you imagine a Chinese developer trying to understand your code in Spanish? Writing your code in English is critical when you work on an open source project.

My view is that code should be written in English: variable names, function names, class names, data fields… When I mean code, I am also talking about databases. There are exceptions; objects named in English could be a problem if the final user has free access to generate reports, export data, etc.


It isn’t difficult to write your code in English. Use a Spanish/English (your_language/English) dictionary (I recommend www.wordreference.com). Don’t panic, it is not about writing like Shakespeare, grammar isn’t needed. For example, in the above code, mostrarTemplate could be easily changed to showTemplate.

Even if you are not intending to outsource, share or sell your code, having functions in Spanish mixed with native functions of a particular programming language is a bad practice that could lead to confusion and duplication of code. For example, somebody could write a function obtenerVariable (obtener means get) when there is already a function called getVariable included in the library of your programming language. If you had written your code in English and duplicated the function getVariable by mistake, it is very likely that the compiler or the code interpreter would warn you. This is unlikely to happen if you mix human languages in your code.

What about comments within the code? Although it might be challenging for most non English speakers, the reality is that most comments are normally made of one or two sentences. As I said before, it is not about writing perfect English. There are several tools that can help you to translate simple sentences. Freetranslation.com is my favourite one. Be aware that these tools are not 100% accurate, human translations haven’t been beaten yet. If you need to translate a manual, the content of your website or the messages shown to the user by your software, please hire a professional translator.

Don’t get me wrong, I am strong advocate of my mother tongue, Spanish, but I’m not a fool. In today’s world a foreign company could approach you to buy your product rights at any moment. For example, last year Google bought Panoramio, a company founded by Spanish born Eduardo Manchón. If your code is unintelligible for non Spanish speakers, it will be harder to outsource its maintenance (you are limited to Spanish programmers). This last point could be a discussion topic with international investors.

Like it or not, English is the technology and business Esperanto of modern times. You should be writing your code in English.

14 Comments on “Why you shouldn’t code in Spanish”

  1. TecnoSiervo Says:

    Lo primero, muy bueno el artículo, y lo segundo, que si hicieramos el codigo en español, muchos programadores que no fueran españoles se romperian la cabeza no? y en el codigo en inglés (el actual) yo también me rompo la cabeza para poder medio-entender el código en ingles…

  2. JohnPo Says:

    Interesante artículo pero antes de escribir sobre traducciones procura utilizar bien tú también las palabras traducidas del inglés: “library” significa “biblioteca” al igual que “command” significa “órden” y no comando……..los comandos son los del ejército. Por muy internacionalizados que estén estos términos TODOS sabemos que están mal dichos/traducidos y que su utilización es INCORRECTA.

    Un saludo.

  3. Pablo Matamoros Says:

    TecnoSiervo:

    “si hicieramos el codigo en español, muchos programadores que no fueran españoles se romperian la cabeza no?”

    Entiendo tu punto, y se que no es fácil para alguien que no sepa inglés. Todo depende de que pretendas hacer con tu código. Si estas 100% seguro que solamente programadores hispanos van a ver tu código, obviamente no te preocupes por escribir tu código en inglés.

    Pero te diría que hoy en día, en un 80% (número caprichoso, nada científico en esto) de los casos, tu código va a terminar en manos de cualquier programador del mundo. En mi experiencia, escribí código para sistemas usados únicamente en Argentina que terminaron en manos de gente de Canadá y Bélgica.

  4. Pablo Matamoros Says:

    JhonPo,

    Lo que dices es cierto a medias. Yo trato de escribir en un español “internacional” (si es que existe). En Argentina (donde estudié) la mayoría de los libros de informática son traducidos en Méjico o Argentina, con lo cual hay terminologías que pueden diferir de la traducción española.

    En particular, el término librería es correcto, al igual que biblioteca. Se pueden usar indistintamente según la REA. Fijate en estos links:
    http://es.wikipedia.org/wiki/Librer%C3%ADa
    http://es.wikipedia.org/wiki/Biblioteca_(programaci%C3%B3n)
    http://209.85.173.104/search?q=cache:kYorUjnZapAJ:es.wikipedia.org/wiki/Biblioteca_(programaci%C3%B3n)+libreria+de+programacion&hl=en&ct=clnk&cd=2

    En cuanto a comandos, deriva de la línea de comandos (comand line) de los sistemas operativos. Otro link para que leas:
    http://es.wikipedia.org/wiki/Comando_%28inform%C3%A1tica%29

    Se que las referencias son de Wikipedia, puede que no sean 100% correctas. De todos modos mi idea es crear un foro en el próximo mes, para discutir temas relacionados a la traducción de textos informáticos. Además, para quien quiera contactar programadores hispanos viviendo en otros países, etc.

  5. Pablo Matamoros Says:

    TecnoSiervo , JohnPo:

    Gracias por sus comentarios constructivos.

  6. Pablo Rigazzi Says:

    Pablo, cómo estás?

    Como verás, soy el autor original del artículo “crear un Foro en PHP y MySql” que luego fue republicado en MaestroDelWeb gracias a mi amigo Christian Van Der Henst. Y tengo un muy buen motivo para haber elegido el castellano en la programación de este proyecto:

    “Es una aplicación para que la gente aprenda a programar”.

    Tan simple como eso. No pretendía que el código fuera lanzado como OpenSource, o que se hiciera un Fork, o que se volviera utilizado (algo que igualmente sucedió). Mi intención tan solo residía en que alguien pudiera leer el código, y hacer el mínimo esfuerzo para entender el funcionamiento.

    Luego, para cualquier tipo de proyecto, soy el principal y más ferviente promotor de la utilización de estándares y convenciones de programación, y entre una de ellas es la de escribir código en inglés (esto más que nada porque mis clientes son en su mayoría angloparlantes).

    Solo quería dejarte este comentario para que no malinterpretes mis intenciones: sigo creyendo que a la hora de escribir un tutorial o una aplicación que enseñe una metodología o que se de como ejemplo, utilizar el lenguaje principal del programador es fundamental para limitar la barrera de entrada.

    Saludos.

  7. Pablo Matamoros Says:

    #Pablo

    Gracias por tu comentario.

    Voy a modificar mi artículo para reflejar lo que me has dicho o cambiar el código por otro diferente (de mi autoría). La intención no era hacer un ataque personal a tú código o a tu persona, era simplemente porque estaba trabajando a la par en ambos textos y tenía tú código a mano.

    Respecto a reutilizar tu texto, pedí autorización a Christian y a Stephanie para republicar artículos de Maestros. Sinceramente no recuerdo porqué no te envié un correo a ti también, suelo hacerlo.

    Te pido mil disculpas si te he ofendido u ocasionado algún inconveniente

  8. paan Says:

    “Even formulario (meaning form in Spanish) will give a headache to more than one programmer who doesn’t speak Spanish.”

    Apparently reading comments in spanish also leaves me in the same state of headache-ness :D

  9. Pablo Matamoros Says:

    #paan

    You are right. Unfortunately at the moment it is not worthy for me to filter the comments depending on the language. I don’t have enough comments in my website :(

    However, it is definitely in my “to do list”

  10. fluminis Says:

    Interesting point.

    This is true not only for spanish developers of course.

    I am used to write code in full english even my comments in all of my projects. But I started a new job one month ago : variable name, class and comments have to be in french ! It’s a bit dificult to understand… and I am French !

  11. Felipe Sarro Says:

    This makes no sense at all. This idea must only come from a system developer, and not a linguist. The only reason why you should code in English (and not in the language of your own country) is if you work in a transnational company (or if you are writing open-source software), and your code is supposed to be read by several people from different countries.

    You won’t get any duplicated code if you pre-set patterns with your team. The problem with obtenerVariable and getVariable is not a matter of language itself, but a lack of patterns.

    The suggestion of using on-line dictionaries is simply stupid. Each language has its own subtleties that only a native speaker can deal with. On-line dictionaries make much more mistakes than exact translations. And what we get? A code full of imprecise terms. Will this imprecise code be easier to understand than the non-English precise version? Clearly not. In both cases you have words whose real meaning you don’t know.

    Another problem that happens frequently is that the “English level” of all developers differs from each other. As a result, we have a code written in English, with imprecise, bad pronounced terms, that may often be misunderstood. It has become a commonplace to say lots of unnecessary neologisms in English, only because one day someone had the stupid idea that saying the word in English is better than in Portuguese (as I’m a Brazilian developer, I code in Portuguese).
    Not to mention how ridiculous it is to say a complete sentence in Portuguese with few nouns in English (imagine you are doing pair programming…), only for a matter of… code.

    How long will people keep working for money and companies, instead of working for… people? Why sacrifice the well-being of the workers for the cool sake of business? English is not (and has never been) a kind of Esperanto. Esperanto is a much fairer language, if we intend it to be used by everyone in the world. No nation speaks Esperanto. It’s simple and has no idiomatic expressions. Esperanto should be the international language, but unfortunately it’s not. In fact, English will not remain much time as an international language. If one day the USA loose its place as ‘center of the world’, the international language will not be English anymore. Maybe Chinese, due to its economic potentials? Then our code written in imprecise English will be less valuable than that written in Spanish.

    I’m no linguist.
    But I’m against any kind of undervaluation of any true human interest. And this is clearly an undervaluation of one’s culture, and even one’s well-being at working.

  12. Pablo Matamoros Says:

    #Felipe

    I don’t think you got my point. I am not underrating my language or any other language. In fact, if you explore this website you will understand that my purpose is quite the opposite. I am actually promoting the work of Hispanic developers (Profiles section, tutorials, etc.) and my culture (the store section features Hispanic movies). However, it is a fact that English is a universal technical language. I don’t know for how long, but at the moment it is. After all, Latin was a universal language in the Roman times until the empire was dissolved.

    In regards to the use of online dictionaries, I am actually writing an article about when you should use them. In summary:

    – translations of single words are very accurate (in particular in Spanish).
    – translations of simple sentences have some mistakes.
    – translations of complex structures are awful.

    If you include very long descriptions of the logic of your programs inside the code, you
    are mistaken. Your project documentation is the place for a detailed description of the logic and data structure. The documentation can (must) be written in your native language (preferably by a technical writer). If it is necessary to translate to other languages, this task should be done by native speakers of those languages with technical background (I don’t trust on the translations of average professional translators).

    “The only reason why you should code in English (and not in the language of your own country) is if you work in a transnational company (or if you are writing open-source software), and your code is supposed to be read by several people from different countries.”

    Precisely, that is my point. Open Source applications are becoming more and more popular and Outsourcing is one of the biggest businesses. Most ICT Latinamerican companies are growing due to Outsourcing (mainly from the US).

    Now, if you are going to develop webapps for your local video store or a proprietary application for a local business and you don’t feel comfortable with English, go ahead and write your code in your native language.

    I am not a linguistic either. I am actually a software developer. What I wrote is based on personal experience.

  13. henk Says:

    I absolutely agree with the author. Coding in any other language than English is just plain stupid. Now you may cry that currently you only operate in Spain, but who knows what the future brings. Perhaps your business will boom tomorrow and you’ll expand to Italy.

    Also, don’t forget that at least Europe has a more or less completely open internal market for its workforce. As a Spanish company, you can hire Dutch, German or French programmers. Given the current scarcity of good programmers this sometimes may be your only option. How on earth are you going to let a Dutch programmer work with your Spanish source code?

    Next to that, thing about possibilities of selling your code. No German company is -ever- going to buy Spanish source code. Most likely not even a large Spanish company will buy your code, as most large companies (that operate internationally and/or have a multi-lingual workforce) have already established code conventions that say English is the default language.

    Furthermore, when asking questions on forums for which you have to copy paste fragments of your source, you constantly have to rename all your variables. No one is going to look into your code fragment if it uses Spanish variable names or comments (unless it’s a pure Spanish forum of course, but even then…)

  14. Felipe Sarro Says:

    IT IS a matter of depreciation native languages. It may not be your intention, but it is the consequence.

    instead of ‘seriar’ (in Portuguese), people are saying ‘seriALIZar’, due to the English word ‘serialize’
    instead of ‘iniciar’, people are saying ‘iniciALIZar’, due to ‘initialize’
    instead of ‘cifrar’, people are saying ‘criptografar’, due to ‘cryptography’
    instead of ‘devolver’, prople are saying ‘retornar’, due to ‘return’

    it’s difficult to find someone who says ‘servidor’ (Portuguese), instead of ‘server’, and ‘núcleo’ instead of ‘kernel’. And these people do not even pronounce correctly (most Brazilians have difficulties pronouncing SERVER and KERNEL).

    people make imprecise translations into English, pronounce them wrongly, and mixture them in a sentence in Portuguese, with unnecessary neologisms.

Leave a Reply