디자인패턴 AOP가 필요한 이유

황제낙엽 2008.10.08 17:16 조회 수 : 509 추천:85

·미리보기 | 소스복사·
 
  1. public User findUser(String userId) throws UserNotFoundException {   
  2.  if(log.isDebugEnabled()) {   
  3.   log.debug("findUser() 시작");   
  4.   log.debug("User ID : " + userId);   
  5.  }   
  6.     
  7.  User user = null;   
  8.     
  9.  StopWatch clock = new StopWatch("Profiling ...");   
  10.  try {   
  11.   clock.start("findUser()");   
  12.   user = userDAO.findUser(userId);   
  13.  } finally {   
  14.   clock.stop();   
  15.  }   
  16.     
  17.  if(clock.getTotalTimeMillis() > 500) {   
  18.   if(log.isWarnEnabled()) {   
  19.    log.warn("Execution Source : UserDAO.findUser()");   
  20.    log.warn("Execution Time : " + clock.prettyPrint());   
  21.   }   
  22.  }   
  23.     
  24.  if(log.isDebugEnabled()) {   
  25.   log.debug("findUser() 종료");   
  26.  }   
  27.     
  28.  return user;   
  29. }  

 


회색 박스안의 코드는 실제 비즈니스 로직이 아니다.
이 코드를 따로 분리해서 관리할 수 있다면...

 

번호 제목 글쓴이 날짜 조회 수
64 [ChatGPT] 소프트웨어 품질 관리에서 필요로 하는 소양 황제낙엽 2025.05.02 242
63 [Selenium] 크롬 브라우저 실행 화면을 출력하거나 감추는 방법 황제낙엽 2024.05.05 377
62 [Selenium] 페이지 이동 함수 황제낙엽 2024.05.05 346
61 [Selenium] Chrome 실행 자동화 file 황제낙엽 2024.05.03 1498
60 [Selenium] MS Edge 실행 자동화(RPA, Robotic Process Automation) file 황제낙엽 2024.05.02 701
59 [Selenium] Warning : Unable to find CDP implementation matching 124 황제낙엽 2024.05.02 1062
58 프로젝트 WBS 예제 (Microsoft Project 2013) secret 황제낙엽 2021.05.12 0
57 WBS (Work Breakdown Structure) 황제낙엽 2020.06.18 286
56 프로젝트 진행 절차 file 황제낙엽 2020.05.21 405
55 BDD (Behaviour-Driven Development) 황제낙엽 2020.04.02 358
54 요구사항 개발과 요구사항 관리 요약(요구사항기술서 샘플) file 황제낙엽 2019.07.07 425
53 뒤늦게 정리하는 UML (Unified Modeling Language) 요약 file 황제낙엽 2017.03.29 767
52 StarUML™의 숨은 재미있는 기능 황제낙엽 2017.03.29 2481
51 The Facade Pattern file 황제낙엽 2017.01.04 655
50 와블스 프로세스(Warbles Process) 황제낙엽 2016.07.17 550
49 비 개발자 출신이 스크럼 마스터가 될 수 있는가? 황제낙엽 2015.06.25 621
48 디자인패턴[Observer 패턴] 황제낙엽 2013.10.18 500
47 PMBOK 5판 이해관계자 관리의 이해 [1] file 황제낙엽 2013.08.23 1650
46 Validation and Verification file 황제낙엽 2013.08.23 432
45 이해관계자의 관리/이해관계자 분석 황제낙엽 2013.08.23 670