I love the whole user experience/interface thing and put a lot of jQuery and JavaScript (pure JavaScript for HTML5 stuff, like canvas, file API, etc). The problem I face now is that my codes are growing large, 3-4 files per project with each file around 1000 lines of code, and maintaining and extending them is becoming a headache.

I know that Object-Orientated JavaScript coding can solve a lot of my problems. I know the basic concepts of Object-Orientated Programming, have done a decent amount of it in C++, Java and Python in school and college projects. I want to read some good examples large scale OO programming in JavaScript (and jQuery), or if possible, some book specifically on writing big OO programs in JavaScript.

EDIT1: Checked out backbone.js, guess thats what i needed, will be sure once i use it in my next project, thanks Raynos, also, my question should have been about handling large js projects, and not what it is, sry

closed as off-topic by Ixrec, user22815, user40980, durron597, gnat May 19 '15 at 11:02

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Ixrec, Community, Community, durron597, gnat
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Using custom events is a good way to tackle complexity. – Karoly Horvath Jul 23 '11 at 22:24
  • Try using organisation libraries like curl/require for modularisation and Backbone/spine/sammy/knockout for MVX style structure. Also I'd recommend you read node.js projects as they have good examples of OO js – Raynos Jul 23 '11 at 22:55
  • I'd also recommend you only use Object.create and traits for your OO. This along with AMD modules should keep your code tight and structured – Raynos Jul 24 '11 at 18:10
  • Have a look at JavaScript MVC – Chiron Jul 24 '11 at 19:50
  • Use C# instead. – Andy Jun 17 '17 at 20:15

Check out backbone.js so far its one of the best solutions (along with javascript mvc) to give some order into the caos/beauty of large scale javascript applications. If you think its overkill I would recommend separating your files in some kind of structure, for instance a file with all of the event bindings, another file for all of the ajax calls another one for anything that edits the html.... if you think about it you are kind of already trying to make a type of mvc structure so check out those tools first and see what they have to offer.

  • doing that already, working on my firm's portfolio and it has many different js stuff going on. Hadn't used backbone.js when i started working on it so started making separate files for each piece of work. It has eased the development process a lot, and I can always combine and minify them at the time of production. By the way, from what I have read of backbone.js, its the perfect lightweight addition for at least medium scale apps – kapv89 Aug 4 '11 at 18:11

ExtJS is an highly refined, completely extensible library of Javascript UI components that shows the power of OO programming in Javascript. You could also look at the jQuery source, or the Yahoo! UI library.


Google for Scalable JavaScript Architecture. You'll find a lot of resources for what you want. Some of them are:

  1. Nicholas from Yahoo
  2. Nettuts+

Also you can follow JavaScript design patterns in books like Pro JavaScript Design Patterns from Apress.

I also recommend subscribing to the feed of some good sites like:

  1. DailyJS
  2. JavaScript Kit

Not the answer you're looking for? Browse other questions tagged or ask your own question.