I'm about halfway through this Java learn-by-doing project, and I must say I'm considerably underwhelmed with the language.
I'd already noted the lack of unsigned data types. It's also lacking in any sort of physical data-structure layouts.
Now, if I were creating a run-anywhere Language For The Ages, I'd include a provision for data structures with exactly specified physical layouts, and the ability to specify the endianness of each field (with the default also specifiable) as big-endian, little-endian, or local - with the runtime then knowing how to convert between big or little and local. This would allow run-anywhere programs to use data structures defined elsewhere... such as disk formats, network packet formats, and that sort of thing.
Now, today's annoyance is nothing so esoteric.
It's time to connect the little GUI program to a database backend. I have JDBC, and the PostgreSQL driver for same. I have in front of me the SQL definitions for the database.
The database definition is currently a 57-line SQL file, and about half of that is comments. There are five simple little tables, plus a sequence and some indices.
In many cases, it makes sense to convert the results of a query to an array of structures, for easy access. This calls for a struct definition for each table definition.
Except that Java doesn't have structs. It has classes. And you're only allowed one public class definition per source file.
So, if I want to use the sensible array-of-structures representation, I need five fargin' itty-bitty Java source files to define the structures. I can't just put the "data structures corresponding to this database" definitions in one simple organized source file where they belong.
Phooey.
Comments