(2023-04-06) Why I have patched Pocket Gopher
---------------------------------------------
So, my ambitious plan to actually make an already wonderful client for J2ME
by Felix Plesoianu, Pocket Gopher, even more usable finally come true. 
Although I really didn't expect that many obstacles besides just rewriting 
some essential parts of code. But first, let me tell you why I did all this 
in the first place.

Where I live, second hand phone market is huge. J2ME is almost anywhere
besides the most basic models. And every MIDP2.0/CLDC1.1-enabled phone, 
despite how old it is, can be made a pretty usable Gopher terminal. I have 
already written about it here. But the problem with the original Pocket 
Gopher is, it doesn't use screen space too frugally. It inserts odd newlines 
where they shouldn't be, it uses whopping 5 bold characters for each 
directory item label (and for 20-character wide screen like on Samsung 
SM-B312E, 5 characters is a real waste), and on top of that, it uses too 
inefficient and unnatural model of pagination that requires users to make 
much more keystrokes than they really need to. No, I didn't radically change 
any controls here (although maybe someday I'll come up with something 
Kopher-like) but all the issues with newlines and pagination were addressed 
in my fork, as well as some optimization of the rendering part of the code 
had also been done.

Now, apart from "why", there always is "how". And that's a completely
different story. Working with J2ME in 2023 is incredibly hard, ESPECIALLY if 
you don't trust emulators (and rightly so). First of all, you need JDK as 
old as version 8, nothing newer will work. Second, you need a set of 
corresponding CLDC and MIDP libraries from somewhere, along with optional 
JSR APIs if you plan on using them (that's something I collected during my 
ReloadME effort in 2019). And then, you need to know how the build process 
is properly organized, because when I spent half a day figuring out what 
wasn't working on my Nokia 3310 3G while everything was working on the 
SM-B312E, and then realized it was the lack of _class preverification_ that 
caused all the troubles... And it turned out the only modern, cross-platform 
and open-source way of doing MIDlet class preverification was to use 
Proguard, which I ended up compiling with OpenJDK 8 and also including in my 
source tarball along with the required CLDC 1.1 and MIDP 2.0 jars. You can 
use this tarball as a reference starting point if you plan to write anything 
for J2ME these days by yourselves.

The greatest and also the weakest point of Pocket Gopher, as well as my
Pocket Gopher LX (by the way, LX stands for Luxferre's eXtensions and 
doesn't really mean anything), is that all rendering is done with StringItem 
elements and their derivative DirectoryItems (actually, in my LX version, I 
unified it to only use the custom DirectoryItem type). Hence all the visual 
focusing gimmicks and overall strange look on some phones. It's easy to 
implement, it takes less space and processing time, but it is bound to look 
_very_ different on different devices and sometimes uglier than Opera Mini. 
But then again, Gopher is not about visual appeal, it's about getting to the 
desired content as fast as possible. And this client, that weighs 12013 
bytes (the size of my current PGLX 1.0.1 version), really is fast and 
simple. This is why I don't regret any minute of effort already put into it, 
and will plan on using it myself whenever I happen to use a MIDP2-enabled 
phone in my daily life.

--- Luxferre ---