some theory and practice on patterns introduction
play

Some Theory and Practice on Patterns Introduction Yann-Gal Guhneuc - PowerPoint PPT Presentation

Some Theory and Practice on Patterns Introduction Yann-Gal Guhneuc NII, Tokyo, Japan 12/02/14 This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 3.0 Unported License 2/155 Typical software


  1. Quality Models  Conclusions – Sound basis to measure different quality characteristics  Limits – Relation between metrics and quality characteristics, such as maintainability – Relation between metrics and what they are expected to measure 49/155

  2. Quality Models  Limits – Relation between metrics and quality characteristics, such as maintainability – Relation between metrics and what they are expected to measure  Overcome by using more, diverse, unrelated information 50/155

  3. Quality Models  Feedback – Measures – Occurrences – Factors to build “better” quality models 51/155

  4. Metrics Models Measures Quality Models Good Practices Definition Maintainability Detection Occurrences Social Studies Characteristics Factors Developers Studies Behaviour 52/155

  5. 53/155

  6. Practice, practice and practice more 54/155

  7. 55/155

  8. Good Practices  Maintainers can follow good practices – SOLID – Design patterns – Design antipatterns – … 56/155

  9. Good Practices  Maintainers can follow good practices – SOLID – Design patterns – Design anti-patterns – … 57/155

  10. “Each pattern describes a problem which occurs over and over in our environment, and then describes the core of the solution to that problem, in such way that you can use this solution a million times over, without ever doing it the same way twice.” —Christopher Alexander, 1977 (With minor adaptations) 58/155

  11. Good Practices  Design patterns – A general reusable solution to a commonly occurring problem within a given context in software design  Design antipatterns – A design pattern that may be commonly used but is ineffective/counterproductive in practice 59/155

  12. Good Practices 60/155

  13. Design Patterns “Important assumptions – That patterns can be codified in such a way that they can be shared between different designers – That reuse will lead to “better” designs. There is an obvious question here of what constitutes “better”, but a key measure is maintainability” —Zhang and Budgen, 2012 (With minor adaptations) 61/155

  14. Design Patterns  Pattern solution = Motif which connotes an elegant architecture 62/155

  15. Design Patterns  Pattern solution = Motif which connotes an elegant architecture 63/155

  16. Design Patterns  Pattern solution = Motif which connotes an elegant architecture 64/155

  17. Frame Panel Design Patterns DrawingEditor DrawingView Tool Drawing Handle Figure We can identify AbstractFigure in the architecture AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure of a systems Figure AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure micro-architectures similar to Component 1..n Client operation() ramification design motifs Leaf Composite add(Component) operation() remove(Component) getComponent(int) For each components operation() to explain the component.operation() To compose objects problem solved in a tree-like structure to describe whole–part hierarchies 65/155

  18. Frame Panel Design Patterns DrawingEditor DrawingView Tool Drawing Handle Figure We can identify AbstractFigure in the architecture AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure of a systems Figure AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure micro-architectures similar to Component 1..n Client operation() ramification design motifs Leaf Composite add(Component) operation() remove(Component) getComponent(int) For each components operation() to explain the component.operation() To compose objects problem solved in a tree-like structure to describe whole–part hierarchies 66/155

  19. Frame Panel Design Patterns DrawingEditor DrawingView Tool Drawing Handle Figure We can identify AbstractFigure in the architecture AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure of a systems Figure AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure micro-architectures similar to Component 1..n Client operation() ramification design motifs Leaf Composite add(Component) operation() remove(Component) getComponent(int) For each components operation() to explain the component.operation() To compose objects problem solved in a tree-like structure to describe whole–part hierarchies 67/155

  20. Frame Panel Design Patterns DrawingEditor DrawingView Tool Drawing Handle Figure We can identify AbstractFigure in the architecture AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure of a systems Figure AttributeFigure DecoratorFigure PolyLineFigure CompositeFigure micro-architectures similar to Component 1..n Client operation() ramification design motifs Leaf Composite add(Component) operation() remove(Component) getComponent(int) For each components operation() to explain the component.operation() To compose objects problem solved in a tree-like structure to describe whole–part hierarchies 68/155

  21. Design Patterns  Conclusions – Codify experts’ experience – Help train novice developers – Help developers’ communicate – Lead to improved quality 69/155

  22. Design Anti-patterns  Important assumptions – Poor design choices that are conjectured to make object-oriented systems harder to maintain – Yet, maybe the best and possibly only way to implement some requirements and–or some functionalities 70/155

  23. Design Anti-patterns  Problem – Problem recurring in object-oriented design  Poor solution – Initially may look like a good idea  Alternative solution – Repeatable (design pattern) – Effective 71/155

  24. Design Anti-patterns  Negatively impact – Fault proneness – Change proneness – Comprehension 72/155

  25. Design Anti-patterns  Conclusions – Codify experts’ “bad” experience – Help train novice developers – Help developers’ communicate – Lead to improved quality 73/155

  26. Good Practices  Limits – So many patterns – So many • Programming languages • Development contexts • Application domains • Expertises  How to use their occurrences in a model? 74/155

  27. Metrics Models Measures Quality Models Good Practices Definition Maintainability Detection Occurrences Social Studies Characteristics Factors Developers Studies Behaviour 75/155

  28. Social Studies  Developers’ characteristics – Gender – Status – Expertise – Training – Processes – … 76/155

  29. 77/155

  30. Agile programming, anyone? 78/155

  31. 79/155

  32. Social Studies  Need for social studies, typically in the form of experiments – Independent variable (few) – Dependent variables (many) – Statistical analyses (few) – Threats to validity (many) 80/155

  33. Social Studies  For example, impact on identifiers on program understandability – Identifier styles [Sharif, Binkley] – Identifier quality [Lawrie] – Developers’ gender and identifiers [Sharafi] – … 81/155

  34. Social Studies  For example, impact on identifiers on program understandability – Identifier styles [Sharif, Binkley] – Identifier quality [Lawrie] – Developers’ gender and identifiers [Sharafi] – … Zohreh Sharafi, Zéphyrin Soh, Yann-Gaël Guéhéneuc, and Giuliano Antoniol ; Women & Men: Different but Equal – A Study on the Impact of Identifiers on Source Code Underestanding ; 82/155 Proceeding of 20th International Conference on Program Comprehension, IEEE, 2012

  35. Social Studies  Independent variables – Gender: male vs. female – Identifier: camel case vs. underscore  Dependent variables – Accuracy – Time – Effort 83/155

  36. Social Studies  Subjects Subjects’ Demography (24 Subjects) Academic background Gender Ph.D. M.Sc. B.Sc. Male Female 11 10 3 15 9  Conclusions Accuracy Time Effort 84/155

  37. Social Studies  Importance  Limits – Confounding factors – Actionable results? 85/155

  38. Metrics Models Measures Quality Models Good Practices Definition Maintainability Detection Occurrences Social Studies Characteristics Factors Developers Studies Behaviour 86/155

  39. Developers Studies  Developers’ thought processes – Cognitive theories – Memory theories • Brooks’ • Kelly’s categories • Von Mayrhauser’s • Minsky’s frames • Pennington’s • Piaget’s schema • Soloway’s • Schank’s scripts – Mental models • Gentner and Stevens’ mental models 87/155

  40. Developers Studies  Studying developers’ thought processes – Yarbus’ eye-movements and vision studies – Just and Carpenter’s eye–mind hypothesis – Palmer’s vision science – … 88/155

  41. Developers Studies  Picking into developers’ thought processes 89/155

  42. Developers Studies  Picking into developers’ thought processes 90/155

  43. Developers Studies  Picking into developers’ thought processes 91/155

  44. Developers Studies  Developers’ thought processes – Reading code [Maletic] – Reading design models [Cepeda] • Content • Form – … 92/155

  45. Developers Studies  Developers’ thought processes – Reading code – Reading design models [Cepeda] • Content • Form – … Gerardo Cepeda Porras and Yann-Gaël Guéhéneuc ; An empirical study on the efficiency of different design pattern representations in UML class diagrams ; 93/155 Journal of Empirical Software Engineering, 15(5), Springer, 2010

  46. Developers Studies  Developers’ use of design pattern notations during program understandability – Strongly visual [Schauer and Keler] – Strongly textual [Dong et al.] – Mixed [Vlissides] 94/155

  47. Developers Studies  Independent variables – Design pattern notations – Tasks: Participation, Composition, Role  Dependent variables – Average fixation duration – Ratio of fixations – Ration of fixation times 95/155

  48. Developers Studies  Subjects – 24 Ph.D. and M.Sc. students  Conclusions – Stereotype-enhanced UML diagram [Dong et al.] more efficient for Composition and Role – UML collaboration notation and the pattern- enhanced class diagrams more efficient for Participation 96/155

  49. Developers Studies  Importance – Understand – Do better  Limits – Confounding factors – Actionable results? 97/155

  50. Impact of Quality Models  Usefulness of the feedback?  Usefulness of the models? 98/155

  51. Feedback?  Trend to use more, diverse, unrelated information as input of quality models – Code source metrics – Historical metrics – Design metrics 99/155

  52. Feedback?  Trend to use more, diverse, unrelated information as input of quality models – Code source metrics – Historical metrics – Design metrics – Good practices – Social studies – Developers’ studies 100/155

Recommend


More recommend