Should naming conventions be consistent or not across multiple programming languages in one project? [duplicate]

I saw this question on SO: here; the question is kind of old and not many viewed, so I want to ask it again.

I currently work on a project using C++, C# and Actionscript-3, the conventions of C++ and C# are similar, but AS3 is not.

For example, the function name conventions differ a lot, it’s common to use GetFoo() in C++ but getFoo() in AS3.

According to the SO question’s answer, it suggests that using different convention for different languages is more appropriate, which is also my opinion; I’d like to just accept it, but it’s kind of too brief; to persuade my team members, I’d like to look for more detailed pros and cons.

4

Coding standards should be specific to the particulars of each language and platform. An idiom that is considered essential in C++ might be superfluous for another language such as C#. For example, you might insist of always placing a constant in an ‘if’ expression on the left (5 = x) to reduce the chances of accidentally having a single equals accepted as good code by the C++ compiler. In C# this is not relevant because the expression must return a boolean and so you can never accidentally have a single equals.

Adding extra conventions just to make the languages consistent means each language will end up with meaningless rules that are not relevant and therefore will annoy the developers.

It is also important to use standards that are likely to be familiar to other programmers in the same community but not working at your company. New recruits should not be completely surprised by the coding standard because it is so different from everyone else in industry.

3

Please, use the standard conventions for each language (or somewhat very close to the standard).

  • More consistency in each piece of software itself (because it will have the conventions that really apply)
  • More ease for additional (external) fellow developers. They must not learn “inconsistent” styles.
  • Easier comparison/review/transfer of code out of / into examples in the “world outside”
  • No regrets later, see below

Here’s what I experienced:

I am currently working in a shop where they first did Java-only projects. Then, they started to do C#/.NET and applied the already-well-known Java styles/Naming conventions to those C#/.NET projects.

When I (and others) joined the team, after doing C# for years, I was really annoyed with how the code looked like and had a hard time to continue with the perceivedly awkward Java-style in the C#/.NET projects.

Later they figured, that having a “wrong” style is bad, and started to adopt the C#/.NET conventions in new C#/.NET projects. Now we have really mixed up styles – sometimes different within a platform, sometimes different in the projects. Hopefully, over time, we will write less Java-styled C# code, but in my perspective, it would have been better to never start out doing that at all.


Bottom line:

What you could do

  • Consistent brace rules (Opening one on new line / same line)
  • Consistent commenting rules (e.g. XML only)
  • Rules about code quality (length of methods, unit testing frequency etc..
  • Use a tool to help applying the above

What you really should keep per language / platform

  • Namespaces
  • Casing of identifiers
  • Naming styles for identifiers

5

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật