Jeremy Saenz
codegangsta.io · Personal blog · on HN since 2013
Jeremy Saenz, creator of the Go web framework Martini, writes about Go and why he moved from Ruby.
What HN saysHN commenters cite his post saying Martini is not idiomatic Go because of its reliance on reflection and dependency injection.
15HN people shared it
11linked it in comments
4stories submitted
346story points
10 years agolast shared
2013people per year2026
Most-shared posts
- 1Thoughts on Martini – Introducing Negroni12 people · 116 points · first shared 2014 · 25 comments on HN
- 2Why I switched from Ruby to Go2 people · 228 points · first shared 2013 · 129 comments on HN
- 3Announcing Martini: Classy Web Development in Go1 people · 2 points · first shared 2013 · 1 comments on HN
What HN people wrote when they linked it
kornish · 2015-11-10
Here's a great blog post by the author of Martini about why, after he had gained experience in Go, he came to realize that Martini isn't very idiomatic: https://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
tl;dr - Martini doesn't have a strict, type-safe API. Overuse of reflection leads to a small performance loss but a much larger, much more important cognitive tax.
Zikes · 2015-04-27
The original developer's thoughts on Martini: http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
Personally, I would like to highlight the part about Martini not being idiomatic. Being idiomatic in Go is a fairly big deal. It makes your code predictable and easier to read and maintain for other Go developers, and learning idiomatic practices can help a Go developer more easily pick up other Go frameworks and libraries.
That's really the only concern I would have about using Martini to "get started" with Go, as it would actually lead you down a wholly different direction from the rest of the community and may actually make learning Go more difficult for a new developer.
As an alternative, I would recommend the wonderful Go By Example: http://gobyexample.com/
Vendan · 2015-03-17
I tried to get the developer to fix my issue, or even consider it as an issue, but got no where.
I'll admit, I don't speak for the community as a whole, but about every go developer I've spoken to has the same feeling I do, and it's echoed all over the web. Macaron, the central framework, is inspired by, and rather heavily follows, the style of Martini. It's dependency injection and runtime reflection code style is considered highly unsafe. But don't take my word for it, maybe you'll listen to the author of Martini? http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/ Or the post it's in response to? https://stephensearles.com/three-reasons-you-should-not-use-martini/
_ttg · 2016-12-05
also related - https://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
Martini also relied heavily on DI and reflection for convenience and the author basically conceded that this was not idiomatic.
jb613 · 2016-04-08
You are predicting the future (of Go) based on the past (of Java).
Non-idiomatic Go (or as you call it "bizarre hacks disguised as cleverness") is frowned upon. One example that comes to mind is the Martini web framework[1], which, once pointed out, resulted in a rewrite[2].
[1] https://github.com/go-martini/martini
[2] https://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
zphds · 2015-10-19
You might also want to take a look at Negroni since it's supposed to be more idiomatic. There's a blog post about this by the author himself.
http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
elithrar · 2015-06-23
Refer here: http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
The "short" version is that Martini did a lot of 'magic' stuff with run-time reflection. This made it really easy to use for those coming from dynamic languages but also isolated it from the rest of the Go HTTP ecosystem (which rallies around the http.Handler interface). There were also some discussions about that being "slow", but it was still really fast relative to (e.g.) Python.
My opinion is that Martini took a pragmatic approach to getting things done. It was also a bit of a gotcha for newbies who jumped into it and then struggled to learn why things didn't work around the edges of its feature base.
minaandrawos · 2015-04-23
If you are set to learn Go. Martini -though powerful- is not the most idiomatic. Why not try the gorilla toolbox instead? http://www.gorillatoolkit.org/. The maker of Martini wrote an interesting post last year: http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
shocks · 2015-04-23
I was also surprised. Here is the relevant article:
http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
jacquesm · 2014-05-23
Martini is now succeeded by negroni, see: http://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
(negroni is another coctail...).
ngrilly · 2016-04-08
> humiliate people trying to use language in unconventional ways (Martini...)
The author of Martini, Jeremy Saenz, didn't feel humiliated:
https://codegangsta.io/blog/2014/05/19/my-thoughts-on-martini/
> lack of dynamic linking
You can build and link shared libraries since Go 1.5:
https://golang.org/doc/go1.5#link
> package management
The Go team is listening to the community about package management and is even willing to make changes:
https://docs.google.com/document/d/1Bz5-UB7g2uPBdOx-rw5t9MxJwkfpx90cqG…
I agree that Go is a conservative engineering project, which can explain some answers you read on Go mailing lists, but I think you mischaracterize the community.
I would add that I'm tired of people repeating that the Go core team is stubborn and doesn't listen to critics about the lack of generics, even though they have provided substantiated answer on this topic:
https://news.ycombinator.com/item?id=9622417
I'm wondering who is not listening to who?