Hi Geert,
On 7/7/2015 10:58 AM, Geert Bevin wrote:
> I don't know of any technology that is on par with what I tried to
> do with RIFE, it's always imho overly complex, too layered, lots of
> boilerplate code and not enough centralization. The last JVM project I
> built with Spring MVC, which is low-level enough that it's still
> manageable, but I found it very tedious to work with.
>
> Bytecode manipulations are JDK dependent as the class structure
> evolves. I don't really know how to completely dissociate RIFE's classes
> from that.
Hmmmm... Assuming that bytecode manip is required, we could write some
developer documentation that might make it easier to migrate / update
for newer VMs.
Assuming there is a way around bytecode manip...
Byte code manipulation pros and cons:
Pros:
* Convenience: simply cast an object, and bytecode manip happens (not
totally sure about this)
* Speed; executes close (same as?) to a direct Java implementation.
* ?? Allows some things not otherwise possible (such as?)
Cons:
* Obscures relationships: IDEs don't know about the relationships the
manipulation introduces, so it is difficult to do a "Find all
references", "Open declaration", to discover how it works.
* Ties a build to particular JDK.
Q. Do the above "pros" cover the main reasons for using byte code
manipulation?
It seems to me that reflection could be used for form generation,
validation and persistence, though it might be slower. A factory which
accepts a bean, and returns a container object with the bean instance as
a property, and a corresponding metadata object as another property,
might get most of the way there. It would require a little more
de-referencing, but the relationships and execution would be easier to
understand in final code.
An explicit reflection/factory mechanism would also follow the existing
pattern where bytecode manip is optional -- it doesn't need to be
applied to all instances of a class. An example is that a list of
retrieved items from a database don't all need meta data instances on them.
For templates, you suggested an implementation that uses pure string
substitution instead of compiled classes. It would be slower, but
doesn't require runtime compilation. This might be a separate issue
depending on how compilation was implemented.
Not sure about continuations would work, since I don't understand them yet.
Newer VMs (Java 7?) have more explicit support for dynamic languages.
If RIFE features are considered as a kind of dynamic language, could
newer VMs make some things easier?
Based on your other e-mail, once "you" understand how the byte-code
manipulation works, it may not be difficult to just manage it that way.
It would still be nice to have a more "self-documenting" mechanism for
the casting / manipulation in normal usage.