270 likes | 506 Views
WARNING. These slides are not optimized for printing or exam preparation. These are for lecture delivery only. These slides are made for PowerPoint 2010. They may not show up well on other PowerPoint versions . You can download PowerPoint 2010 viewer from here .
E N D
WARNING • These slides are not optimized for printing or exam preparation. These are for lecture delivery only. • These slides are made for PowerPoint 2010. They may not show up well on other PowerPoint versions. You can download PowerPoint 2010 viewer from here. • These slides contain a lot of animations. For optimal results, watch in slideshow mode.
Which is the better Minesweeper design? (a) (b) Logic Minefield Storage Logic Minefield Storage :Logic m:Minefield :Storage :Logic m:Minefield :Storage mark mark mark mark update(m) update(m) get info get info design {a|b} e.g. design b 77577
To Tighten or Loosen: What Makes a Good Component. CS2103/T, Lecture 7, Part 1, [Oct 4, 2013]
To Tighten or Loosen: What Makes a Good Component.
To Tighten or Loosen: • What Makes a Good Component. • Coupling • Cohesion
Dependency == Component A Component B If I change B , will it require a change in A ? NO WAY It might • Coupling
Component A Component B If I change B , will it require a change in A ? • Coupling
Component A Component B If I change B , will it require a change in A ? • Coupling
Component A Component B • Coupling
Component A Component B If I change B, will it require a change in A?Yes, It might • Reduce coupling
Good Component design • Reduce coupling cohesion
Does one thing and does it all Component C Component A Component B cohesion
Does one thing and does it all Window 1 Component A Window 2 Window 3 cohesion
Does one thing and does it all Component C Component A Component B cohesion
Does one thing and does it all Component C Component A Component B • Increase cohesion cohesion
Good Component design • Increase cohesion • Reduce coupling
Increase cohesion • Reduce coupling
(a) (b) Logic Minefield Storage Logic Minefield Storage
(2nd attempt) Which is the better design? (a) (b) Logic Minefield Storage Logic Minefield Storage design2{a|b} e.g. design2 b 77577