30 ms·
Go isn't a serious language for large systems. The language allows writing shitty code and the community has largely adopted that. Go fanatics will hate this, b
by destevil 3y ago
Go isn't a serious language for large systems. The language allows writing shitty code and the community has largely adopted that. Go fanatics will hate this, but you simply can't compare it with the ability to write and maintain in languages like Java.
- gjvc 3y agoI'll bite. Why can't you compare it? Is it the class/function on struct thing? Generics? Go-routines not threads? Rob Pike did say once that the GC is deliberately not tunable because a JVM knob-twiddler should not be a job title.
- za3faran 3y agoMany reasons including: * Poor modeling ability (lack of default interface methods, no records, pattern matching, exhaustiveness checks, etc.). * Error handling is error prone. * Generics are half baked. * No short hand syntax for passing functions as lambdas. * No annotations. * Implicit interfaces make it hard to navigate large code bases because it is very easy to accidentally implement another interface. There are better solutions for the problem they tried to address with structural interfaces. * No string templates. * The GC not being tunable does not obviate the use cases where it needs to be. Furthermore, Java's ZGC only has a couple of knobs anyway, while giving you the option to use a more tunable GC when your use case calls for it. golang's GC is only tuned for latency at the expense of throughput. * goroutines are half baked, see Java's virtual threads + structured concurrency for a more manageable approach. * Observability way superior on the JVM. * No proper enums. * No const/final variable declarations. * Visibility rule are crude. Only public or package private. * Probably more things I didn't think of at this time.
- gjvc 3y agodecent list, to be fair
- guntherhermann 3y agoCan you give an example of 'shitty code'? We've got murmurs of Go being adopted by some teams so if you have first hand experience it'd be really useful
- madeofpalk 3y agoSingle letter variables. A terrible pattern the go community picks up.
- favadi 3y agoSingle letter variables like `i`, `j`? How `index1`, `index2` is any better?
- cultavix 3y agoMy guess is that he means, he would prefer variables to be more descriptive. Easier to read and follow.
- leetrout 3y agoEh. Yes and no. I have not worked on a team that enforces that and I do agree with using them for short functions with 1 or 2 types. I do this in python as well with open(..) as f:
- lm28469 3y agoIs that really the best argument against Go lmao ?
- carb 3y agoI have never seen this done in enterprise Go code, and I don't think it's been strongly recommended since the mid 2010's? For small functions where you can see everything in a single page, this is fine. Though I think they should always be avoided except the most common cases (`i` for index) because keeping a codebase grep-able is a high priority. Using constant, verbose variable names can make tracing through a codebase much easier.
- jjgreen 3y ago
- maze-le 3y agoThis isn't a serious argument, you can write 'shitty code' in Java too. In fact, I've seen more 'shitty' Java than 'shitty' Go, since I've seen far more Java projects than Go projects. It's possible that Go makes it particularly easy, but I somehow doubt that.
- ReflectedImage 3y agoOOP languages like Java are not considered to be good.
- za3faran 3y agoConsidered by whom?
- AnimalMuppet 3y agoBy people who don't like OOP languages. It's an appeal to (pretend) authority by people who won't or can't make a real argument.
- dontlaugh 3y agoJava also has null and overall a weak type system. They're pretty close in that respect, actually.
- pjmlp 3y agoFrom the point of view from Go folks, we need a PhD for mastering Java's type system.
- dontlaugh 3y agoIt has slightly more expressive generics, but otherwise no more complex overall. And no more useful, except perhaps for typed errors. The biggest cause of bugs in Go I find is the weak type system. Nulls, untyped (and overly verbose) errors and the lack of sum types are a big problem.
- pjmlp 3y agoProper enumerations, sum types, pattern matching, exceptions, default interface implementations, dynamic loading, class loaders, annotations, compiler plugins,...
- dontlaugh 3y agoJava sum types and pattern matching are almost impossible to use in practice, sadly. Exceptions aren't a good thing, it's only good that they're typed. Go has exceptions too, they're just used rarely. The rest is not very interesting or particularly complex.