4 ms·
Sinatra is what finally made me "get" web applications. A few years back I considered web programming a confusing, scary place, but figured it was my future. I
by lacampbell 9y ago
Sinatra is what finally made me "get" web applications. A few years back I considered web programming a confusing, scary place, but figured it was my future. I had tried out rails but I was overwhelmed with it all. I had done PHP at university and sort of understood it, but didn't like it. But Sinatra was such a nice abstraction over HTTP, and it came naturally to me.
We need more libraries like this. Straightforward, to the point, based around an effective abstraction. It lets you implement the other bells and whistles how you want - or lets you not implement them at all.
Really can't say enough good things about this library, but it's numerous clones probably speak for themselves.
- frou_dh 9y agoWriting a handful of #! scripts and serving them out of a CGI directory is another good way to "get" what a dynamic webapp and HTTP are about.
- lacampbell 9y agoBy the time webdev was even on my radar, the only things I "knew" about CGI was that it was old and bad. Or something.
- frou_dh 9y agoIt strikes me as Unix scripting writ large. * Each page of your site could be a script written in a different language if you wanted. * Environment variables (and optionally stdin) arrive to your script representing the request. * Your script writes the response (HTTP headers and page content) to stdout then exits. Security/perf pitfalls aside, I still think it's a nice model. It really emphasises the statelessness of HTTP since a pristine new process is booted up to handle each request.
- mperham 9y agoMy business is built on CGI scripts for processing automated webhooks. There's several non-trivial benefits: 1. Nothing running 24/7. No services to monitor, very light on memory. 2. Immune to memory leaks and bloat. Guaranteed fresh state on every request. It's not ideal for user-facing functionality but has proven extremely reliable and maint-free. My goal was to use something that would require no recurring maintenance, unlike all modern web tech. All that is running 24/7 is Apache.
- lacampbell 9y agoThat's pretty cool to hear actually. CGI or FastCGI?
- saghm 9y agoRight, but for an aspiring web programmer, it's a great learning exercise. By hiding all of the magic, it makes it much easier to understand what's actually going on and fully "get" web programming.