04 UML Tools Forward and Reverse Engineering 1743663463376
04 UML Tools Forward and Reverse Engineering 1743663463376
UML tools
Test Driven Development
• Aka Test First Development
• Write little test code, then little production
code, pass the test and so on
Test Driven Development -
Advantages
• Unit tests are actually written
• Programmer satisfaction
• Clarification of detailed interface and
behavior
• Provable, repeatable, automated
verification
• The confidence to change things
Refactoring
• Structured, Disciplined method to rewrite or
restructure existing code
• External behavior of the code is not
changed
• Applying small behavior preserving
transformations one at a time
• Unit tests are re – executed to prove change
didn’t affect behavior
Activities and goals
• Remove duplicate code
• Improve clarity
• Make long methods shorter
• Remove the use of hard – coded literal
constants
• Code smells and Code stench
Code smells
• Duplicated code
• Big method
• Class with many instance variables
• Class with lots of code
• Strikingly similar subclasses
• Little or no use of interfaces in the design
Refactoring methods
• Extract method
– Longer method into shorter one
• Extract constant
– Literal constant into constant variable
• Introduce explaining constants
– Store results in temporary variable with
meaningful name
• Replace constructor call with factory
method
– Invoke a helper method
Refactoring methods
Three ways to apply UML
• UML as sketch
• UML as blueprint
• UML as programming language
Forward, Reverse and Round-Trip
• Forward Engineering
– Generation of code from diagrams
• Reverse Engineering
– Generation of diagrams from code
• Round - Trip Engineering
– Done in either way
• Most of the tools lack many facilities,
especially reverse engineering for dynamic
models
How to choose a tool
• Look for free UML tool
• Once chosen, try it on real project with many
developers and seek their guidance for future
use
• Choose UML tool that integrates into your IDE
Choose tool that supports reverse engg.
sequence diagrams from code
• Choose tool that supports printout on large
plotter paper so that large visualization is
possible
If sketching….?
• Updation by reverse engineering is easy
• But in sketching, updation is not easy
• Do reverse engineering, take large printouts
and hang on the wall