Is golang good for real world web apps?

Hello. I am learing Go and again I found something that worries me. I would appreciate your comments about this question I found. Link

Is golang good for real world web apps?

No. Golang definitely has a place in web application infrastructure/architecture, but few companies are in a place to use it as the language to deliver an entire web application and even for them I don’t think it’s the right way to do it. I have seen attempts by small and medium size companies to use Go as an entire web application solution and they were disasters.

Golang’s strengths: concurrency, simplicity, robustness (up to a point).

Golang’s weakness: abstraction.

Golang’s sweet spot is web application tooling and infrastructure. Its combination of concurrency primitives and garbage collection work well in a space where C’s low-level access isn’t necessary and C’s requirement for explicit memory management is just an obstacle. There is a whole category of components that Golang can deliver well, safely and faster than could be done with C.

Web applications are not in the sweet spot. Unless the application is very simple.

Go is terrible at abstractions. Rob Pike hates abstractions. Go’s one gesture at abstraction, “interface”, is inherently unsafe. Compared to the abstraction capabilities of any other language in the web application space (and I include PHP in this) it is a joke.

You can write a good, modular, extensible replacement for Apache or Tomcat in Golang. I’d buy that.

Don’t start a business to write a better Facebook/Gmail/Twitter. I’d happily bet against you in the stock market. Even Google isn’t trying to rewrite Gmail the application in Go. But they’ll give it better components. And they’re big enough that if they wanted to rewrite Gmail entirely in Go, it just might work.

When it comes to web applications, choosing the right levels of abstraction - being able to properly separate different levels of abstraction - is important. Go just doesn’t do abstraction.

One example of a disaster I’ve seen where a smaller Web company chose Go as their single solution language. They wanted to write a better webforum application. All the features of existing web forums but more flexible, with customisable rules for subscriber interaction, sub-forums, administration and so on. They raised funding, they recruited. They chose Go.

By the time they ran out of money completely, they had a scalable datastore which could encapsulate the key domain objects. And a web interface that was significantly less useful than phpBB.

Now, which one of those two things represented their business’s intended value add? Which one was an implementation detail they could have bought in? I can tell you that the bit they needed most, te bit they didn’t achieve, is the bit that plays least to Go’s strengths.

Ok, that’s one example so it’s just anecdata. But really, do some research before you make the same mistake.

I think the opinion that interfaces for abstraction are “inherently unsafe” or that Go “doesn’t do” abstraction is misguided.

That said, I expect most web applications nowadays to be mostly client side Javascript and a backend API. Go seems vary suitable for the latter. Trying to do a complex web application as server side rendered pages seems maybe a little outside the sweet spot for Go, I’ll agree with that, although I don’t know that this has been proposed either?

1 Like

Jakob your post makes me think. Do you mean that a complex web application should be programmed in java for example rather than in Go?

an old expresion from martial arts says that no matter the style but the level :wink:

if you know well enough the Go language you will write good and complex applications. also, you will know if is good to use Go for your project and if not what language is proper for.

5 Likes

No, I don’t think I even hinted at such a thing. I see no advantage of Java over Go here (unless you need some “enterprise” framework or similar).

3 Likes

This.

Never base a judgement on a single anecdote. We do not learn from the text why this company failed at using Go for their project. Was Go in fact the wrong language? Or were the developers just not experienced enough (either with Go or with developing in general)? Were the programmers resistant to using Go because the chief programmer forced the team to use that language? Did the company fail do properly estimate the needed time and/or money?

There are so many possible reasons for the failure of this project. If the programming language is to blame, we need evidence for that.

The comment also contains other claims without explaining these. The author says, Web applications need abstractions and Go does not do abstractions. What does “abstraction” exactly mean in this context? Why does Go not “do” them?

IMHO, this Quora comment does not make any valid point against Go. Sure, the author may have seen Go projects fail. But for every failed Go project you can find another one that failed using Java/NodeJS/PHP/[insert any language].
The fact that a project using a particular programming language failed does not say anything until there is clear evidence that the project failed precisely because of programming language deficiencies.

7 Likes

Go is best language for writing WEB applications:

  1. Web server is integrated (no Tomcat, jetty, Apache, nginx, …)
  2. Compiled (easy deployment)
  3. Integrated server side template engine
  4. Excellent support for Json requests
1 Like

Christoph:

Nice comments but the author, Bruce, also says as follows:

Jakob:

Thanks for clarifying. Could you develope your comment a bit more please?

I have read articles or watched videos about choosing Go over node.js, python or ruby and suddenly this article from Bruce does not seem to fit.

Nice comments but the author, Bruce, also says as follows:

When it comes to web applications, choosing the right levels of abstraction - being able to properly separate different levels of abstraction - is important. Go just doesn’t do abstraction.

If Bruce had explained what kind of abstraction he was thinking of, then we would have a chance to verify if Go really cannot express these abstractions (and why).

2 Likes

To be honest I do not feel good reading these articles (Bruce). It does not help me to be motivated to learn Go.

If I had read this article the first day I probably would have started learning another different language.

So reading you all is quite important since you give a positive feedback about Go.

Thanks

I’m sure you can find any number of articles declaring any language you choose to be useless and/or actively harmful. People like ranting and it attracts attention and clicks. That does not mean it is useful, well informed or applies to you or your situation.

4 Likes

Even the person that wrote this is now using Go.

Don’t worry, be happy.

2 Likes

There’s nothing inherently unsafe about interfaces, they are deliberately limited compared to heavier abstractions like inheritance, but there are good reasons for that, and it has very little to do with writing a web app.

Re building a better FB/Gmail/Twitter in Go, when building a website or company like that, your choice of tech is far, far down the list of problems you will face, it’s just not a determining issue in the way this post pretends. Twitter for example started with Rails, which was fundamentally unsuited to the sort of messaging app they were trying to do, but it got them off the ground and let them get traction. The tech chosen is less important than we like to pretend, even when it is radically unsuited to a particular problem.

The example he gives sounds like they focussed more on backend technology and yak shaving (their own datastore) than sales/marketing, a classic mistake which many startups make, and which has nothing to do with the particular language they chose.

Having written a forum in Go, and a few other full stack web apps serving millions of users, I can offer a contradictory experience - it’s really well suited to writing web apps of any size, full stack apps that you might build with Java, Ruby or PHP, or backend services. The only problem it is not suited well to at the moment is writing desktop or mobile apps due to lack of integration with the available APIs, but people are working on that.

For web development, the templating language is perhaps a little limited for things like nested templates, but I can’t think of any other serious difficulties with writing a web app using Go, apart from the dearth of libraries a few years ago for common tasks like auth (there are now plenty of options). It’s suitable if you prefer to serve html from the app or use it as a backend and do the rendering in js.

I suggest you pick up something like gorilla or even just the std lib if you’re just starting out and unsure how easy web dev is in Go, and see how far you get with a simple idea (like a forum). It would certainly be possible to write a basic one in a weekend, but of course that’s not the challenge to creating such an app, the challenge is community and content.

3 Likes

Thank you all.

I have just seen this announcement.


1 Like

And this is how I feel now.

2 Likes

I can’t say anything about scalable webapps, but you can try writing a webapp by yourself before judging the language!

Reading the tutorial: http://github.com/thewhitetulip/web-dev-golang-anti-textbook/

Thanks you, I am on it Suraj

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.