커맨더 패턴 ( Command Pattern )
호출을 캡슐화 한다. 어떤 때 쓰면 좋을까 ? ( 내생각 ) 프로그램이 처리 댈 때 매 요청 마다 검증이 필요할때 혹은 요청을 가공할 때 혹은 요청을 되돌리거나, 요청에 대한 기록을 할 때 .. 혹은 요청에 일괄 실행이나 특정 부분까지만 실행 하도록 할때 ! var employee = function(){}; employee.prototype = { call : function(){ alert('can i help you?'); }, orderup : function() { alert('did you choose the menu? '); } } var employeeCall = function(emp) { this.employee = emp; }; employeeCall.prototype.execute ..
웹개발/Javascript
2010. 7. 13. 17:14