How to determine coupling and cohesion of a perl program?

Daniel Walmsley daniel at landmarksoftware.com.au
Thu Jul 11 20:29:33 CDT 2002


As a further metric, you might want to look at dependencies amongst modules
in close namespaces verses reliance on modules in other namespaces, i.e.
Module A::X references A::Y a lot, but has few references to B::Z. I would
imagine that closer coupling between classes in the same sort of area is not
as problematic as reliance on totally unrelated classes, in terms of
maintainability and understandability, and in fact is something that should
be expected to happen a lot.

Cheers,
Dan

-----Original Message-----
From: Martin Cleaver [mailto:mrjcleaver at yahoo.co.uk] 
Sent: Thursday, 11 July 2002 3:00 PM
To: melbourne-pm at pm.org
Subject: How to determine coupling and cohesion of a perl program? 


Hi all,
   It was good to meet you all last night. As promised, here is my perl
problem

   When I studied software engineering, much was made of how low-coupling
and high-coherence would ensure the maintainability of a piece of code. 

I've been looking around, to no avail, for a something to analyse Perl
scripts for these qualities. I want to use them as the basis for suggesting
improvements to the authors of those scripts and modules. 

Indeed, a search on SF got me only
http://sourceforge.net/projects/programanalyzer/ which is supposed to
analyse Java when they get around to releasing some code, and CCCC
(http://freshmeat.net/projects/cccc/?topic_id=45)
which has a vitality rating of 0.02% (Rank 3344)

I also found Module::Dependency on CPAN but, although this does give some
indication of dependency, doesn't give metrics on how well the code is
written and uses a fairly crude albeit effective method of searching for
'require' and 'use' strings to create its database.

I figure that to fully work out the coupling between modules, the degree to
which global variables are shared must be taken into account,
Module::Dependency can't do this.

I also figure that pretty much the only thing I have seen that would track
dependencies to this degree would be the pre-compile classes, B.

Adrian Masters mentioned the right place to start might be a Perl Parser,
well I found a Pod::Parser
(http://search.cpan.org/doc/BRADAPP/PodParser-1.18/lib/Pod/Parser.pm)
so that might help. He also mentioned the profilers such as
Devel::Cover,Devel::Coverage and Devel::DProf, Devel::SmallProf.

Because laziness and hubris encourages us to not reinvent the wheel I'd much
rather use (or improve on) someone else's work than start coding myself.

Can anyone further my research on this?

Thanks guys,
Regards,   M.

Thanks,
   Martin

=====
--
Martin.Cleaver at BCS.org.uk (please don't reply to @yahoo)

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts http://uk.my.yahoo.com



More information about the Melbourne-pm mailing list