Live data from Hacker News

Why Tech Startups Should Look at Go

startupedmonton.tumblr.com

81–90 of 110 posts

Re: Why Tech Startups Should Look at Go

#81
post #56

Earlier quoted context omitted.

Java actually doesn't have generics. It has syntactic sugar for generics, but they are so horribly broken they can't be fixed. For example, because the generics are just sugar for casts, you can't specialize them. Because you can't specialize them, you have to put behavior in the "wrong place". Take for example a hash map from Double -> T. Because IEEE floats don't actually form an equivalence class (NaN != NaN), the…

It won't be longer true in Java 9, latest Java 10.

Overall that's great to hear, but I can't help but feel that it's too little too late. Once they fix the generics, are they going to go back and fix the secondary issues too (like the issue with Doubles)?

I know this isn't a popular opinion, but these correctness issues really matter. For example, you can see the impact these choices in the JVM and the standard library had on the Scala community, ultimately forcing Paul Phillips to fork the compiler.

Re: Why Tech Startups Should Look at Go

#82

It's not at all surprising that those startups solved their problems with Go: if you switch from a language that doesn't address your problems to one that does, you're going to see a big benefit. But there are lots of languages that address the problems mentioned by those startups, and I think that Go is possibly the worst of the options. It's telling that none of the startups in question switched out of a language w…

> Go would have a reasonable compile-time type system, except that without > generics you end up having to cast a lot, which renders your compile-time > type system almost irrelevant.

In my experience of Go, this is not actually true. For example, in the latest project I've been working on, there are 8487 lines of non-test code. In that code, there are a total of 16 dynamic casts, more than half of which are checked (mostly checking for particular error types). There are a total of 4 occurrences which might possibly be amenable to generics.

The type system is totally relevant, and checks 99.9% of our code.

Re: Why Tech Startups Should Look at Go

#83
post #43

AWS is cheap enough that "throw more hardware at the problem" is a viable option for most startups. So long as you're not being completely stupid with the way you've coded the first version, pretty much any language is going to work, and the cost of people who can code well in more esoteric languages that might be better suited to the problem domain are going to be increasingly expensive. Obviously there is a time to…

I don't think you've ever calculated just how much that cost is. Lets say that you have a web service that is serving 30,000 requests per second, with a 1 Kb request size and a 4 Kb response size and you're setting up an elastic load-balancer setup that on average keeps 300 c3.xlarge instances open. Do the math and you'll find that the cost on AWS, considering the instances used and the bandwidth, is over $80,000 per…

30,000 requests per second is 2,592,000,000 per day... That's quite a lot. Obviously we're not talking page views (because that'd be crazy successful and well beyond 'startup' territory), so we're presumably in the domain of data logging, analytics, social networking etc. Sure, AWS might not be appropriate for those. But then, the level of traffic you're talking about represents maybe 0.1% of startups. People doing "a CRUD app for a niche", which is most SaaS startups TBH, could run their software on 1 AWS medium instance for the first year or two quite happily.

Re: Why Tech Startups Should Look at Go

#84
post #43

AWS is cheap enough that "throw more hardware at the problem" is a viable option for most startups. So long as you're not being completely stupid with the way you've coded the first version, pretty much any language is going to work, and the cost of people who can code well in more esoteric languages that might be better suited to the problem domain are going to be increasingly expensive. Obviously there is a time to…

AWS is not cheap. It's a rather expensive way to rent hardware. It's only "cheap" if you are using some aspect of elastic computing to use 100 machines for a couple hours.

I've worked with several startups who are paying 6 figure a month AWS bills. At that point it's really not a bad idea to take all those python or ruby data processing jobs and convert them to go. I have seen costs reduced by an order of magnitude this way.

The key point here is that some startups need a pretty decent scale before they have a MVP. How many useful search results could google have provided if they weren't crawling most of the web from day 1? Some social media or analytics startups need to process twitter's firehose feed, even when they don't have many customers.

Re: Why Tech Startups Should Look at Go

#85

at the end of the day, on the first days of (most) startups you focus on showing results as fast as you can. Prototyping languages (Pyhon / Ruby etc) are the right choice. Nice stories about how iron.io reduced 30 ruby servers to 2 go servers became relevant only after they proven good market fit and working growth engine. So GO? maybe yes but probably only when the prototyping languages, can't carry weight.

I have found Go to be high level enough to make prototyping very straightforward.

Define "high level enough" python / ruby are much faster...

Re: Why Tech Startups Should Look at Go

#86

Earlier quoted context omitted.

I have found Go to be high level enough to make prototyping very straightforward.

Define "high level enough" python / ruby are much faster...

Exactly what I said. Just like Python/Ruby can be "fast enough" to do many things, Go is "high level enough" that I don't have to spend too much time thinking about the lower level details.

The few seconds of difference is small enough that it effectively does not matter.

For example, I don't have to worry about maps (dicts, hashes, etc); they're in place, but require one additional statement before they use them. I don't have to worry about array lengths; I can just use append(). I don't have to worry about finding a third party library to do network requests, it's part of the standard library (and doesn't require too many convolutions to use).

I do have to think a bit more about pointers when writing function signatures in Go than in Python or Ruby (not that those two languages really free me from that concern: some structures when modified in a function modify the underlying data from the callee as well).

Re: Why Tech Startups Should Look at Go

#87
post #19

Essentially all of the quoted usecases switched from a slow dynamically typed language to Go. Of course that's an improvement. But I still don't see why you would choose Go over Java (or Scala) for serious backend development. Java has more libraries, is faster, has generics (for the love of god), has better IDE support, and has a larger hiring pool. In summary, the ecosystem is more mature. Java's checked exceptions…

I find java's ecosystem to be it's biggest drawback. Yes, there are libraries and frameworks available for everything. The drawback is that every simple task, from building to testing to servers is wrapped in so many useless layers of indirection and configuration I just want to tear my eyes out. If you could throw out all the nonsense that has infected java and just build simple things from scratch on the jvm that would be awesome. But it's too late.

I find that creating go backend services is super easy and simple. The builtin web server is amazingly performant. I've found it super easy to integrate with other services (cassandra, postgres, mysql, mongo, nsq). The result is always high performance apps with a low memory footprint and high test coverage.

When it comes to type systems, I find go's handling of errors to be closer to rust than c. Basically multiple return values encapsulate the same information Rusts's Result does. You just deal with:

    if a, err := f(); err == nil {
        // do something with a
    } else {
        // do something with err
    }
 
rather than:

    match f() {
        Ok(a) => { // do something with a }
        Err(err) => { // do something with err }
    }
Rust certainly has the advantage in type safety, but I find the 2 forms mostly equivalent for the things I care about.

Re: Why Tech Startups Should Look at Go

#88
post #68

Earlier quoted context omitted.

Go's panic() acts similarly to what you're expecting out of Erlang. You still have to call it for other libraries. > so it's not possible to "forget" to check for a null reference like you do in Go The Go compiler will complain if you don't use the `err` variable after creating it, helping to make you remember to check it, and letting you branch accordingly. This doesn't help with someone who re-uses the err variable…

> Go's panic() acts similarly to what you're expecting out of Erlang. You still have to call it for other libraries. Go uses a shared heap. So even though one go-routine panics, you can't safely assume the state of your system is still predictable. If it is not predictable you can't necessarily safely restart that go-routine. Without Erlang/Elixir I would actually do it with OS processes / containers at a higher leve…

To be fair, if you're modifying the heap from a goroutine, you're "doing it wrong". Go provides channels, which work quite well at reducing the need to mutate the global state. I use such a pattern quite frequently (the http.Server), and have never had a problem with heap corruption due to a handler goroutine panicing.

Re: Why Tech Startups Should Look at Go

#89
post #68

Earlier quoted context omitted.

> Go's panic() acts similarly to what you're expecting out of Erlang. You still have to call it for other libraries. Go uses a shared heap. So even though one go-routine panics, you can't safely assume the state of your system is still predictable. If it is not predictable you can't necessarily safely restart that go-routine. Without Erlang/Elixir I would actually do it with OS processes / containers at a higher leve…

To be fair, if you're modifying the heap from a goroutine, you're "doing it wrong". Go provides channels, which work quite well at reducing the need to mutate the global state. I use such a pattern quite frequently (the http.Server), and have never had a problem with heap corruption due to a handler goroutine panicing.

That's true. To that extent C, C++, Java work took. The Threads + thread safe queues is a common paradigm I've used. The problem comes with using other libraries, sharing code with others in a large code base. But errors and concurrency bugs still happen.

But just like type systems, they are there not just to make code faster but add some guaranteed safety. The guaranteed is important. In case of concurrency, errors and state, the isolated heap also adds that guarantee. That is important.

Re: Why Tech Startups Should Look at Go

#90

I watched the Rob Pike Concurrency is Not Parallelism video ( http://vimeo.com/49718712 ) a few days ago and thought that "maybe I should be using Go instead of Python." Then I thought about all of the work that would have to be redone, all of the learning that I'd have to do, all of the retooling, all of the etc., just to get back to where I'm at now. If I were starting again Id probably start with Go, probably.

2/3rds of our devs working on juju hadn't written a line of Go before they were hired. Getting up to speed on Go is very far (like a week to get productive). Many of them have very Python heavy backgrounds. Just dive in, it's easy.
Post reply on HN