jackson-future-ideas icon indicating copy to clipboard operation
jackson-future-ideas copied to clipboard

[Jackson-3] Proposal for Renaming of properties for Naming Symmetry

Open JooHyukKim opened this issue 1 year ago • 2 comments

Proposal

I propose the following naming schema to provide a clear and consistent structure:

  • Writer suffix for serialization classes
  • Reader suffix for deserialization classes

Serialization Side

  • PropertyWriter remains the same
  • BeanPropertyWriter remains the same
  • AnyGetterWriter -> AnyGetterPropertyWriter

Deserialization Side

  • SettableBeanProperty -> PropertyReader
  • ObjectIdValueProperty -> ObjectIdValuePropertyReader
  • CreatorProperty -> CreatorPropertyReader
  • SettableAnyProperty -> AnySetterPropertyReader

Example Class Hierarchy

Current (AS-IS)

  • PropertyWriter -> BeanPropertyWriter -> AnyGetterWriter
  • SettableBeanProperty -> ObjectIdValueProperty / CreatorProperty -> SettableAnyProperty

Proposed (TO-BE)

  • PropertyWriter -> BeanPropertyWriter -> AnyGetterPropertyWriter
  • PropertyReader -> ObjectIdValuePropertyReader / CreatorPropertyReader -> AnySetterPropertyReader

Benefits

  • Improved consistency and symmetry in class names
  • Easier understanding of the codebase

Note

We will talk along the way the classes that are not mentioned here, yet.

JooHyukKim avatar Jul 20 '24 06:07 JooHyukKim

I like this idea. I think I'd like to get https://github.com/FasterXML/jackson-databind/pull/4396 merged before this, but we can proceed with renaming right after (technically it is not strictly necessary to order things this way but might be slightly less problem merging).

cowtowncoder avatar Jul 20 '24 22:07 cowtowncoder

I like this idea. I think I'd like to get FasterXML/jackson-databind#4396 merged before this, but we can proceed with renaming right afte

Sounds good to me ✅

JooHyukKim avatar Jul 21 '24 14:07 JooHyukKim

Figured bring up this issue again, since concrete works for 3.0 been rolling in. Updated hierarchy tree 👍🏼

JooHyukKim avatar Dec 01 '24 15:12 JooHyukKim

@JooHyukKim Could you extend description a bit to indicate specific renaming suggestion? I think you are suggesting changes to deserialization side, so SettableBeanProperty to... BeanPropertyReader? And leaving serialization side as-is, having Writer suffix (BeanPropertyWriter)? But want to make sure I understand specific suggestion(s).

cowtowncoder avatar Dec 01 '24 21:12 cowtowncoder

@cowtowncoder Sorry for the fuss, I don't think we need to pursue this now 🤔

Initially I thought it would be sort of low-haning fruit with huge consistency benefit. But the classes in scope do not form actually deserialization-serialization symmetry with one another.

JooHyukKim avatar Dec 02 '24 01:12 JooHyukKim

@JooHyukKim yeah I was wondering about that -- Reader/Writer symmetry has benefits, but in this case things are bit tangled so was not 100% sure how to easily improve things. Thanks for the update: it's perfectly fine to suggest/try things, even if just to find they don't work out in the end.

cowtowncoder avatar Dec 02 '24 02:12 cowtowncoder