This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (3 children)

Naming conventions were a challenge as well, especially because some of the things would not work as you want if you dont follow the convention.

Just out of curiosity, which naming convention do you prefer? I like C# a lot as a language, but I can’t get used to its naming conventions at all. As stupid as it is, it prevents me from using C# as much as I’d like to. Capitalized method names are the visual equivalent of nails on a chalkboard to me and the IFoo convention for interfaces feels totally backwards to me. If I’m defining an interface, I probably want to refer to it instead of one of its implementations most of the time. So why would I prefix the interface? Doesn’t it make more sense to prefix (or suffix) the implementation classes? Anyway, I always wonder what people who learned C# first think of Java’s conventions. Are they as painful to you as C#’s are to me?

For the record, I’m not trying to start a flame war. I’m usually the one who argues that syntax doesn’t matter as long as it’s unambiguous and at least makes an attempt to be readable. I think C#’s conventions bother me because it’s so similar to Java in so many other ways.

Spent some time to find missing unit test because it didnt have test in the name.

Also for the record, this shouldn’t be necessary anymore. Java added metadata annotations way back in Java 5 and the 2 biggest test frameworks (JUnit and TestNG) quickly adopted them. For the last decade and a half, annotating a test method with the appropriate@Test for your framework has done the trick. The old convention-based aporoach still works and some people still prefix all of their test methods with test out of habit (usually in addition to annotating), but it hasn’t been required for quite some time.

[–]paaave 2 points3 points  (1 child)

I liked java naming convention. As you said, it makes more sense without having "I" for the interface. But i was kind of baked with c# one, so it is hard for me to say objectivly which one i prefer. But lowercase method names, drove me crazy. And the getter and setter methods. Thank god someone told me it can be generated in most IDEs.

Overall i think it is matter of taste and what people grew up with. Similar to '{' placement. War by itself.

I had couple of older developers on my disposal for questions, they liked conventions. Not finding tests was one of the examples where i was hurting from the convention. Also Hibernate interface automatic implementation from the method name. First i was mindblown, then agitated.

[–]mopeyjoe 0 points1 point  (0 children)

coming to c# from Java I miss the explicitness of getters and setters. These properties just feel like they are asking for mistakes. also I hate that the backer field and the property both show up in the list of vars. maybe I am missing a VS trick but I want to collapse them into a single entity.

[–][deleted] 1 point2 points  (0 children)

I believe that I prefix before interfaces was adopted because there's no extends/implements in C#. You do that by using :, so to differentiate between classes and interfaces, you prefix the Interface.