Live data from Hacker News

JavaScript: The Right Way

jstherightway.org

131–136 of 136 posts

Re: JavaScript: The Right Way

#131

Having recently started getting into Javascript, I have to say it is the most confusing ecosystem ever. Learning the basics of the language is easy enough, but as soon as you start trying to create a non-trivial application, bam, you're hit with information overload - X framework, Y library. It's different from Python, Ruby et all because at least with them, there are good consistent popular choices that you can rely…

Hehe. I know the feeling. I've spent a lot of time learning about the different options over the past year. Maybe it was wasted time, hopefully not. Backbone taught me a lot about design patterns in general (event aggregators, pub/sub w/Marionette, MVC). Then I started learning Angular which felt like being turned upside down.

Re: JavaScript: The Right Way

#132
post #41

Earlier quoted context omitted.

There's a lot of choices, and that's not a bad thing necessarily. Javascript is in a heavy growth period right now. But I totally get the choice overload thing. There's a lot of people interested in javascript from all different areas of computer land, and they all have different ideas of what "best" is, and they all want to make javascript more like lisp, or more like ruby, or more like java, or more like c# or more…

Backbone may or may not be right for you. Fortunately it's small, and fairly easy to read. The annotated sources [1][2] for BackBone and Underscore are fairly accessible. Also, I would highly recommend adding an AMD loader like require.js to your "basics kit". Code organization gets very important very fast, and it helps to think modular-and-reusable from the beginning. [1] http://underscorejs.org/docs/underscore.htm…

For someone new to JS, as I once was, Require.JS can really complicate things. I know I read all these comments and blog posts saying "Use require.js!", so I thought I had to use it. Well, it took a long time to figure out how to structure my Backbone code that way. Most examples and tutorials aren't using Require.JS, and that also makes things harder. I would use it now on a backbone project, but not sure if I would recommend it to beginners.

Re: JavaScript: The Right Way

#133

Earlier quoted context omitted.

> What would be an example of a language with weaker OOP capabilities? Something without the concept of objects built in? C?

That's absent OOP capabilities.

No, C is perfectly capable of OOP. I can't think of a general purpose language that inherently isn't.

Re: JavaScript: The Right Way

#134
post #92

Having recently started getting into Javascript, I have to say it is the most confusing ecosystem ever. Learning the basics of the language is easy enough, but as soon as you start trying to create a non-trivial application, bam, you're hit with information overload - X framework, Y library. It's different from Python, Ruby et all because at least with them, there are good consistent popular choices that you can rely…

I think there are 2 things at play that prevent a rails-like monolithic framework for js at the moment: 1) Front-end applications tend to have wider variation in functionality requirements from the start (real-time, graphs, animations, forms, modals, pushstate). There isn't a "standard CRUD app" that people are building with front-end js, often js is just being used for a single effect or widget. 2) Performance trade…

Your last sentence is specially interesting. Being able to do a "bower install backbone" and going back to work is actually the purpose of a package manager. If it doesn't understand your project structure and is not able to wire the downloaded libraries into your project, whats the point of using it? Then bower is as good as npm or any other tool to download libraries. Right?

Re: JavaScript: The Right Way

#135
post #134
post #92

Earlier quoted context omitted.

I think there are 2 things at play that prevent a rails-like monolithic framework for js at the moment: 1) Front-end applications tend to have wider variation in functionality requirements from the start (real-time, graphs, animations, forms, modals, pushstate). There isn't a "standard CRUD app" that people are building with front-end js, often js is just being used for a single effect or widget. 2) Performance trade…

Your last sentence is specially interesting. Being able to do a "bower install backbone" and going back to work is actually the purpose of a package manager. If it doesn't understand your project structure and is not able to wire the downloaded libraries into your project, whats the point of using it? Then bower is as good as npm or any other tool to download libraries. Right?

What bower manages is downloading dependencies at a specific version and putting them in a folder. It does not wire/unwire them into my index.html. At this point I have to do that by hand. There are a lot of ways my project could be laid out. I might only want d3.js on my dashboard page, I might have a layout template where all of my html imports reside. I might want the files all concatenated together and downloaded in the browser as a single main.js. In it's current incarnation it's still a package manager... it makes packages available at a path. It's just not as useful as it could be if it were a bit more specific about project structure.

Re: JavaScript: The Right Way

#136
post #135
post #134

Earlier quoted context omitted.

Your last sentence is specially interesting. Being able to do a "bower install backbone" and going back to work is actually the purpose of a package manager. If it doesn't understand your project structure and is not able to wire the downloaded libraries into your project, whats the point of using it? Then bower is as good as npm or any other tool to download libraries. Right?

What bower manages is downloading dependencies at a specific version and putting them in a folder. It does not wire/unwire them into my index.html. At this point I have to do that by hand. There are a lot of ways my project could be laid out. I might only want d3.js on my dashboard page, I might have a layout template where all of my html imports reside. I might want the files all concatenated together and downloaded…

OK. That makes sense.
Post reply on HN