Azure / azure-iot-sdk-java

A Java SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-java/
Other
200 stars 236 forks source link

Java code style convention #589

Closed IvanBoychevMarinov closed 3 years ago

IvanBoychevMarinov commented 5 years ago

Description of the issue:

Some of the Callback Interface methods are starting with Capital letters. For example the PropertyCallBack and the TwinPropertyCallBack. In addition they are lacking Javadoc and actually the TwinPropertyCallBack method is named with TwinPropertyCallBack wich looks like a constructor. All of these are bad practices in the Java world and should be avoided. The problem is that these are public APIs and are breaking client code style.

Perhaps you should consider deprecating these and replacing them with newer versions following the Java standards.

Code sample exhibiting the issue:

public interface PropertyCallBack <Type1, Type2> { void PropertyCall(Type1 propertyKey, Type2 propertyValue, Object context); }

public interface TwinPropertyCallBack { void TwinPropertyCallBack(Property property, Object context); }

timtay-microsoft commented 5 years ago

We can add javadocs to these callbacks, sure. As for renaming them, unfortunately, we cannot break these APIs. Deprecating them and adding APIs with proper casing is an option, but that would likely create more confusion than good, so I am hesitant to do that.

IvanBoychevMarinov commented 5 years ago

Thanks! In general deprecating, providing replacements and in some later version removing these callbacks is the right thing to do, but after all it is your product, so it is up to you. I'm already used to my colleagues jokes and ranting like: "Oh, man why is your method starting with capital letter" :smile:

Anyways, it is not a big deal, but I try to strive for perfection and such small inconveniences are really driving me crazy.

timtay-microsoft commented 3 years ago

Closing this issue as we don't plan on deprecating and replacing these APIs with better capitalization, but we have since added some Javadocs to clarify these interfaces/callbacks