Java and something to do

August 2, 2021

It was more than 10 years ago when I coded something in Java. I even tried to find a Java job but I did not pass the interview. This does not mean I did not work with Java all this time. I did, but it was in my own way: I used Java libraries from Python. But recently I had a chance to look at Java code again and realized how miserable would be my life if my work was closely tied with this language.

What I (and I bet you, my reader) expect from a programing language nowadays? Expressiveness! It's same as oil colors. Acrylic colors is a simplified technology in comparison with oil colors, it's like Java vs C++. But acryl will never give you same expressiveness as pure oil, with absolutely same pygments. Oil vs acryl is like C++ vs Java. At last, programming is an art, isn't it? Of course, a true artist would be able to make a masterpiece using any tools but how many such masterpieces can you recall, my lonely reader? And, what I see looking at all those .equals in a well known project?

Equals calls in JAVA

I see only sorrow. A mature Java expert would argue that such a way of working with strings is the fundamentals every Java coder must know.

That's bad fundamentals. And shitty design.

Java, from the beginning, was not innovative. They simply collected all top technologies of those times, put a marketing flag "write once run anywhere" on top and pushed all this crap to masses.

I'm aware of COBOL. To me, the destiny of Java looks the same, and the only good thing in this situation is that Java coders will be paid well for a long time.

But what would you choose given that your lifetime is limited and earning all the money is an impossible task?

The answer is obvious to me.

However, diversity is a good thing and the fact of Java existence is not bad. Over the globe we speak in many languages and nobody is judged for that. If a person is willing to share a masterpiece expressed in particular language, our task is to find a way to use it. And the fact of use is very important. This means that work was not for nothing and the fact of use is the highest reward. Some donations are important as well to support the work.

As you could see, Java is not my favorite language. But I use some Java libraries from Python. And unlike dynamic and slow things such as JPype there's a blazingly fast hidden gem, JCC. Yes, it's a part of PyLucene, but it can be used to build wrappers for any Java library. Well, almost any.

It has some quirks. The most annoying one is that the namespace for Java classes is flat. In Lucene, class names are mainly different and for some very rare cases JCC provides --rename option.

However, some libraries may have more duplicate names, such as Apache POI. In past I used it in Python via JCC, for some time. And some libraries may have lots of duplicate class names, such as W3C CSS Validator. It really has a lot of same names in its hierarchical namespace:

org.w3c.css.properties.css
org.w3c.css.properties.css1
org.w3c.css.properties.css2
org.w3c.css.properties.css3
org.w3c.css.properties.svg
org.w3c.css.properties.mobile
etc.

My first thought was to simply amend renaming in JCC but it would look ugly. It would be better to resemble hierarchical namespace. And it has to be a fork of JCC, otherwise backward compatibility in PyLucene will be broken. Unless it would be an option which defines the type of namespace.

What all this is for?

Given that I write articles in pure HTML I need a validator to catch errors at early stages. Of course I could use their public service, but I reckon that's a bad idea. It would be better to use an embedded validator. Their validator can run as a standalone web server, but I don't want all that Jetty crap. Their validator can be run from command line but I don't want all the overhead with subprocesses. This is the area where Java sucks much, much more than CreateProcess from WinAPI. I need a library, this is why I tried JCC.

But this task looks time consuming to work on it in my leisure time. I have no donations. I have no time. So, maybe, later.

For now I'll use their service. They had to choose better language from the beginning, so let they suffer for a while. They can try blocking me, but they will have to block entire Tor network. And if they ever do that, you know who's in charge.