模組:寫法一致、避免全域變數 YUI.add("welcome/_notification",
function
(Y)
{
var
trans
=
{},
module;
module
=
new
Y.Module({
selector:
"#notification",
init:
function
()
{
模組:寫法一致、避免全域變數 YUI.add("welcome/_notification",
function
(Y)
{
var
trans
=
{},
module;
module
=
new
Y.Module({
selector:
"#notification",
init:
function
()
{
},
on:
{
viewload:
function
(node)
{
}
}
}); },
"0.0.1",
{"requires":
[
"module"
] });
module.broadcast("greeting",
trans.greeting);
module.listen("need-‐love",
function
(e)
{
/*
do
something
*/
});
new
Y.ScrollPagination({node:
node}); welcome/_notification.js 所有的功能都圍繞著模組化開發 多國語系 送廣播 聽廣播 加上其他相依模組 trans.greeting
=
module.getTrans("greeting",
"Hello
World"); ,"module-‐popup",
"module-‐intl",
"gallery/scroll-‐pagination"
模組:寫法一致、避免全域變數 YUI.add("welcome/_notification",
function
(Y)
{
var
trans
=
{},
module;
module
=
new
Y.Module({
selector:
"#notification",
init:
function
()
{
壓縮開發時程之謎 Stoyan Stefanov The few man-hours spent writing the code initially end up in man-weeks spent reading it. 數⼩小時寫出的程式碼、得花數週或更多的時間維護它 要在 8 個 JavaScript 上: • 增加新功能 • 修改 Bug • 改變邏輯 • 看不懂、乾脆重寫 ⽼老闆跟專案經理永遠無法理解的事...
Donald Knuth 現代電腦科學的鼻祖 A style of programming that maximize our ability to perceive the structure of a complex piece of software. 文學編程的理念 w൞ℭީਔđⁿ֥ӱൔ۷ݺĆx ໓⇥ṇӱ൞၂⊕⇔ӱൔ֥མྙⅢ ⁿỚᧄℂⅴ֥ૄἠ♶≗ὔᾳି ԉٳֹࢳ