Upload
ashokguduru
View
70
Download
0
Embed Size (px)
Citation preview
1
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 2
http://ashokg.com
Big Ball of Mud: By Brian Foote and Joseph Yoder
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 3
A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape-and-baling-wire, spaghetti-code jungle.
big ball of mud is a software system that lacks a perceivable architecture. Although undesirable from an engineering point of view, such systems are common in practice due to business pressures and developer turnover. They have therefore been declared a design anti-pattern.
Big Ball of Mud: By Brian Foote and Joseph Yoder
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 4
5
Tell me and I'll forget.Show me and I might remember.But involve me and I will understand.
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 6
• Rigidity• Fragility• Immobility (Inseparability)• Viscosity• Needless Repetition• Needless Complexity• Opacity
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 7
Rigidity: The design is hard to change• Very difficult to modify• Changes propagate via dependencies to other modules• You start modifying the code and it leads to modify
more code that changes and within minutes you change the code you never thought would change (in several places)
• Comes from Strong/High coupling and Week/Low Cohesion
Telltale sign: "Huh, it was a lot more complicated than I thought."
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 8
Fragility: The design is easy to break• Code is very fragile• Changes cause cascading effects to many places the
code breaks in unexpected places that have no conceptual relationship with the changed area
• Fixing the problems causes new problems• You make a change and very quickly it ends-up making
lot of other changes. The code just breaks and it becomes very difficult to put it back in to shape
• It starts breaking in several places if you start to do more changes
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 9
Fragility: The design is easy to break• E.g. Kids play with a deck of cards to build a house of
cards. When it comes about 3-4 feet you very careful to put stuff on it. And you say don't open the door. You very quite and move very slowly. And we grow and create software. We type the code it compiles, we move slowly from the computer, and we say The code works don't touch it, I'm going home! ShipIt!
• Extremely Fragile.• The code is very difficult to maintain at that moment
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 10
Fragility: The design is easy to break
Telltale signs:– Some modules are constantly on the bug list– Time is used finding bugs, not fixing them– Programmers are reluctant to change anything in
the code
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 11
Inseparability (Immobility)
Spaghetti code is a term for source code that has a complex and tangled control structure
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 12
Immobility: The design is hard to reuse!• The code is so tangled (twisted) that it is impossible to reuse
anything• The code is very immobile!• The class depends on other class and that is depeneds on some
other class. Very soon we need to do a disk swap. It needs everything on my system.
• Immobile code is very difficult to handle
Telltale sign: A module could be reused but the effort and risk of separating it from the original environment is too high -- Decouple the code. Use one level of indirection and abstraction
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 13
Viscosity: The code resists making a change• We tend to do, Its easier to do the wrong thing. Its
hard to do the right thing.• Imagine we have a 40-lines of code and we see some
of the things are matching. We copy and paste it. And very soon you have 7 copies of it. When you want to fix it, you'll do it in 4 places and it becomes expensive to maintain the code.
• Metaphor: Very hard to swim in oil than its in water.• Resistance! or Friction! or Rotting! Unit Testing will help!
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 14
Needless Complexity: Overdesign.• We just cannot do simple things, We got to do things
complex• It makes pride in doing in complex.• JOKE: Job security! Nobody can understand other than
me • REUSE/ABUSE (We need binary reusability. Not source
code level duplication)
Simple things should be simple and complex things should be possible.- Alan Kay
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 15
Needless Repetition: Mouse abuse.
• Do not abuse the copy & paste options. • When it is possible, try to refactor the repetitive code.
Follow DRY principle
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 16
Opacity: Difficult to understand
• It is very difficult to understand the code on what it does.
• The meaning walks away with the person who wrote it or created it.
• The boss says don't touch that code the guy who wrote it is no longer works here!
Telltale sign: You are reluctant to fix somebody else’s code or even your own!
Symptoms of Bad Quality Software
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 17
• DRY• YAGNI• SRP• OCP• LSP• DIP• CQS
Possible Solutions:
Copyright © 2013 Coextrix Technologies Pvt. Ltd., Bangalore 18Copyright © 2015 ELI Research India Pvt. Ltd., Chennai
When a tester didn't find any cool bugs, then he basically has two options to think about.
a) The software is good enough to go liveb) The software wasn't tested well enough
Typically, the developer thinks it is "a". And, of course, the tester always fears it could be option "b".
Copyright © 2013 Coextrix Technologies Pvt. Ltd., Bangalore 19Copyright © 2015 ELI Research India Pvt. Ltd., Chennai
Books:
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 20
1. Refactoring - Improving The Design Of Existing Code -- by Martin Fowler2. Agile Software Development Principles, Patterns, and Practices -- by Robert C. Martin3. Clean Code -- by Robert C. Martin
4. Code Complete (2nd Edition) -- by Steve McConnell A Practical Handbook of Software Construction
5. Working effectively with legacy code
-- by Michael Feathers
Thank you!
Thank you!
The amateur software engineer is always in search of magic. -- Grady Booch
Copyright © 2015 ELI Research India Pvt. Ltd., Chennai 21
http://ashokg.com