Changes between Version 2 and Version 3 of CODE_TASKS_REQUIREMENTS


Ignore:
Timestamp:
09/16/08 17:52:25 (17 years ago)
Author:
Tanya
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CODE_TASKS_REQUIREMENTS

    v2 v3  
    7979 * other: 
    8080  * Enough information should be provided in the backlog. 
     81 
     82= Code Reuse = 
     83 
     84Do not have the same functionality on more than one place - this increases the chances of mistakes and makes it difficult for refactor. 
     85 
     86In the class !BookView we had the following two methods: 
     87As we see we have code reuse, and the private method do not register the view as observer of the page. 
     88{{{ 
     89        @Override 
     90        public void pageAdded(Page page) {               
     91                PageView pageView = new PageView(this, page); 
     92                this.pageViews.add(pageView); 
     93                page.getObservable().addObserver(pageView); 
     94                this.observable.getInvoker().pageViewCreated(pageView); 
     95        } 
     96   
     97... 
     98 
     99        private void createChildView(Page page){ 
     100                PageView p = new PageView(this, page); 
     101                this.pageViews.add(p); 
     102                this.observable.getInvoker().pageViewCreated(p); 
     103        } 
     104}}} 
     105 
     106Shall be: 
     107 
     108{{{ 
     109        private void createChildView(Page page){ 
     110                final PageView p = new PageView(this, page); 
     111                this.pageViews.add(p); 
     112                this.observable.getInvoker().pageViewCreated(p); 
     113                page.getObservable().addObserver(p); 
     114        } 
     115 
     116... 
     117        public void pageAdded(Page page) {               
     118                createChildView(page); 
     119        } 
     120}}}