This content has been marked as final. Show 2 replies
bocockli wrote:I'm going to ignore the meat of your question (sorry, there are others who probably have better insights there) and focus on this point, because I think it's important.
What is best practice here. Performance is important.
A best practice, when it comes to performance is: have clear, measurable goals.
If your only performance-related goal is "it has to be fast", then you never know when you're done. You can always optimize some more. But you almost never need to.
So you need to have a goal that can be verified. If your goal is "I need to be able to handle 100 update requests for Foo and 100 update requests for Bar and 100 read-only queries for Baz at the same time per second", then you have a definite goal and can check if you reached it (or how far away you are).
If you don't have such a goal, then you'll be optimizing until the end of time and still won't be "done".
bocockli wrote:Use code generation.
Because JSON data is well structured, I have been able to write a simple handler, all using reflection, to dynamically invoke the Data Access Object and CRUD methods. So one class replaces 8 DAO's and 4 CRUD methods = 32 methods - this will grow as the application grows.
Works brilliantly. It's also dynamic. I can add a new database table by simply subclassing a new DAO.
Question is, is this best practice? Is there a better way?