Hacker News new | ask | show | jobs
by deepsun 1 day ago
I'd say a lot of verbosity comes from generalization -- when you want the code to be reusable and moddable (pluginable). No wonder two widely moddable games (Minecraft and Kerbal Space Program) are written in Java and C# respectively, makes it very easy to create mods. Once I tried to make a Go project at least build-time moddable and found myself creating a lot of java-esque Factories and Builders.

Whether that generalization is premature -- I don't know, just my observation on why.

2 comments

I don't agree with that though.

I've written plugin systems for stuff I've worked on, and it didn't require nearly the same level of verbosity. Granted, I usually have done this with sockets instead of directly using JVM and reflection. To each their own, but I like using sockets (usually ZeroMQ) for this stuff because then it's completely language independent.

Even if I granted that you needed to use all this factory and builder glue stuff, I don't agree with the typical Java developer's strategy of breaking things up across a million files, which Java at least greatly encourages.

> No wonder two widely moddable games (Minecraft and Kerbal Space Program) are written in Java and C# respectively, makes it very easy to create mods.

It's more that it's easy to write code that links directly into the game. Easy to do because you can decompile them and make changes easily without having source code. Sure, Minecraft was obfuscated for a long time, but people put a lot of effort into deobfuscation and obfuscation removes a lot less than native compilation.

(You also don't need an official modding API this way)