这可能是一个愚蠢的问题,但这两种模式之间是否有功能上的区别呢?没有实际功能差异,只是组织喜好的问题吗?您在什么情况下想使用其中之一而不是另一个?我正在尝试找到我感觉最舒适的设计模式。谢谢!
$(function(){
Core.init();
});
var Core = {
init: function() {
//some initialization code here
}
_plugins: function() {
//instantiate some plugins here
}
_display: function() {
//some more code here
}
_otherfunctions: function() {
....
}
}
并且
$(function(){
Core.init();
Plugins.init();
Display.init();
});
var Core = {
init: function() {
//some initialization code here
}
}
var Plugins = {
init: function() {
//start plugins
}
_modify: function() {
//more code
}
}
var Display = {
init: function() {
//some init code
}
}