Live data from Hacker News

Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

gilesbowkett.blogspot.in

121–130 of 143 posts

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#122
post #50

Earlier quoted context omitted.

I have that exact alias. But it still adds 3 seconds to the startup time of any command run under it Maybe my laptop is underpowered, but three seconds to do essentially nothing is still a long time

I solved this by having isolated gemset for every project. This way I can use rake without fear of having multiple conflicting gem versions.

Bundler and rvm? "now you have two problems" :-)

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#123

Earlier quoted context omitted.

All the examples, github repos, books, and tutorials I'm seeing with my dive into node say exactly the opposite - the code becomes a mess of callbacks. It looks like enormous work goes into avoiding callbacks, similar to the amount of work that went into Rails in 2005 so that server-side folks could avoid writing JavaScript. I'd love to see this framework you wrote. Is it open-source? or is it something you're unable…

You have to think about async code differently than you think about synchronous code. In PHP you might write: $data = getData(); And people want to substitute the return for a callback in js. getData(function(data) { // Do something with data. }); That indeed does lead to callback mess. But when you are coding in js you rarely should use anonymous functions. I mostly just use them when I might want to perform recursi…

Wrapping things in objects doesn't seem to help me.

I'd still end up with this, thanks to callbacks.

    app.get('/documents', function(req, res) {
      Document.find().all(function(documents) {
        // 'documents' will contain all of the documents returned by the query
        res.send(documents.map(function(d) {
          // Return a useful representation of the object that res.send() can send as JSON
          return d.__doc;
        }));
      });
    });
Seems to me that what's missing is something that lets me write it in a more simple way. What I have here looks like an absolute nightmare of coupling. So if you have some suggestions you could point me to that show a little more detail, I'd be really grateful.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#124

Earlier quoted context omitted.

You have to think about async code differently than you think about synchronous code. In PHP you might write: $data = getData(); And people want to substitute the return for a callback in js. getData(function(data) { // Do something with data. }); That indeed does lead to callback mess. But when you are coding in js you rarely should use anonymous functions. I mostly just use them when I might want to perform recursi…

Wrapping things in objects doesn't seem to help me. I'd still end up with this, thanks to callbacks. app.get('/documents', function(req, res) { Document.find().all(function(documents) { // 'documents' will contain all of the documents returned by the query res.send(documents.map(function(d) { // Return a useful representation of the object that res.send() can send as JSON return d.__doc; })); }); }); Seems to me that…

I would create a DocumentRequest object that takes your req and res, then break apart your callbacks to separate functions on the DocumentRequest prototype. Then you would simply consume it with:

  app.get('/documents', new DocumentRequest);

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#125

Earlier quoted context omitted.

The problem is that there's no third option- something to manage dependencies that's not bundler. We all want and need dependency management, but bundler should not be the One True Solution.

Write your own? I'm sorry but if Bundler doesn't solve your problem (or introduces other problems) either try and fix those issues OR write your own dependency management lib.

The unfortunate reality about writing your own new Bundler is that you'll inevitably end up rewriting Bundler. Isolate is basically just a mini-Bundler with a different (arguably simpler) storage location, but the storage location is really not where the complaints about Bundler are coming from.

Rewriting things just to shed complexity or "bloat" will often just put you in a position where your library just can't do things it will need to do, and then you end up rewriting those things and adding back the complexity. It's the circle of life. Lack of SCM support in Isolate is a good example-- I'm pretty confident that Bundler's support of git is heavily used and taken for granted, but if you were to rewrite or use a simpler dependency manager, you're throwing this out.

This point feeds back into the larger issue of Rails vs. Node, I think. Rails ended up with all the complexity it has now because it was [mostly] necessary-- not all of it was, but much of it was. The idea that you're somehow liberating yourself by shedding complexity is often just the short-sighted pleasure of running faster test suites. And it's usually followed by a little bit of claustrophobia when you realize you can't do X, Y, or Z anymore. Wait until the claustrophobia kicks in, because it will. And the solution to this claustrophobia? More cowb-- complexity.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#126

This is garbage, why is it being voted up? Rails is not bloated it's modular and quite simple if you understand ruby and can read - look at the source. That said his to address his _complaints_: * Rspec / Testing is slow as it has to reinitialize a whole rails stack every time it runs - run it async smartass it's what you're preaching, use inotify or fsevent with watchr or guard. * Bundle exec for Gemfile changes? Th…

> * Rspec / Testing is slow as it has to reinitialize a whole rails stack every time it runs - run it async smartass it's what you're preaching, use inotify or fsevent with watchr or guard.

> * Bundle exec for Gemfile changes? This guy is inept.. async yet again with inotfiy / fsevent

I like Rails, but these two points right here are bullshit. Rspec and Bundler being ridiculously slow are valid problems with those projects. Papering over the problem is not solving it, and I'd rather be polite than state what I think of calling people idiots for not papering over the problem.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#127

Earlier quoted context omitted.

If you have callback hell in your code, it's not because the problem hasn't been solved, but simply that you didn't put the effort to npm install a simple library. I agree that it is a problem if neglected, but most people don't allow it to be a problem in the first place. It's like knocking on PHP because it could be used for templating and business logic on the same file. Just because you could, doesn't mean you ha…

Error handling isn't a problem if you understand MONADS

Could you give a brief code example how monads eliminates the problem of error handling? Do you mean to put try catch in the monad around every async step it takes in? Just the API for how this would even look would be great.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#128
post #111

Earlier quoted context omitted.

> Rails is not bloated it's modular and quite simple if you understand ruby and can read - look at the source. You've got to be kidding. The Routing has got to be the canonical example of bloated and confusing code. Is inotify/fsevent built into the "full stack" framework? No? "Hey guys, I wrote/found/whatever this code to solve a problem that another bit of code I chose to use caused for my development. Oh BTW you'r…

Confusing? you map resources to URL's it's confusing if you are inept. Inotify / fsevent and such aren't built into rails just as they aren't in _EVERY OTHER FRAMEWORK_ because it's complete voodoo to make side effects of editing a file default.

> you map resources to URL's it's confusing if you are inept.

Inept? Kids these days. Forking my code then calling me inept. It's precious is what it is.

But you're moving the goal-posts. You said read the source. Since you're clearly unfamiliar with it, here's a couple handy links to the Routing code I mentioned.

https://github.com/rails/rails/blob/master/actionpack/lib/ac...

https://github.com/rails/journey

> it's complete voodoo to make side effects of editing a file default

You seem to be under the impression Rails doesn't have any facilities to reload files after modification.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#129
post #93

Earlier quoted context omitted.

Having to learn the ins and out of bundler `bundle exec, update, --without :darwin`.. just to use a package handler. I had growl_notify installed, and now we've forced our team to be mac only because we got tired of dealing with linux issues. Ruby Debug is impossible to get working in 1.9.3. The maintainer of ruby-debug has gone AWOL so we're forced to deal with solutions like this http://blog.wyeworks.com/2011/11/1/…

> Ruby Debug is impossible to get working in 1.9.3. Ruby 1.9 ships with a debugger: require 'debug' Besides, I've often find Pry way more useful: https://github.com/pry/pry

Thanks for the heads up. I've searched far and wide to find any sort of docs for the built in debugger. ruby-debug was incredibly easy to use. require 'debug' sets a breakpoint, but I cant figure out any way to interact with it.

I use pry, however I've found it's very unreliable for stepping into shoulda tests, and often it errors out. I haven't been able to find stable alternatives to the most common ruby-debug commands 'l', 'e', 'n' and 'c'.

Re: Went Off The Rails: Why I'm Rebuilding Archaeopteryx In CoffeeScript

#130
post #126

This is garbage, why is it being voted up? Rails is not bloated it's modular and quite simple if you understand ruby and can read - look at the source. That said his to address his _complaints_: * Rspec / Testing is slow as it has to reinitialize a whole rails stack every time it runs - run it async smartass it's what you're preaching, use inotify or fsevent with watchr or guard. * Bundle exec for Gemfile changes? Th…

> * Rspec / Testing is slow as it has to reinitialize a whole rails stack every time it runs - run it async smartass it's what you're preaching, use inotify or fsevent with watchr or guard. > * Bundle exec for Gemfile changes? This guy is inept.. async yet again with inotfiy / fsevent I like Rails, but these two points right here are bullshit. Rspec and Bundler being ridiculously slow are valid problems with those pr…

You're not papering over anything, rspec is slow because it _has to_ initialize a whole rails stack if you want speed make it happen in the background - you don't stare at compiler output while compiling a large program do you? Again bundler isn't slow due to bundler being slow, it's slow due to IO.
Post reply on HN