Live data from Hacker News

Build Your Own Web Framework in Go

nicolasmerouze.com

1–10 of 37 posts

Re: Build Your Own Web Framework in Go

#3
Yes, do make your own framework. And don't leave any documentation either. Hell, invent your own language while you're at it.

It'll make the "should we throw this code out" discussion WAAAAY easier in five years.

Re: Build Your Own Web Framework in Go

#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 framework, but libraries are nice.

Note: My api is a simple json based rest service.

Re: Build Your Own Web Framework in Go

#5
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…

This dotGo talk[0] about dependencies is spot on. Composition makes you reap all the benefits.

[0]: https://www.youtube.com/watch?v=yi5A3cK1LNA&list=PLMW8Xq7bXr...

Re: Build Your Own Web Framework in Go

#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, that building such mini framworks is easy, and does not take much time - but the most important aspect is, that you don't need a huge framework that does all the things.

Re: Build Your Own Web Framework in Go

#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.

Re: Build Your Own Web Framework in Go

#9
post #3

Yes, do make your own framework. And don't leave any documentation either. Hell, invent your own language while you're at it. It'll make the "should we throw this code out" discussion WAAAAY easier in five years.

I wrote plenty of things nobody but me will ever use, and I'm happy I reinvented lots of wheels along the way. I learned, I had fun, and I still like the results. Not all programming has to take place in a corporate cog-style environment, and not all articles about programming have to justify themselves in that environment, or for sites with millions of visitors. If it's not good for your job, don't use it for your job, and let me do what I want in my free time. If I was a better programmer, I would insert a snarky question about who will program the frameworks of the future if nobody knows how to do anything from "scratch" anymore. I'm just glad we're not that stuck up about HTML and CSS: sure semantic clean things are nice, but nobody would honestly say "god no, don't EVER Write your own CSS, use Bootstrap and tweak the options! It's just too hard, too many things can go wrong." I can see that with crypto, but a "web framework"? Nah. It's more a hello world thing, nothing to freak out over.
Post reply on HN