Live data from Hacker News

Build Your Own Web Framework in Go

nicolasmerouze.com

11–20 of 37 posts

Re: Build Your Own Web Framework in Go

#11
The original source talks at length about why you shouldn't use the Martini web framework, and links to another post where Jeremy Saenz (Martini's author) more or less disavows his creation (http://blog.codegangsta.io/blog/2014/05/19/my-thoughts-on-ma...). That's an interesting read, I'm surprised that I missed it earlier this year.

I'm also surprised to read that Jeremy has written a more idiomatic successor framework... and named it "Negroni" (http://negroni.codegangsta.io). I don't know if I'm being too hyper-sensitive as a contemporary American, but is this just absolutely cringe-worthy to anyone else? I don't think I could evangelize this at work for that simple reason.

"Oh hey, go check out the 'Negro' framework! It's written by the guy who goes by 'Code Gangsta', and you can read about it on his blog in between YouTube clips of him rapping." (yes, seriously)

Re: Build Your Own Web Framework in Go

#12
post #6

A framework calls your code, a library is called by your code. In the long run, when you start a web application using packages like "net/http" and the gorilla toolkit, sooner or later it becomes framework-like, because you start to group your code together, you refactor it and make it easiliy extendable _for the app you are writing_. So, every app becomes a framework on it's own. And what I like about Go is the fact…

> A framework calls your code

That's not a bad thing. Delegation is a very useful composition pattern.

Re: Build Your Own Web Framework in Go

#13

The original source talks at length about why you shouldn't use the Martini web framework, and links to another post where Jeremy Saenz (Martini's author) more or less disavows his creation ( http://blog.codegangsta.io/blog/2014/05/19/my-thoughts-on-ma... ). That's an interesting read, I'm surprised that I missed it earlier this year. I'm also surprised to read that Jeremy has written a more idiomatic successor frame…

What is the sound of one face palming?

Re: Build Your Own Web Framework in Go

#15

The original source talks at length about why you shouldn't use the Martini web framework, and links to another post where Jeremy Saenz (Martini's author) more or less disavows his creation ( http://blog.codegangsta.io/blog/2014/05/19/my-thoughts-on-ma... ). That's an interesting read, I'm surprised that I missed it earlier this year. I'm also surprised to read that Jeremy has written a more idiomatic successor frame…

Maybe the author enjoys Italian cocktails. It certainly fits considering the 'Martini' name.

Re: Build Your Own Web Framework in Go

#16

And as expected there's no mention of interacting with a database. The lack of a decent orm is the only thing keeping me from using Go for some side projects.

My work is mostly spent in JVM and .NET world and I am not a big fan of Go's design, so I am already biased.

However I am the first voice against ORMs in any project I work on.

If you care about performance, nothing beats tuned prepared stated going through the wire and stored procedures for heavy duty work.

In a few projects we improved batch processing times by a few hours just by throwing the ORM into the garbage can.

Re: Build Your Own Web Framework in Go

#17
post #6

A framework calls your code, a library is called by your code. In the long run, when you start a web application using packages like "net/http" and the gorilla toolkit, sooner or later it becomes framework-like, because you start to group your code together, you refactor it and make it easiliy extendable _for the app you are writing_. So, every app becomes a framework on it's own. And what I like about Go is the fact…

> A framework calls your code That's not a bad thing. Delegation is a very useful composition pattern.

A colleague of mine has often said, "Regardless of whether you choose to use a framework or not, eventually you'll be regretting your decision."

Re: Build Your Own Web Framework in Go

#18
post #16

And as expected there's no mention of interacting with a database. The lack of a decent orm is the only thing keeping me from using Go for some side projects.

My work is mostly spent in JVM and .NET world and I am not a big fan of Go's design, so I am already biased. However I am the first voice against ORMs in any project I work on. If you care about performance, nothing beats tuned prepared stated going through the wire and stored procedures for heavy duty work. In a few projects we improved batch processing times by a few hours just by throwing the ORM into the garbage…

> If you care about performance, nothing beats tuned prepared stated going through the wire and stored procedures for heavy duty work.

for "heavy duty work",sure.Now write your own hydrators,again,again and again,and let's see how maintainable your code is.

Now the fact is ,it's impossible to write an ORM in Go,without throwing all type safety,just like Java pre-generics,you'd cast and down-cast to Ojbect.

Re: Build Your Own Web Framework in Go

#19
post #8
post #4

I kind of disagree with this article. With go its so easy to get started with http that most of the time you dont even need a framework. If you do, most good frameworks use the following function as a common basis: func(http.ResponseWriter, *http.Request) I started with barebones http, then used gorilla, and later started using negrioni. Any new library with uses this function helps me. So in the end: you dont need a…

I agree. Those learning path is best for a deep understanding of how go works in the inside.

I think most people that are using core net/http package utilities instead of a framework don't fall under the "deep understanding" category because of the ease and simplicity of said package.

Building a framework is useful for doing that, because you have to understand the routing mechanisms, the way statuses and headers are set within the net/http package, etc.

Re: Build Your Own Web Framework in Go

#20
post #16

And as expected there's no mention of interacting with a database. The lack of a decent orm is the only thing keeping me from using Go for some side projects.

My work is mostly spent in JVM and .NET world and I am not a big fan of Go's design, so I am already biased. However I am the first voice against ORMs in any project I work on. If you care about performance, nothing beats tuned prepared stated going through the wire and stored procedures for heavy duty work. In a few projects we improved batch processing times by a few hours just by throwing the ORM into the garbage…

ORM works great for basic CRUD stuff like typical web applications. You don't have to use it in every part of your application.
Post reply on HN