Live data from Hacker News

3.5 Years, 500k Lines of Go

npf.io

181–190 of 249 posts

Re: 3.5 Years, 500k Lines of Go

#181
post #9

I'm looking forward to my first project with GO. It appears to offer a lot with minimal complexity. > Because Go has so little magic, I think this was easier than it would have been in other languages. You don’t have the magic that other languages have that can make seemingly simple lines of code have unexpected functionality. You never have to ask “how does this work?”, because it’s just plain old Go code. That lack…

> That lack of magic I have a really hard time understanding what people mean when they say magic. In every language I've ever worked in I spend a fair bit of time saying "how does this work". Go doesn't seem any different in that regard to me.

Take a look at a java codebase that uses:

  * Complex DI frameworks (Spring Bean*Processors, event listeners, XML config)
  * classpath scanning-based autowiring (See Spring @Component)
  * aspect weaving-based autowiring (See Spring @Configurable)
  * Code littered with annotations that invite aspect-based pointcuts
  * Complex ORMs like hibernate that are incredibly difficult to use properly
And you'll start to get an idea of how ridiculous things can be. Golang is making a huge mistake for not adding Generics. 99.9% of the complexity in a typical Java codebase has zero to do with generics and everything to do with the insane abuses of the JVM classloading system that the java community has subjected itself to, as well abuses of overly complex libraries like Spring and Hibernate.

If the Java community allowed itself to write simple golang-like code the majority of the time, there'd be much less defection to golang in my opinion.

Re: 3.5 Years, 500k Lines of Go

#182

    always always checking errors really makes for very few nil pointers being passed around
If your developers always always remember to write error checks, they probably also would have always always remembered to write NULL checks.

Re: 3.5 Years, 500k Lines of Go

#183
post #181

Earlier quoted context omitted.

> That lack of magic I have a really hard time understanding what people mean when they say magic. In every language I've ever worked in I spend a fair bit of time saying "how does this work". Go doesn't seem any different in that regard to me.

Take a look at a java codebase that uses: * Complex DI frameworks (Spring Bean*Processors, event listeners, XML config) * classpath scanning-based autowiring (See Spring @Component) * aspect weaving-based autowiring (See Spring @Configurable) * Code littered with annotations that invite aspect-based pointcuts * Complex ORMs like hibernate that are incredibly difficult to use properly And you'll start to get an idea o…

There is nothing language specific or magic about those things. You could (and you will see people) write those things in go as the language starts getting more adoption.

Go goes further and encourages code gen, so that will probably be the way you start seeing terrible frameworks being built.

In any case, "configuration as code" doesn't seem like a good definition of "magic" to me.

Re: 3.5 Years, 500k Lines of Go

#184
post #181

Earlier quoted context omitted.

Take a look at a java codebase that uses: * Complex DI frameworks (Spring Bean*Processors, event listeners, XML config) * classpath scanning-based autowiring (See Spring @Component) * aspect weaving-based autowiring (See Spring @Configurable) * Code littered with annotations that invite aspect-based pointcuts * Complex ORMs like hibernate that are incredibly difficult to use properly And you'll start to get an idea o…

There is nothing language specific or magic about those things. You could (and you will see people) write those things in go as the language starts getting more adoption. Go goes further and encourages code gen, so that will probably be the way you start seeing terrible frameworks being built. In any case, "configuration as code" doesn't seem like a good definition of "magic" to me.

My point exactly. The issue isn't java the language. The issue is the flexibility of the JVM runtime and how people are abusing it.

Also, if load-time aspect-weaving and classpath-scanning-based autodiscovery don't count as magic to you, then not much will. Code generation at least has the huge, huge, humongous advantage that you have code on disk that you can read and debug.

I also admire Racket's macro system for coming with IDE support for introspecting and debugging the code generated by macros. Macros are a much better design because they generally run at compile time and they generally only make local code transformations that are much easier to reason about, as opposed to the sweeping global changes a weaver will make.

Re: 3.5 Years, 500k Lines of Go

#185
post #173
post #79

Are generics really that big of a thing if you got structural typing? I mean, you don't have to implement all the interfaces explicitly, you just have to get your structure right and be done with it. Am I missing something?

I think generics would mostly be useful for container types, like putting methods on slices (like .map) without caring what's inside.

You might be interested in my side project: https://github.com/lukechampine/ply

IMO when people say they want generics in Go, they really just want a few functional-style methods and functions on slices (e.g. map, filter, reduce methods, and functions like sort, reverse, repeat). So I wrote a compile-to-Go language that allow you to write "Go code" that also has those things.

One of the things I've found, though, is that Go's first-class function syntax really harms the elegance of these sorts of constructions. For example, compare:

    // square a slice of ints in Go
    for x := range xs {
        x *= x
    }

    // square a slice of ints in Ply (morph == map)
    xs.morph(func(x int) int {
        return x*x
    })
When really, we want something like:

    xs.map(x => x*x)
I think it's possible to achieve the latter without having to write a new lexer/parser/typechecker from scratch, but for now I'm avoiding adding any new syntax.

Re: 3.5 Years, 500k Lines of Go

#186

Earlier quoted context omitted.

> Go gives you the tools to handle this, but you have to do it yourself. filepath.Join(), filepath.ToSlash() and filepath.FromSlash() are used for this. You're missing the point—it's unlikely that you need to do anything at all; the Windows APIs handle forward slash as a path separator just fine. And on that note, for any MS employees reading now and who write READMEs and other docs for projects with publicly release…

This is about what the Windows API reports when you ask it what the path is of a file. Sure, inputs work with slash. Comparing outputs, which was the example I gave, does not.

I take it you're referring to the part that VMG quoted. Thanks for providing context.

This doesn't change my response to oppositelock.

Re: 3.5 Years, 500k Lines of Go

#187

I'm 3.5 years into using Go exclusively as well, and this rings very true to me with regard to generics: > Interfaces are good enough 99% of the time. Generics would be really nice for generic data structures (heaps, trees, etc), but code generation is ok at that. Generics could allow for some nicer (and safer!) nil handling and error checking, but I think the benefits-vs-complexity are less clear than with generics…

> Any language features which increase cognitive overhead had better offer some extremely compelling benefits to outweigh an increased learning curve. This is a common misunderstanding that occurs (I think) because most people only know C++-, Java-, and C#-style generics, which can be conceptually complicated, because of the often tricky interactions with the type system (or, in the case of C++, the use for metaprogr…

It struck me the other day that when using Go codegen tools which generate packages based on a template, e.g. [0], the Go developer is doing manually what the OCaml compiler will do with functors at compile-time. The concepts are fundamentally the same...the effort just happens in different places.

[0]: https://github.com/cheekybits/genny

Re: 3.5 Years, 500k Lines of Go

#188

Earlier quoted context omitted.

Doesn't Graham in his Lisp book talk about how using macros properly leads to more readable and maintainable code, and that Lisp is great at producing that kind of code in general because you can mold it to closely fit the problem domain?

Well exactly, this is why languages like Lisp are so seductive and powerful - they let you write languages within the language. When you have a really flexible language like Lisp, it's tempting to produce a meta-language to describe your problem which is specific, terse, and powerful. However there's an interesting trade-off here. At first this seems like a wonderful solution, but if you ever work with a few other pe…

That same argument could be applied to functions (or procedures, if you prefer) as well as macros, and yet I don't believe anyone sane is arguing against functions/procedures. Bad code is bad code, just as bad metacode is bad metacode.

I don't believe that Lisp macros are particularly tricky for a professional-level programmer. Yes, students can use them improperly — but students can and will use anything improperly! One grows out of it eventually.

Re: 3.5 Years, 500k Lines of Go

#189
post #157
post #38

Earlier quoted context omitted.

I can't believe that I read a nice article about working on a massive project in Go over a couple of years - a meaningful experience that we could probably all learn from - and the top comment doesn't build on the content of the post at all, but is rather a thinly veiled accusation of "Go is a terrible language".

Over time, I've come to notice that once any online forum reaches a certain critical mass of programmers, nearly any mention of a specific programming language will devolve into a flamewar about that language. I find it frustrating, but I also suspect that it's been that case since approximately forever ago. One day I plan to don a flame retardant suit and wade into Usenet archives to see if programmers were as prone…

  ... if programmers were as prone to language
  flamewars 30+ years ago as they are now.

  I'm guessing the answer is probably yes. :)
Your guess is spot on. Not only languages (C vs Pascal, "why doesn't anyone use Ada?"), but probably best remembered for the vi vs emacs crusades. Though about 20+ years ago there were some pretty heated exchanges regarding OOP which seem to still smolder to this day (see HN history for evidence :-)).

There's a reason why Godwin's law[0] came about :-D

0 - https://en.wikipedia.org/wiki/Godwin%27s_law

Re: 3.5 Years, 500k Lines of Go

#190
post #103

Earlier quoted context omitted.

It's clear that if a powerful language was such a competitive advantage, languages like Haskell would rule the world - instead they're hardly used for business projects. Along comes Go and in 8 years people have built more production code with it than probably all the functional programming languages of the world combined. If that's not true yet, it will be soon the way the trend is going. And those languages have be…

I've got another heresy coming up: Outside of very specific fields, language doesn't matter . I was quite strongly attacked on another thread for implying that WhatsApp is just another CRUD app. The thing was that I wasn't bashing their dev team. They could have done a crazy amazing job, and it helped their company take off, but what was their secret sauce? The ability to have an (almost) free SMS/MMS app which worke…

The problem is that WhatsApp really isn't just another CRUD app and it's very unlikely that you could pull off an engineering feat of that scale with a different technology. It is the exact counterexample of what you say.
Post reply on HN