Generic GUI and CouchDB will be a good match.
Since Couch does not require scheme definition, it will be possible to develop generic class to support CRUD features.
class DAO<T> {
void save(T t);
void update(T t);
void delete(T t);
Iterable<T> query(String condition);
}
In particular, such application will be running on server side, we will not have constraint using mirror.
Actually I already created such library for DartExpenseServer mentioned in earlier post.
One of the issue was to support a mapping to/from Json object for the entity class.
In the application, this mapping methods were hand coded. But it is desireble to automate this step by a library.
Such Library should be easily implemented with mirror.
Showing posts with label DONE. Show all posts
Showing posts with label DONE. Show all posts
Saturday, September 28, 2013
CouchDB and generic DAO class
Restriction of Mirror in JS mode
I almost finished developing CRUD features for generic GUI library.
It just consists from Table and Form, and additional supporting components for Input.
Although there are more rooms for refinements, but it's working and written as I hoped.
The size of code is quite small, and is general enough.
For this type of library to be meaningful, it must be easily customized without touching the library itself.
In order to do so, it provides mechanism to inject features from outside.
Also it defines some basic patterns, like create, update to follow so that recursive operation would work properly.
But when I tried running it with javascript mode, I found out it does not run.
It looks like such mirror features are not yet supported in javascript mode.(there is a note on 5/2013).
Also there is an issue for the generated javascript code.
if we include dart:mirrors, the current code generates 7238 total methods!(impressive, I will never able to write such lines(methods) of javascript code)
Out of it, 5318 methods retained for use by dart:mirrors.
(But still my codes generated 2000 methods!)
So it seems not good idea to use dart:mirror for javascript mode.
One of the approach to overcome this restriction, and run generic GUI library application on browser is to avoid using mirror library itself.
This can be done if we generate an implementation class for some mirror like API from concrete classes which is used in a application.
And we can also use two versions of implementations, one is for Dartium mode using the mirror library, and the other is for javascript mode, the implementation classes are to be generated by a Dart application in Dartium mode.
It just consists from Table and Form, and additional supporting components for Input.
Although there are more rooms for refinements, but it's working and written as I hoped.
The size of code is quite small, and is general enough.
For this type of library to be meaningful, it must be easily customized without touching the library itself.
In order to do so, it provides mechanism to inject features from outside.
Also it defines some basic patterns, like create, update to follow so that recursive operation would work properly.
But when I tried running it with javascript mode, I found out it does not run.
It looks like such mirror features are not yet supported in javascript mode.(there is a note on 5/2013).
Also there is an issue for the generated javascript code.
if we include dart:mirrors, the current code generates 7238 total methods!(impressive, I will never able to write such lines(methods) of javascript code)
Out of it, 5318 methods retained for use by dart:mirrors.
(But still my codes generated 2000 methods!)
So it seems not good idea to use dart:mirror for javascript mode.
One of the approach to overcome this restriction, and run generic GUI library application on browser is to avoid using mirror library itself.
This can be done if we generate an implementation class for some mirror like API from concrete classes which is used in a application.
And we can also use two versions of implementations, one is for Dartium mode using the mirror library, and the other is for javascript mode, the implementation classes are to be generated by a Dart application in Dartium mode.
Subscribe to:
Posts (Atom)
