2017-07-26 18:36 GMT-03:00 Sven Van Caekenberghe <s...@stfx.eu>:
> Esteban,
>
> I had a quick look at the spec you mentioned.
>
> I am a bit puzzled though. Result can be anything, so how are you going to 
> map that to specific classes (and why) ?
> That would require serious prior knowledge and even then, not every situation 
> can be mapped easily to a class

Since I'm going to use it in the context of RPC calls, I can know
beforehand what kind of class is the result, so I want to leverage
that knowledge to avoid going through an intermediate Dictionary/map
to build the object.

> You speak about subclassing NeoJSONObject, which is cool, because it is so 
> flexible, but then why type it further ?
> If I were you, I would at least start the easy/lazy way.
> For example you could do
>   NeoJSONObject fromString: '...'
> And see how far you get. If things get slow, I would look for alternatives.

Yeap... I took your advice after making things unnecessarily complex...
after the first... and second attempt.
I tried to make a client too smart and early optimize for things I
haven't used before,
so I ended up making stuff convoluted (I'm specialist).

Long story short, I almost ended up where I started, which was a fork of
LtRpcJsonClient, with some minor fixes, using NeoJSON instead of the
JSON package for parsing/writing and using NeoJSONObject as mapClass,
named: NeoJSONRPCClient [1]

I'm using it to build a particular client that uses JSON-RPC, so most
of my specific needs were moved/implemented in my still unfinished
client subclass, if behavior becomes abstract enough, I can push it up
to the "general purpose" client.

I didn't skip the build of the map object, but for my domain specific
classes I pass the map to my specific instances, so each instance
holds a reference to the map object used to build it. I didn't feel
comfortable subclassing domain specific classes from Dictionary.

Regards!

Esteban A. Maringolo

[1] It's available at https://github.com/eMaringolo/NeoJSONRPC but I'm
still learning how to do Baselines and other stuff to work with this
pet-project I'm using to learn Iceberg. So the baseline doesn't
work... yet :|

Reply via email to