[liblouis-liblouisxml] Re: Using liblouis within an Android app.

  • From: Dave Mielke <dave@xxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 5 Jan 2016 15:41:42 -0500

[quoted lines by Bert Frees on 2016/01/05 at 12:26 +0100]

I also see the advantage of having 1000 lines of code as opposed to
including the whole JNA library.

When we subtract out the 500 lines for enumerating the translation tables, and
the 100 lines that implement some tests, it's actually down to about 500 lines
of Java and about 100 lines of C. Then, we can even subtract out a bunch more
lines that are only needed on Android to unpack the table files from what
Android calls assets.

For liblouis-java I chose the convenience and maintainability over the size.
(I don't have much experience with JNI but as I remember it there was a lot of
boilerplate.)

This, I suppose, is a matter of opinion. My opinion, of course, was heavily
weighted by the fact that I do know JNI. The code that needs to be in
liblouis-java in order to build it on top of JNA looked, to me, to be a whole
lot more complicated and voluminous than the JNI would be. Now that it's done,
my opinion is even more so.

Making it thread safe I also like. This could also be done in liblouis-java if
needed.

Of course.

What I don't really understand is what you mean by "presenting a Java view
in Java", or rather: in what way your bindings are more Java-oriented than
my liblouis-java or Michael's jlouis.

I hadn't discovered jlouis. What I mean, though, is for the view to be fully
object-based with no traces of an underlying C implementation. I also like
objects that accept or present data in a way that Java programmers would
expect. Again, some of this comes down to being a matter of opinion.

In the end - rightly or wrongly - I myself am content with the result. The code
is small, the JNI is minimal and straight forward, the implementation is simple
and easy to udnerstand, etc.

With a bit of work, it could even be unAndroided, and, therefore, be usable by
all Java users. The one big problem to that end is figuring out how to localize
the string descriptions of the tables. Right now, these strings are defined as
Android string resources, which is how Android does localization. I'm thinking
about it, though, as I think the goal should be that this code be usable by all
Java users.

Will you make your code publicly available at some point so we can have a
look?

Absolutely! I just need to unbundle it (probbaly with git subtree) from the
project that I developed it for. It's even, therefore, already publicly
available as part of that project. But, to avoid any confusion, I'm going to
unbundle it (probably, for now, as DaveMielke/liblouis-android).

--
Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario | http://Mielke.cc/bible/
EMail: Dave@xxxxxxxxx | Canada K2A 1H7 | http://FamilyRadio.org/
For a description of the software, to download it and links to
project pages go to http://liblouis.org

Other related posts: