Class::Sniff for the Win!

Ovid on 2009-02-06T15:53:33

I always find out interesting stuff at London.pm meetings. Last night's involved me learning about someone who found unexpected problems in his code using Class::Sniff (not naming him because I didn't ask permission). This makes me happy.

There was also a general discussion of its features and here are some thoughts (some I've had, others came up last night):

  • Calling SUPER:: with MI should definitely be a code smell (perhaps an outright bug?) and not too hard to detect. I'm wondering how else this might manifest. It has some odd edge cases, though.
  • Allow Class::Sniff->new({ class => $some_instance }). I know it's trivial, but I get tired of typing 'ref' because I'm usually loading an instance first to ensure everything is loaded properly.
  • Get rid of the Tree. I don't think I need it.
  • $sniff->report({ as => 'html' });
  • Can I merge different sniff graphs to get a fully graphed system?
  • Find a clean way of excluding stuff you don't care about without excluding an entire section of the report.

Ingy and Yuval were also there. It was good to catch up with them. Yay for London, the town everyone wants to stop over at!


isa is-not-a Tree

Stevan on 2009-02-06T19:46:53

I second the idea of ditching Tree, cause a class hierarchy is really a graph and not a tree.

- Stevan

Re:isa is-not-a Tree

Aristotle on 2009-02-07T01:06:25

Ovid’s entire crusade has been about graph-but-not-tree inheritance patterns being evil…

Re:isa is-not-a Tree

Ovid on 2009-02-07T11:54:25

Which does make me look a bit silly for having the Tree in the first place :)