Your observations are correct. C++ is a complicated beast, and the new
keyword was used to distinguish between something that needed delete
later and something that would be automatically reclaimed. In Java and C#, they dropped the delete
keyword because the garbage collector would take care of it for you.
The problem then is why did they keep the new
keyword? Without talking to the people who wrote the language it's kind of difficult to answer. My best guesses are listed below:
- It was semantically correct. If you were familiar with C++, you knew that the
new
keyword creates an object on the heap. So, why change expected behavior?
- It calls attention to the fact that you are instantiating an object rather than calling a method. With Microsoft code style recommendations, method names start with capital letters so there can be confusion.
Ruby is somewhere in between Python and Java/C# in it's use of new
. Basically you instantiate an object like this:
f = Foo.new()
It's not a keyword, it's a static method for the class. What that means is that if you want a singleton, you can override the default implementation of new()
to return the same instance every time. It's not necessarily recommended, but it's possible.
jQuery a cross browser normalization tool. It gives you the following
- DOM utilities
- Event system
- Ajax
- Animations
- ES5 utilities
- some other thinge
Backbone/knockout/yada/yada are MVC-like libraries that are there to help you structure and write modular application. You only need these if you want their structure.
RequireJS/yada/yada are module loaders. You need some form of module loader if you want to write a modular application.
Where does JQuery fit-in with the various controller-frameworks mentioned above?
As mentioned, jQuery normalizes browsers. controller frameworks do not. You don't need jQuery but you need some way to normalize browsers.
Is JQuery used alongside each or do some of them have their own 'JQuery-styled version' baked-in?
Backbone / knockout / JavaScriptMVC do not have browser normalization baked in so you need a tool for that. I'm not sure about SproutCore it does seem to have a lot in there.
Are tools like RequireJS still needed if you implement one of the various controller-frameworks mentioned above?
These are only needed if you write to write modular applications. So pretty much yes.
There are three flavours of modular applications
- async require loaders like requireJS
- sync require loaders like modul8
- using namespaces and just including files
- packages like ender
Does the define and then capabilities baked-into JQuery now supercede the AMD Loader mentioned above?
No. the define capability baked into jQuery allows you to use it with an AMD loader without wrapping jQuery. You still need an AMD loader. The "then" capability is just some sugar of jQuery deferreds.
Which one seems most modular? (see notes below)
That's an opinionated question. My personal opinion is that all these frameworks including jQuery are bloated and not modular.
You want modular, write your own library, write your own architecture.
However if you want the lesser of evils I would choose backbone because it's simple and small or spine which is similar
Best Answer
I would say its just a matter of enough developer mindshare, combined with node.js invigorating the JavaScript community, combined with html5 hitting its stride. The fact is that these libraries are certainly not the first, even if they do have a sort of new breed feel to them.
Not that it matters because it's still closed source, but my company created a rich client side JavaScript framework with many of the same ideas as the ones you mention - client side templating, data binding, MVC, REST based data services, automatic lazy loading, build tools, etc. And we've been doing it since 2008. Other frameworks have certainly cropped up in that time period as well before backbone, too. JavaScriptMVC has been around forever, and sproutcore too.