Closed sbcgua closed 3 years ago
I think lets just try it out 😄
OK, will keep it till tomorrow and merge, unless no more comments. But I feel a strong desire to remove reader/writer IFs in future
I'm using ajson now in a few places and it's ok with separate interfaces. However, I find that I have to ask myself often if a lo_json is ref to read or write interface or ref to class - three possibilities. Sure, I can encode the type in the variable names. But I think it would be better to have it be part of the object (a property like the freezing). While a reader-only makes sense, you might have to read a writer-object too. I vote for combining but don't mind if it stays as is.
yeap ... ok ... so, currently there are tons of aliases allowing to call methods from object itself and from zif_ajson
...
let's merge then. I'm leaving the original IFs for a while. And I've put a warning into readme so that zif_ajson
is kind of recommended way. Let's see how it goes. Will have to change some code in our products as well :)))
Thanks for comments !
to #39
constants, types moved to zif_ajson. All methods aliased from there as well.
@larshp @mbtools What do you think about it ? Imho looks a bit messy ... is there benefits to keep reader/writer ?
Benefit 1: you can pass instance of ajson to a method, which is intended to use reader or writer only, thus it's params are defined.
Benefit 2: kind of very clear which methods are changing and which are reading only
Cons 1: it is convenient to use 1 interface, this is where development process will natively gravitate. It will probably be an "official recommendation" too, so ... will anyone use reader/writer at all ?
Cons 2: type definition. Makes sense to do it in one place ? zif_ajson. Then reader will depend on zif_ajson and zif_ajson on reader (via alieases) e.g. #41 @jrodriguez-rc
Any opinions ? :)
P.S. would I separate the interfaces if I designed the whole class initially (and not reader first, and the writer like it happened). I guess, not. Hmmm ...