Download AntiPatterns-Patterns in Software Engineering-Lecture 16 Slides-Computer Engineering and more Slides Software Engineering in PDF only on Docsity! Patterns in Software Engineering Lecturer: Raman Ramsin Lecture 16 AntiPatterns Part 1 Department of Computer Engineering 1 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns Compiled and presented by Brown et al in 1998 . . "An AntiPattern describes a commonly occurring solution to a problem that generates decidedly negative consequences." The AntiPattern may be the result of a manager or developer: t k i b ttno now ng any e er, not having sufficient knowledge or experience in solving a particular type of problem or , having applied a perfectly good pattern in the wrong context. Department of Computer Engineering 2 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development (Contd.) Golden Hammer: A familiar technology or concept applied obsessively to many software problems. Spaghetti Code: Ad hoc software structure makes it difficult to extend and optimize code. Walking through a Minefield: Using today’s software technology is analogous to walking through a high-tech mine field: bugs abound. C d P P i C d d b iut−an − aste rogramm ng: o e reuse y copy ng source statements leads to significant maintenance problems. M h M t K i t d l i l t d f thus room anagemen : eep ng sys em eve opers so a e rom e system’s end users. Department of Computer Engineering 5 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – The Blob The Blob: Found in designs where one class monopolizes the processing and other classes primarily encapsulate data, . The key problem here is that the majority of the responsibilities ll t d t i l l hi h t t llare a oca e o a s ng e c ass w c ac s as a con ro er. Solution: Decompose the class and redistribute the responsibilities. Department of Computer Engineering 6 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – Lava Flow Lava Flow: Dead code and forgotten design information is frozen in an ever- changing design. Causes: R&D code placed into production without configuration management. Uncontrolled distribution of unfinished code. Implementation of several trial approaches for implementing a function. Single developer (lone wolf) design or written code- . Lack of configuration management or process management policies. Lack of architecture, or non-architecture-driven development. Repetitive development process. Architectural scars: Architectural mistakes not removed. To solve: include a configuration management process that eliminates dead code and evolves or refactors design toward increasing quality. To avoid: ensure that sound architecture precedes code development. Department of Computer Engineering 7 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – Poltergeists Poltergeists: Classes with limited responsibilities and roles to play in the system; therefore, their effective life cycle is quite brief; they clutter software designs, creating unnecessary abstractions; They can be excessively complex hard to understand and hard to , , maintain. Solution: Remove them from the class hierarchy altogether. The functionality that was provided by it must be replaced; Move the controlling actions initially encapsulated in the Poltergeist into the related classes that they invoked. Department of Computer Engineering 10 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – Golden Hammer Golden Hammer: A Golden Hammer is a familiar technology or concept applied obsessively to many software problems. "When your only tool is a hammer, everything else is a nail." Solution: expanding the knowledge of developers through education , training, and book study groups to expose developers to alternative technologies and approaches. Department of Computer Engineering 11 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – Spaghetti Code Spaghetti Code: Ad hoc software structure makes it difficult to extend and optimize code. Coding and progressive extensions have compromised the software structure to such an extent that the structure lacks clarity, even to the original developer. If developed using an OO language, the software may include a small number of objects that contain methods with very large implementations. The system is very difficult to maintain and extend, and there is no opportunity to reuse the objects and modules in other similar systems. Solution: Clean up and restructure the code using reengineering. Department of Computer Engineering 12 Sharif University of Technology Patterns in Software Engineering – Lecture 16 AntiPatterns: Development – Mushroom Management Mushroom Management: In some architecture and management circles, there is an explicit policy to keep system developers isolated from the system’s end users. Requirements are passed second-hand through intermediaries, including architects, managers, or requirements analysts. Motto: “Keep your developers in the dark and feed them fertilizer ” . Mushroom Management assumes that requirements are well understood by both end users and the software project at project inception. It is assumed that requirements are stable. Solution: Risk-driven development: spiral development process based upon prototyping and user feedback. Department of Computer Engineering 15 Sharif University of Technology Patterns in Software Engineering – Lecture 16 R fe erence Brown, W. J., Malveau, R. C., McCormick, H., Mowbray, T., Antipatterns: Refactoring Software, Architectures, and Projects in Crisis. Wiley, 1998. Department of Computer Engineering 16 Sharif University of Technology