this just got discussed here:
https://groups.google.com/d/msg/anki-android/kTK5kLJ-U0o/Xk0Aa3h-dHEJ
would be great to have them separated - will have a look at it to see
how much work it is.
jan
In the libanki package of the libanki2.0 branch, I can still see some
Android-specific imports:
import android.content.ContentValues;
import android.database.Cursor;
import android.util.Log;
This will be a problem when running java-libanki based programs on
other platforms like Blackberry.
I can see three solutions, feel free to propose other:
Solution 1:
Design a system abstraction layer that provides services such as
logging and database and use it. Then implement that abstraction layer
for every platform.
UI → java-libanki → system abstraction → actual system's db+log+...
(a → b means that package a imports package b)
Solution 2:
Don't care for now, and just create an "Android emulation layer" for
future platforms, for instance a library implementing android.database
using Blackberry's database (which is also SQLite by the way)
UI → java-libanki → "Android"'s db+log+... → actual system's db+log+...
Solution 3:
Fork android-java-libanki to java-libanki (which would use
uncustomized latest stable versions of SQLite,etc) and
blackberry-java-libanki. Thanks to Git, maintenance of the forks
should not be hard for their respective maintainers.
Solution 1 is cleaner, but it is more initial work, more maintenance,
and it introduces a layer that will affect performance a little bit.
Solution 2 makes the code look awkward on other platforms.
Pragmatically, I would be voting for solution 3.
What do you think?
Cheers!
Nicolas Raoul
> In the libanki package of the libanki2.0 branch, I can still see some
> Android-specific imports:
> import android.content.ContentValues;
> import android.database.Cursor;
> import android.util.Log;
>
> This will be a problem when running java-libanki based programs on
> other platforms like Blackberry.
> I can see three solutions, feel free to propose other:
>
> Solution 1:
> Design a system abstraction layer that provides services such as
> logging and database and use it. Then implement that abstraction layer
> for every platform.
> UI → java-libanki → system abstraction → actual system's db+log+...
> (a → b means that package a imports package b)
More than half of the system abstraction would be database handling. –
There are a bunch of ORMs for Java, a bunch for Android, some both. Even
a not so portable ORM solution would be easy to replace with an adequate
ORM on the target system.
The resulting java-libanki would be easier to maintain or improve as well.
Anyone in?
Robert
I totally agree for the Javadoc.
"JS" is easily confused with JavaScript, which is also a language used
by Anki decks, so how about a more explicit "xxxJava", or even
"xxxJavaSpecific" if they are a minority?
Cheers!
Nicolas Raoul
> --
> You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
> To post to this group, send an email to anki-a...@googlegroups.com.
> To unsubscribe from this group, send email to anki-android...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/anki-android?hl=en-GB.
>
>
What would that be useful for?
I saw a lot of Python (lib)anki and am now hacking in Ankidroid and I
never missed that information... The opposite: it adds more
to-be-manually-maintained noise to the source. – I’m not going to
introduce variables named xyzJavaSpecific, nor will I encourage anyone
else to do so.
Maybe it is not even Java specific, but a new feature...
Robert
> What would that be useful for?
It makes it easier to port python-libanki enhancements to java-libanki.
The people who would be the best able to judge the usefulness of this
are Daniel, Edu, Norbert, since are of them has done a lot of
python-libanki→java-libanki porting.
Daniel, Edu, Norbert, do you have an opinion on this?
> Maybe it is not even Java specific, but a new feature...
AnkiDroid's new features are developed outside of the java-libanki
package, so they are not concerned with this discussion.
Your Panki branch is special because you are modifying libanki's
functionalities. So indeed you will probably establish a different
convention for methods that are specific to your branch.
Cheers!
Nicolas Raoul