Live data from Hacker News

Program your next server in Go

talks.golang.org

171–180 of 384 posts

Re: Program your next server in Go

#171

Earlier quoted context omitted.

What is "ninja coding"? Sounds stupid.

I think it refers to the Perl-era idea that good code should be somehow "clever" rather than maintainable. It's how bad programmers who spend hours agonizing over how to reduce their line count (presumably to save disk space?) justify their behavior.

Personally, I think "cowboy coding" is the best derogatory name for this. IMO, what all of these ninjas have in common is that they don't realize that software development is a team exercise. Berkeley did a study on BSD and found that a file was opened 10x more often for reading that writing (i.e. people read code 10 times for every time they make a change). To my mind, "cowboy" conveys the proper amount of ignorance of the other people on your "team."

Re: Program your next server in Go

#173

I like slide 41 [0]. What just happened? In just a few simple transformations we used Go's concurrency primitives to convert a - slow - sequential - failure-sensitive program into one that is - fast - concurrent - replicated - robust. No locks. No condition variables. No futures. No callbacks. It's the ability to make these kind of transformations effortlessly at any level, whenever I need to, that make me appreciate…

>No locks.

I'm sure the author means there's no explicit locking done by the programmer, but readers should be aware that channels are actually implemented internally using locks (which are 4x slower than using a sync.Mutex yourself).

Re: Program your next server in Go

#174
post #151

Earlier quoted context omitted.

You are scared of Erlang because it has uglyish syntax. Only reason I can think of. The "need to do computation" argument is silly. Just call into a C lib from Erlang.

I think you're replying to the wrong person - they just asked a question about when Erlang might be a good fit. > Just call into a C lib from Erlang. That's easier said than done. Certainly possible, but it's not quite as easy as just linking and calling.

I've found dropping down to C to be a pain to set up the first time in any language (Ruby, Tcl, etc...) but once you have the tooling, it's just another workflow. When you think about it, even JavaScript takes a lot of setting up these days (preprocessors, linters, endless debates about why coffeescript is still a good language (hint: it's the existential operator)). But, you amortize the cost of this setup over the lifetime of the project so they are actually quite small.

But, it does seem that there are not regular blog posts about how to drop into C to make even the worst scripting language performant. Seems like maybe it's a dying art???

Re: Program your next server in Go

#175

Earlier quoted context omitted.

Parent's claim: Of course, but not all tools are equal. In programming languages, languages that have a static type system have an insurmountable advantage of dynamically typed ones. Your response: javascript and python would disagree with you. My question: How so? Since the claim is about the advantages of static type systems, I'll respond on that claim alone. The primary advantage of static type systems, particular…

"insurmountable advantage" - I don't think so. the simplicity that javascript and python provides is an enormous advantage to many kinds of projects.

It's not simple when you have to maintain it or debug it.

There are many classes of errors that can occur when writing software. Languages with implicit variable creation like python obscure errors like mistyping the name of a new variable (versus an explicit declaration like in C or an ML where the mistyped name will result in an error immediately modulo name conflicts). It looks correct at a glance, but:

  def foo(a_name, b_name):
    # computations
    a_nam = #some more computations
    # computations using a_name, not a_nam, returns
    # erroneous values
(NB: The above is bad practice anyways, an advantage of the single static assignment of the dynamically typed erlang.)

Oops, we forgot an 'e' at some point. Now we have a new variable, but we used the old variable name for future computations and returned a result based on that.

Type errors, I've already discussed.

Logic errors like:

  if(a 
Are universal to all languages, they can't eliminate these. Actually, this leads to a major gripe I have with C. The duplication of meaning for = as both initial value assignment and later reassignment paired with the use of non-zero values to indicate true.

  if (a = b) // well, shit. a has a wrong value, and we go
             // down the wrong branch now depending on the
             // value of b.
Good practices only get us so far. Moving those good practices (static typing paired with type inference for simplicity, single static assignment or immutability by default, etc.) into the language does add mental overhead to programming. But it also produces less errorful final products.

As a guy who writes software that can literally save or kill someone depending on how well or not it functions, I'm in favor of better languages.

Re: Program your next server in Go

#176
post #146

Earlier quoted context omitted.

IMO switching an enterprise developer from language such as Java to Go is like asking someone who has very developed vocabulary in English to try Toki Pona[1]. Yes, it is simple, and you can learn it fast, you also can also communicate with it, but you will often have to fight with the language to express what you want. That person generally won't be satisfied. Go's shortcomings wouldn't be so bad if in exchange, the…

Your opinion on this is couple of standard deviations away from popular one. Is there a specific example where a program written in golang lacked compared to other statically typed languages?

Well, it's small sample but I used things like InfluxDB, Consul, there were some command line tools (that I no longer remember) as well.

Re: Program your next server in Go

#177

I'm afraid HN has a serious problem with downvoters. Why -in heavens name- is the above a question that deserves downvoting? UPDATE: whoray - I got downvoted too. Gee man. Just not worth it. Buy and thanks for the fish.

We detached this subthread from https://news.ycombinator.com/item?id=11856539 and marked it off-topic.

Re: Program your next server in Go

#178
post #103
post #23

Earlier quoted context omitted.

You can also use left right keys to navigate. Just doesn't work with scroll wheel, if that is what you were expecting.

It doesn't work well being a user. Which is what i was expecting.

I don't know what your original comment was because it's been flagged. But, this slideshow did not work as I expected when I first opened the page. Honestly, if I have to think about how to get to the next slide, your software is worse than PowerPoint. Forgive me for being so harsh.

Re: Program your next server in Go

#179

Earlier quoted context omitted.

You would like to write an entire server without using a GC?

I would not like to write a server with GC. Source: I've written many servers in both C and Java and given the choice will never use a GC language again for a server. Holding out some hope for Rust..

There are definitely some pain points building a server in Rust, but I think on the whole the tradeoff is worth it, and will become moreso as the ecosystem matures.

Re: Program your next server in Go

#180

Earlier quoted context omitted.

This feeds into language supremacy mindset. There is no universal best language nor there will ever be the one. Right tool for the job is a better flexible mindset. If you are a master painter, you could paint something amazing with anything you have got. Same thing applies to programmers.

> If you are a master painter, you could paint something amazing with anything you have got. Same thing applies to programmers. That's a flawed analogy. Here is a better one: If you need to drill something, do you consider a screwdriver and an electric drill equally?

I don't agree with this analogy, because languages overlap a lot more. You could choose one of several different languages to build a web app (Python, JavaScript, Ruby, PHP, etc.).

Only particular tasks have languages that fit best. Many other tasks can be solved in multiple languages. In that case, the best tool for the job is the language you know best.

Post reply on HN