views:

193

answers:

8

I work with several developers in India and one of our biggest difficulties is their naming of variables. At first I was very frustrated and couldn't understand why they wouldn't just properly name things (was it laziness?) However, I realized that they probably aren't used to naming variables, becausee all of the code they read is in English, and the English words they read have little or no meaning to them. It seems obvious now, but it is impossible to name variables well if you cannot understand English adequately.

How would you work towards better naming practices with a foreign speaking team member?

Sorry if this is a little subjective, I have marked it community wiki.

Thanks!

+1  A: 

Find the one developer you're working with over there who knows some English and have them all run variable names by him?

Spencer Ruport
+1  A: 

Maybe have them name the variables descriptively in their native language and then use a translator to convert them to english? Might even be able to add markup and run a precompiler to do the auto translation? Just a thought.

Shane
+2  A: 

Most devs should have a reasonable understanding of technical english (after all, API's in most languages are written in english). Therefore, english seems a good choice. Variables won't typically have very difficult names e.g. xCounter, isXYZ, etc. And if they are difficult to be named, then I would take that as a sure sign that the the level of abstraction in which that variable is being declared on is not the right one.

One might propose to localize variable names. I found that really difficult, more nowadays when it's typical for the code to be taken by people located in other continents, companies acquired overseas, etc.

Something gotta give ☺

Ariel
+10  A: 

Change the requirements for members of your team -- they must have an adequate understanding of written English.

Edit: in response to Bill K's comment, it seems to me that the cost of dealing with poor communication problems isn't factored into the savings calculations. No, I've never worked with overseas developers, but I do work with 2 non-native English speakers and communication goes a little slower with them sometimes, even though they've both lived in the USA for 20 years.

Also, I wasn't expecting my answer to be the most useful. Just trying to make a point. If you wouldn't hire someone to work in your office, then why would you hire them to work for you from the other side of the globe? Even if you're going through an agency, you are indirectly hiring every developer that works on your code.

My experience has been that when it comes to development talent, being cheap can be quite costly.

Dennis Palmer
Generally that's something you don't have control over. I don't know if you've worked in the industry, but typically nobody beneath director level would volunteer to work with contractors from another country to save development dollars. Taken into consideration, your answer may be correct but is not useful.
Bill K
akf
@Dennis I totally agree, I wouldn't. In fact, I might quit if I was working for a company that wanted to commit it's future to a development team from another country because I would see it as a doomed company--but my point was that I've never seen a case where a developer truly had any choice in the matter. The company may try to make you think you have a choice in the matter, but no matter how hard you object and how much you show them that they are missing costs, they will do what they have decided to do.
Bill K
@Bill, OK, I wasn't thinking of this from the perspective of a developer who is being forced to work with the offshore team members and has no say in the matter. I know there are companies who are successfully working with foreign outsourcing, but they treat those team members the same as the internal team members for skill and communication requirements.
Dennis Palmer
+2  A: 

If everybody speaks the same language and you will not sell the code to another company then it is ok to write the code in their native language.

If each member speaks a different language the code should be in English. Try to make an dictionary of the most common words used in the application where everybody can check. Choose someone with more English skills to translate when is necessary.

And you can always refactor when some word looks wrong.

Daniel Moura
i like the dictionary idea
Shawn Simon
+5  A: 

You could make the 'variable naming' a topic for each code review. It would be a matter of fact agenda item that could be easy to discuss. You could use the discussion as a gauge as to whether they understand what they are trying to achieve.

akf
By far the only workable idea here. Code review and just change them--should be trivial in eclipse/netbeans. Typically you need to dedicate one developer for every 2-4 developers overseas if you want your project to be even somewhat successful anyway, so just add this on as one of the things you have to do. If management understood this principle they would be less apt to go running overseas for help!
Bill K
+2  A: 

I don't intend to be critical, but I have a real question... If they are not fluent enough in English to name variables, how are they fluent enough to understand an English-language-based business domain model, much less design and construct a software product that solves a real-world problem in that domain?

Charles Bretana
they dont do much design, its more implementation of custom software, bug fixes, etc. they follow a fairly rigid spec, but the maintenance of the code (aside from the mass block copying) can be a nightmare with variables named something completely unrelated to their task
Shawn Simon
+1  A: 

I am not sure about the specific problem i.e. variable names are not descriptive, or are they using variable names aren't in English, variable naming style is inconsistent etc. Either way, you can try to establish detailed coding standards and perhaps use code audits or reviews to enforce them. For example:

  • Using "temp" as the name of local variables is not allowed
  • Variables must be named so that the purpose of the variable is obvious
  • Always use a consistent style to name variables (e.g. Camel Case)

The key would be to publish these rules and enforce them for the entire organization.

Umsd
this is stuff weve tried. unfortunately making rules about what should be done can never help with the actual content of the variable names. they might stop using Hungarian casing, they might always use consistent casing, etc, but they will never use variable names like numberOfMissingPageTemplates - it will just be somthing like counter
Shawn Simon