New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor instrumentation #328
Comments
What's your opinion about going from
to something like
? |
yeah, I was thinking along the terms:
where 's' is for selects, 'e' is for delete/update/insert. It is wairly easy to implement this, and people will be able to use AJ without instrumentation. The reason this is not done yet, is because even this is quite ugly. |
Great! I'm having new ideas about this, and we're still on the same page! I'm having this idea we can offer both options for our users: models without instrumentation (they must provide the class, as above), or models with instrumentation (they don't need to worry about the above, but need the extra step after compilation). So they can choose which one bothers them less! ;- ) I'm starting to write this with the suggestions: https://github.com/ericbn/activejdbc/wiki |
The instrumentation option is provided with an extra dependency users must add to their |
well, I wanted to implemnt this years ago, but did not for a reason. It will be hard to explain to peope about two parallel APIs and instrumentation process. Adding this feature will eliminate instrumentation and add new API. I'm not sold this is a good solution. In fact, I cannot say I like it at all. This was just an idea, and I brushed it off. Instead, Dynamic instrumentaiton was more promising. |
I can see that you added a lot to https://github.com/ericbn/activejdbc/wiki, but each will have to have a discussion. Not sure I understand the value. |
I was exercising on a fluent non-instrumented interface there. Well, I think it looks good somehow. Still needing improvement, lots of discussion, and being put to the test, of course! ;- ) Something about fluent interfaces that I feel is prone to errors, is having non-terminating methods. For example, I get your point about having two APIs. Indeed, that will make things more complex. |
Having |
Understand your reasoning, but... BUT. ActiveJDBC is a product. And as a product, it needs to evolve as such. This means that it needs to solve some 80% of common problems, and appeal to 95% developers. This is the only way to maintain a project that is small, easy to uderstand and use. Think of this as IPhone. It works, looks beatiful, but only does things one way. Appealing to every request by some guy who has a specialized problem is a sure way to drive this product the Hibernate way - it will do everything, but it will do nothing well. Fluent interfaces have their use, like any other feature (and have their disadvantages, see javalite/activeweb#186). I like them in some places, and would not use them "just because":) So, @vyemialyanchyk is a great developer, and I actually know him a bit, but so far he is the only person who requested #238.. Making sense? |
Hi, Is it possible to register a Table<->Class(Model) association at runtime? I see no reason for this to be impossible, but ... Haven't found documentation/API for this. Thanks |
@punkeel, this idea deserves attention. However, this means that someone(something) will need to look at code and generate a property file: besides, in order ot generate this file, this tool will potentially need a connection the DB. This means we are back to square one: "we need a post-processing tool". But we already have instrumentation:) So, the biggest problem we need to solve is to somehow know that we are runnign in the context of class Person, and nmot model when we execute:
However Java compiler compiles this code to:
That means that even with a property file, we will now solve this issue. I see no way out of instrumentation. |
Ok thanks, I understand why instrumentation is required then... |
@punkeel, not sure I understood your question. Do you mean something like calling |
guys, no amount of setting the table on a model is going to help.
you do not know that you are running inside a Person classs. This is because in Java static methods are not inherited. We fix this by using instrumentation - moving the actual byte code for a methods However, I really do not understand why instrumentation is such a big deal for people (http://stackoverflow.com/questions/27364354/activejdbc-instrumentation-unable-to-instrument-the-model-classes-which-are-in/27369214#27369214). This is a simple step, and should not be a big deal! |
It is a simple step, but it becomes harder when you have to load multiple Le lundi 15 décembre 2014, Igor Polevoy notifications@github.com a écrit :
Cordialement, PunKeel'. |
@punkeel why would you load jars? What plugins? |
@ipolevoy : Bukkit plugin, I have one including your javalite jar and would like others to have access to it. I do instrument the others, but their configurations are like not loaded ... But they are instrumented. |
@punkeel , sorry I have no idea what that means. Any ActiveJDBC project can be compiled, instrumented and packaged into a jar file. At that point, you can do whatever you want with it, as you would with any other library |
@ipolevoy when ActiveJDBC loads, it does also load the property file generated by instrumentation, isn't it ? The compiled model contains the right methods, the compiled .class using this model contains the right class name, so the static calls are made on the model, not on I quite don't see how this is possible, then :-) (and I can't do anything but hack the classloader for now) |
@ipolevoy, added two commits in my fork for you to review. First commit (f26b3a9) makes non-static methods independent of instrumentation. As in non-static context there is Second commit (17565df) eliminates the calls to |
@ipolevoy, the profiling of each commit stage, with its top entries, are transcribed below. These also help understanding another motivation for this refactoring. Each profiling session ran all our unit tests. Before first commit
After first commitNumber of calls to
After second commitNo
The calls to Before first commit
After first commit
After second commit
Looks like the JVM could optimize the calls in this scenario. Maybe the profiler missed some calls too... (too insignificant?!) |
@ericbn, this is super interesting. AJ was 2 times faster than Hibernate before. but has a bigger potential. I will review this close to end of this week tx |
@ericbn , not sure I'm following. Above you are referring to commits on your fork, but they are in master. Am I missing anything? |
@ericbn , I found two more commits on your fork. Look OK to me. I'm slightly confused by Git. I assume that you still have some code on your fork that has not been merged with master? I think it is OK to do so |
yeah, I think a more comprehensive profiling is needed. Back in 2010, I was dealing with performance optimization, and created some tests in ActiveJDBC and Hibernate to do exactly the same: store and retrieve a large number of data to/from MySQL. On the first run, ActiveJDBC turned out to be a dog, about 10 times slower than Hibernate. Code here: https://dl.dropboxusercontent.com/u/43668168/DBExamples.zip |
Hi @ipolevoy. What happened with the commits was I pushed these by mistake to the javalite/master and immediately reverted the changes then. What git does in these cases is it keeps the commits but removes them from the branch. I'll merge them again. ;- ) I'll also investigate the profiling and comparison with Hibernate. We can automate this in our CI env. What do you think? Are you aware that these new changes we are merging expose a new API (with protected visibility) that is a duplicate of the original API only with an added first parameter that is the model class? Do you think we should (1) keep it as it is, (2) hide it with instrumentation of the Model class, or (3) improve it? |
@ericbn , I think this deserves a more in-depth discussion on Skype. Let me know when you want to talk . |
Sure, @ipolevoy! Just came back from my vacations... |
@ericbn - no pressure :) |
this was completed some time ago |
It seems like there's no way out of it, if we want to keep static methods in Model class! ;- (
And moving those methods from the Model to another class, as non-static ones, would take all the fun out of AJ! :- )
The text was updated successfully, but these errors were encountered: