3 ms·
Because when you use English, you can write many statements that reads nicely - which you should aim for. if user.hasFoo() and company.isBar() then baz.play(
by mseebach 17y ago
Because when you use English, you can write many statements that reads nicely - which you should aim for.
if user.hasFoo() and company.isBar() then baz.play( jazz )
In German:
if benutzer.hastFoo() and firma.istBar() then baz.spiel( jazz )
That's five language-switches in a single line. Much, much harder to read. (granted, only one if the language uses && and braces instead of and and then)
- foldr 17y agoDoes it really make it "much, much" harder to read? No proficient coder will be reading lines of code as English sentences, even if by some happy coincidence they happen to read that way. I don't think having a few keywords in a different language makes much difference. You might just as well say that the switch in languages makes the code easier to read, since it separates out keywords from variable names.
- mseebach 17y ago> Does it really make it "much, much" harder to read? Yes. Maybe not harder, but more strenuous. > No proficient coder will be reading lines of code as English sentences In that case, I'm not a proficient coder. Neither was the inventors of the IF..THEN..ELSE and WHILE .. DO .. and DO .. WHILE .. statements. Or the guys who made the convention to use hasXX/isXX for boolean getters. Or LINQ. > I don't think having a few keywords in a different language makes much difference. I do, and I've coded and maintained a lot of code in both camps. And, we're not aiming for "much difference", we're aiming for "easier". > You might just as well say that the switch in languages makes the code easier to read, since it separates out keywords from variable names. Well, I don't think any proficient coder has any problem with that. We have syntax (and syntax highlighting) for that purpose.
- foldr 17y ago>Yes. Maybe not harder, but more strenuous. So, what you actually mean to say here is "no"? Sorry, but I just don't see that having non-English identifiers makes it any harder (or more strenuous) to read. >In that case, I'm not a proficient coder. You certainly are not proficient if you attempt to read lines of code as English sentences because they happen to contain a few English words. >Well, I don't think any proficient coder has any problem with that. Nor will any proficient coder have a problem with a few English keywords.