This may be a quite subjective question, but probably not. My application contains a bunch of different forms that are shown to the user at different times. Each form is a class of itself, usually a user clicks on a button, which makes a new launch.
I have a feature function that creates these buttons, you say it like this:
prefix buildButton ("button text", new selection adapter () { @ Override Public Zero Widget Selected (SelectionEvent e) {showForm (New Work Farm (Args ...)}}}});
I repeat this, and it is really cumbersome to make a selection adapter all the time.
Actually I need a button to know when clicked and what logic has been given to give the content, then I have created a function that I call instead :
buildButton ("button text", work forum. Square, args ...);
Where the Argix is an arbitrary list of objects that you can use to normalize the taskform in general.
It uses reflection to get constructor from class, logic list, and to make an example when it is needed I do not have to pass any argument to the constructor most of the time. The downside is obviously that if I'm crossing a bad set of logic, then compilation can not be detected at the time, so if it fails, a dialog is displayed at runtime but it Usually will not fail, and if this happens then it would be easy to debug.
I think it is very clean because I came from languages where the use of function and class literals is very common. But if you are a normal Java programmer, then you will be able to see this whims, or will not you be able to scan the XLION Auction Adapter?
Yes, it is usually frowned upon reflection, but in some cases it can be quite useful. I appreciate reading the code that can be digested quickly through small things without any liability.
Comments
Post a Comment