Skip to content

Instantly share code, notes, and snippets.

@scottmessinger
Created June 19, 2011 00:09
Show Gist options
  • Save scottmessinger/1033617 to your computer and use it in GitHub Desktop.
Save scottmessinger/1033617 to your computer and use it in GitHub Desktop.
Backbone.js todos vs knockout.js todos
We couldn’t find any files to show.
@scottmessinger
Copy link
Author

Hahaha!

@ibjhb
Copy link

ibjhb commented Feb 21, 2012

This is slightly misleading because of the data-binding requirement code in the https://github.com/ashish01/knockoutjs-todos/blob/master/knockout-todos.html file.

For example, all of the events for knockout.js are in the HTML. In backbone, they are listed in the JavaScript.

@scottmessinger
Copy link
Author

scottmessinger commented Feb 21, 2012 via email

@fguillen
Copy link

@ibjhb: indeed!

@asterite
Copy link

@ibjhb: it's still less than half the lines you need to write.

@JasonMore
Copy link

@ibjhb: I re-did the gist with the html and javascript, all comments removed. https://gist.github.com/2285747
backbone: 253 lines of code
knockout: 111 lines of code

@zpdDG4gta8XKpMCd
Copy link

I am the biggest fan of knockout, but you have to keep as many line-brakes in knockout example as you do in the backbone one, to be 100% fair.

@JasonMore
Copy link

In line brakes?

@zpdDG4gta8XKpMCd
Copy link

I mean that the knockout example code seems more dense linebreak-wise (empty lines) in comparison to the backbone.

@JasonMore
Copy link

Hmm.. Guess I'm not seeing that. I know in the gist I made I think I was pretty fair with line breaks, and removing all the comments: https://gist.github.com/2285747

@zpdDG4gta8XKpMCd
Copy link

all I was saying is that you will get quite different numbers if you 1. - remove all blank lines, 2. count what's left. Now you can see it here: https://gist.github.com/2589644 which is based on your revised example without comments (https://gist.github.com/2285747). See, now it's 189 vs 103. Not even twice as big.

@JasonMore
Copy link

Ah, perfect! I didn't think about stripping out the whitespace, thinking it was needed for readability of the comparison. Yours is definitely a better comparison.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment