Python, DOT and Visualising Legacy Code The Lazy Way (C) John Chandler 2011
Legacy PHP Code! Noooooooooooooo!!!!
Deep Breaths. Visualise the Code.
Laziness Part 1: Use Python to Analyse Dependencies
Write a PHP Parser in Python? Or use a regular expression... (include|require)(?:_once)?[ (]["']([^"']+)["']
Laziness Part 2: Use Graphviz to Draw The Diagram
Graphviz supports DOT. DOT is a graphing mini-language
digraph foo { node1 [label=“Node 1”]; node2 [label=”Node 2”]; node1 -> node2; }
$ dot -Tpng -O foo.dot
WTF. Looks like some refactoring to do
Source is available under GPL v3 from: http://www.bitbucket.org/metaljoe/qadpid
Upcoming SlideShare
Loading in...5
×

Python, DOT and Visualising Legacy Code The Lazy Way

1,405

Published on

Visualising a legacy PHP codebase using Python, DOT and GraphViz. A lightning talk for the London Python Code Dojo 2011-06-02.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,405
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
8
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Python, DOT and Visualising Legacy Code The Lazy Way

  1. 1. Python, DOT and Visualising Legacy Code The Lazy Way (C) John Chandler 2011
  2. 2. Legacy PHP Code! Noooooooooooooo!!!!
  3. 3. Deep Breaths. Visualise the Code.
  4. 4. Laziness Part 1: Use Python to Analyse Dependencies
  5. 5. Write a PHP Parser in Python? Or use a regular expression... (include|require)(?:_once)?[ (]["']([^"']+)["']
  6. 6. Laziness Part 2: Use Graphviz to Draw The Diagram
  7. 7. Graphviz supports DOT. DOT is a graphing mini-language
  8. 8. digraph foo { node1 [label=“Node 1”]; node2 [label=”Node 2”]; node1 -> node2; }
  9. 9. $ dot -Tpng -O foo.dot
  10. 10. WTF. Looks like some refactoring to do
  11. 11. Source is available under GPL v3 from: http://www.bitbucket.org/metaljoe/qadpid
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×