Hacker News new | ask | show | jobs
by mbfg 1728 days ago
indeed. The simpler a string is to use, the more abused it will be. Programmers, forever, have used strings to represent other types, including really complicated types, with machinations of various appending formats; eg: PROJECT-33/3293, where code is built to pull apart the string to get values. This is awful. Strings are not type safe in the loose sense of the word. (Nothing is intrinsically mandating the format, so invariably you will find other code doing PROJECT-33-3293, or PROJECT/32/3293 or whatever.) This is especially seen as map keys, rather than just using a first class, class. An obviously especially bad form of this is, String key = storeId + partId;

as you can't differentiate between 12 + 3 and 1 + 23, but the compiler won't tell you this.

Finally, although not particularly important, all this string formatting parsing is far less efficient than just simple bean classes.

It is all done for the laziness of the writer.