dkunzler / esperandro

Easy SharedPreference Engine foR ANDROid
Other
180 stars 14 forks source link

Poll: Change method names to Java Bean Accessor Syntax #63

Closed dkunzler closed 4 years ago

dkunzler commented 5 years ago

After seeing the discussion in #62 I think about adding the required naming scheme as additional possibility or changing the syntax completely in a new release.

So this poll is about: a) add the possibility to use set and get additionally to the current method names where only the parameter determine the set/get operation. b) completely remove support for access via only method names and completely change it to set/get

Pros/Cons for the set/get naming scheme:

Apologize for tagging you people, but you are the only ones I know that use the library, so to get feedback I specifically ask: @danielneu @mflisar @dmo60 @rguthor2 @anthony3444 @naixx @asadkt Hopefully you are not mad about this :D

Thanks in Advance for feedback

MFlisar commented 5 years ago

Before I answer, did you ever think about moving this library on to kotlin? This may open up new possibilities and even some things can be done without annotation processing...

dkunzler commented 5 years ago

No, apart from the basic Syntax I'm not that familiar with advanced kotlin features. Do you have more insight on what of this lib can be done in kotlin without annotation processing?

MFlisar commented 5 years ago

You can check out this library: https://github.com/chibatching/Kotpref namely it's mostly kotlin delegates you can use to set/get values. For many use cases the linked library may be already a full kotlin alternative to your library - your library has some special features I use that make me still prefer your library.

If you move your library to kotlin and use fields for preference values, the getter/setter problem in java will be solved automatically as well as a simple side effect.

dmo60 commented 5 years ago

(-) extreme breaking API change

Supporting both the old and the getter/setter syntax would probably be the less intrusive change. But it comes with a slight cost of decreased ease of use (one more feature to explain, one more decision to take).

(-) understanding what the actual name of the preference will be is quite harder. (take the case into account: setProperty would still save into property not Property)

It's probably a bad idea to guess and hardcode the name of the property anyways. For the use-case where the actual key name is required, you could advertise the key-gen processor.

MFlisar commented 5 years ago

I'll give you my point of view:

To your points, I totally agree with them. And my personal decision in your situation would be to go the clean way and abandon the old method names and introduce the new ones.

Additionally, I would suggest respecting the new incremental annotations as well.

dkunzler commented 4 years ago

Thanks for all your feedback. I will make a new major version with changed naming in the future. Stay tuned. This also affect #62