News for hackers. Stuff that matters.
Re:Matador: MVC for Node by geuis on Wednesday January 04, 2012 @05:43PM (#3426301)
@dustindiaz I'm curious about the usecase for Matador. Its mentioned in the docs that it uses Express. I use Express pretty heavily and it seems that most of the things made available via Matador is already available in Express. Why should I consider stacking Matador on top of a framework that already works pretty well?
Re:Matador: MVC for Node by dustindiaz on Wednesday January 04, 2012 @05:57PM (#3426379)
Great question. And fwiw, we love Express too! After building a number of Express applications myself, I quite often ran into organizational issues (such is the loosey goosey way of Sinatra). Matador takes more of a Rails approach to organizing your code; of course, without all the extra cruft that comes with Rails.

We still tack on Express requests and responses onto your controller instances.

Most of all, the router -> controller mapping with request filtering (middleware-like) is where Matador comes in most useful. We have other features we'd like to add, especially in the scaffolding layer, but figured we'd open source early and get developer feedback.

Thanks!

Re:Matador: MVC for Node by randall on Wednesday January 04, 2012 @06:06PM (#3426425)
TJ's goal (in my view) is to make a really unopinionated way for node to interact with the web in a modern way, standardizing things like routes, sessions, etc. Matador would provide some opinion on top of Express to standardize file locations, or do a Rails-like inference of inflection perhaps. (I haven't looked deeply).

I wrote my own version of this last year, and found that it was a really good learning experience, but I didn't think it was worth publishing publicly. However, there is definitely room for a scaffolded MVC prototyping framework on top of Express, imo.

Re:Matador: MVC for Node by tjholowaychuk on Thursday January 05, 2012 @12:56AM (#3427621)
yup that's certainly correct. Express is still intentionally much lower level so myself and everyone can just craft what they want without fighting some larger framework
Re:Matador: MVC for Node by wavephorm on Wednesday January 04, 2012 @05:00PM (#3426109)
Maybe it's just me, but I honestly have trouble taking anyone who uses mustache templates seriously because I automatically assume they've never worked on a large website.
Re:Matador: MVC for Node by dustindiaz on Wednesday January 04, 2012 @05:09PM (#3426144)
I'm the co-author of Matador. I worked on Twitter.com - which is a relatively sized website - and we used Mustache... so there's that.
Re:Matador: MVC for Node by wavephorm on Wednesday January 04, 2012 @06:01PM (#3426410)
Twitter has about 5 "pages" on their whole website. From a template perspective it's the MOST simple kind of website you can build. So, there's that.
Re:Matador: MVC for Node by dustindiaz on Wednesday January 04, 2012 @06:07PM (#3426427)
I was only counting the one page after logging in, which does everything. It's how web apps work.
Re:Matador: MVC for Node by chrisledet on Wednesday January 04, 2012 @05:39PM (#3426271)
From what I've read, Github uses Mustache also. Logic-less templates are nice. It keeps code out of the views.
Re:Matador: MVC for Node by wavephorm on Wednesday January 04, 2012 @06:03PM (#3426417)

  It keeps code out of the views.
...and put it in controllers, which is terrible for large-scale organization. I would hate to see what their back-end looks like.
Re:Matador: MVC for Node by chrisledet on Wednesday January 04, 2012 @06:09PM (#3426439)
With that said, you obviously know little about Mustache and how to use it thus not contributing anything meaningful.

I recommend you check out Chris Wanstrath's mustache library for Ruby: https://github.com/defunkt/mustache#readme

Re:Matador: MVC for Node by wavephorm on Wednesday January 04, 2012 @06:26PM (#3426485)
Yeah so instead of having a controller and a view, you have a controller and a separate formatter class which looks like this:

  module ViewHelpers
   def gravatar
    gravatar_id = Digest::MD5.hexdigest(self[:email].to_s.strip.downcase)
    gravatar_for_id(gravatar_id)
   end

   def gravatar_for_id(gid, size = 30)
    "#{gravatar_host}/avatar/#{gid}?s=#{size}"
   end

   def gravatar_host
    @ssl ? 'https://secure.gravatar.com' : 'http://www.gravatar.com'
   end
  end
I argue this will get extremely tiresome for large websites.
Re:Matador: MVC for Node by ryansking on Wednesday January 04, 2012 @07:15PM (#3426633)
Works pretty well for us (twitter.com).
Re:Matador: MVC for Node by brianjesse on Wednesday January 04, 2012 @11:37PM (#3427426)
I interviewed for a job @Twilio - they were using Handlebars, a Mustache variant. Also, here is my mini-chance to rant about that: I had 4 phone and 6 in-person interviews -- didn't get hired. Argh! How could anyone make it through that? Also - i'm a generalist, which seems to have kept me out of both Facebook and Twilio. /rant
Re:Matador: MVC for Node by lukifer on Wednesday January 04, 2012 @07:05PM (#3426610)
I'd be really interested to see how Mustache does in real world performance vs., say, PHP or Ruby templates. I'm also curious about using it to offload rendering to the browser, particularly when using Ajax or UI binding.

While Mustache sometimes seems like a solution in search of problem, I do like that it's completely logicless, and so forces all logic, even display logic, into the controller.

Re:Matador: MVC for Node by GarrickCheung on Wednesday January 04, 2012 @08:23PM (#3426846)
I work for GameSpot.com and we've used Mustache on it.