高度に分離し、モジュール化された異なる機能を組み合わせてできるアプリケーションのことをモジュラーという
一部に加えた変更による他の部分への影響がきわめてわかりやすくなるので、疎結合化を行うと依存関係が減りメンテナンス性が向上する
今のJavaScriptのイテレーションであるECMA-262では、モジュールのコードをインポートする方法は提供されていない
今までに学んだモジュールパターン、オブジェクトリテラルパターンに頼るのも良いが、名前の衝突を招く可能性がある
var Model = Backbone.Model.extend({ | |
defaults: { | |
name: null | |
} | |
}); | |
var Collection = Backbone.Collection.extend({ | |
model: Model, | |
comparator: function(a, b) { | |
a = a.get('name').toString().toLowerCase(); |
(function(m) { | |
'use strict'; | |
m.Views.Tables = Backbone.View.extend({ | |
initialize: function() { | |
this.collection = new m.Collections.Records(); | |
this.data = this.getData(); | |
this.table_panel_view = new m.Views.Table.Panel(); | |
this.setRecords(this.data); | |
}, |
$('.header').css({'position': 'fixed', 'top': 0, 'z-index': 1}).width('100%'); | |
$('body').css('margin-top', $('.header').height() + 1); |
var foo = function () { | |
'use strict'; | |
this.message = 'Hello World!'; | |
}; | |
foo.prototype.txt = function () { | |
return this.message; | |
}; | |
foo.prototype.log = function () { |
/** | |
* define.js | |
**/ | |
global.ORANGE = 'mikan'; | |
/** | |
* say.js | |
**/ | |
module.exports = function () { console.log(ORANGE); }; |
/** | |
* define.js | |
**/ | |
global.ORANGE = 'mikan'; | |
/** | |
* say.js | |
**/ | |
module.exports = function () { console.log(ORANGE); }; | |
いつ | なにやる |
---|---|
毎日 | $ git push origin master |
毎週 | CS以外の勉強をする |
毎月 | $ npm publish somthing |
毎クオーターおきに | 長めの記事を書く/人前で話す |
半年おきに | アプリをリリースする |
年内に | 引っ越す |
# cd pwd ls | |
function cd () { command cd $@ && ls; } |