ここで初歩的な質問が来ます: 次のように書かれた jQuery コードを見ました:
var PRINCIPAL = {};
PRINCIPAL.Function = function($element) {
var self = this;
/*more vars*/
this.init = function() {
self.initialFunction();
};
this.initialFunction = function() {
/*code here*/
};
this.secondOne = function() {
/*code here*/
};
this.init();
};
/*associative array below??*/
PRINCIPAL.array = {
CONFIGURATION: 10,
CONFIGURATION2: 200,
init: function($element) {
/*code here*/
},
firstFunction: function() {
/*code here*/
},
secondOne: function() {
/*code here*/
},
thirdOne: function() {
/*code here*/
}
};
/*and at the end it stars all functions inside the blocks*/
$(function() {
PRINCIPAL.array.init($('#element'));
});
さて、上記のような配列(?)がたくさんあり、他の関数もいくつかあり、すべてのコードはすべてブロックに分割されていました。よくわかりませんが、これは一種のプログラミングスタイルですか、それとも何ですか?