Live data from Hacker News

Backbone has made me a better programmer

floatleft.com

81–88 of 88 posts

Re: Backbone has made me a better programmer

#81
post #67

Am I the only one who still makes websites with very little JS in them? One jQuery thing here and there. Using Backbone would be overkill and to be honest I can't think of one hypothetical project where I would need it.

A lot of JS tends to be required when you're building a big, dynamic web application, or your website needs lots of modules and lovely little widgets. If you can avoid writing a lot of JS, then that's great - but HTML / CSS alone can't provide the features that a lot of users are expecting.

Re: Backbone has made me a better programmer

#82
when I realized that in the end backbone is just javascript and suffers from the same inheritence problems due to its crappy prototype object model.

And you manually have to deal with event disposal when destroying views in backbone. just google backbone ghost views, I realized maybe it wasn't the best thing for the job after all.

edit: the top comment mentions mixins, good stuff https://github.com/jb55/bquery

but personally i can't wait until we get a proper replacement for javascript, like dart maybe.

Re: Backbone has made me a better programmer

#83
post #37

When we started using Backbone it was good for awhile until there was so much code duplication all over the place. We decided to build a small declarative API on top of backbone that allows us to easily compose views by mixing in common functionality. It looks something like this: AlbumsView = bQuery.view() .set("el", "#albums-view") .init((opts={})-> @readOnly = opts.readOnly or no @app = opts.app ) .use(Mixins.bq.i…

I'm so glad that this is the current top comment. Backbone apps are the most verbose and non-DRY apps in my experience. Tons of code duplication.

If you have code duplication/DRY problems, then Backbone is not your problem. You need to abstract common functionality and add mixins to Backbone.View.prototype.

In every backbone project that I have developed, the set of View mixins that I create are very specific to each project and the custom UI/UX I build. It would be a useless exercise to abstract all of my View mixins into some kind of opinionated framework, because I know my next project is going to look and behave differently.

That said, if you are working on a large project with some simple UIs/UXs and need some simple data binding, then you may want to check out an "ambitious" framework like ember.js. Backbone is a library that helps you organize large projects with a lot of complex and custom UI/UX.

Re: Backbone has made me a better programmer

#84
post #32

Earlier quoted context omitted.

Angular.js doesn't really solve the hard parts of writing web applications either. The hard part is structure. Not data binding. I don't need a framework to automatically update an for me, input.value = val isn't costing me sleep at night. What we need to make web applications easier are equivalents to things like UIPageViewController in iOS or Activities in Android. Real views that do real things. It seems that JS f…

I disagree. The hard part is nesting views/widgets, and these are very annoying to maintain manually. Knockout.js provides a "foreach" binding, and Angular provides ng-repeat. These are good solutions that automatically handle nested-views in an efficient way.

Nesting views, along with data binding as MatthewPhillips pointed out, is not the hard part of developing frontend apps. Custom UI/UX is the hard part. Can angular fadeIn/slideDown your nested repeated/collection element? No. In angular, along with any other MV* framework, to handle this trivial UX, you have to write a special js routine (directive). Most apps will have much more custom UI/UX and you are going to have to write javascript, and you may have to fight your framework if it is too opinionated.

Re: Backbone has made me a better programmer

#85
post #83

Earlier quoted context omitted.

I'm so glad that this is the current top comment. Backbone apps are the most verbose and non-DRY apps in my experience. Tons of code duplication.

If you have code duplication/DRY problems, then Backbone is not your problem. You need to abstract common functionality and add mixins to Backbone.View.prototype. In every backbone project that I have developed, the set of View mixins that I create are very specific to each project and the custom UI/UX I build. It would be a useless exercise to abstract all of my View mixins into some kind of opinionated framework, b…

Do you have any examples of this? I'd love to see it.

Re: Backbone has made me a better programmer

#87
post #8
post #5

i think it's nice to see some javascript design patterns!

i think design patterns are either A) a lack of necessary abstraction - or - B) a sign of unnecessary complexity

to me, design patterns are how a team designs on the general way of doing a certain activity, and avoid doing it wrong.

maybe unneeded if you are solo, and I agree that "you should know why the best practice is best" but I strongly feel these are very helpful not only for teams, but for learning.

Re: Backbone has made me a better programmer

#88
post #22

I didn't really like backbone at all. It was a pain. It didn't offer anything to help you build complex UI. I had to use backbone to build a mildly complicated UI - not so complex, mind you, just something that's supposed to be somewhat interactive. Backbone was no help at all. Its "views" don't really offer anything. Just about 2 weeks ago I discovered knockout.js, and I felt stupid for spending days building someth…

I would say it's because you guys are doing it wrong. Backbone is just a very bare-bones backbone for your app. As you say, views don't provide anything. In fact backbone barely helps you with organizing your code at all. It's great for making a todos app but terrible for anything stretching across multiple pages, and with more than 10 views on a page. Let's be serious here. DON'T USE BACKBONE TO START A NEW APP!!! D…

Also check out http://thoraxjs.org/beta
Post reply on HN