Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

module name: Algorithm::RectanglesContainingDot?

by salva (Abbot)
on Mar 02, 2007 at 18:49 UTC ( #602932=perlquestion: print w/replies, xml ) Need Help??
salva has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I am developing a module that implements an algorithm to search over a set of rectangles which ones contain a given dot. It's usage is like that:
use Algorithm::RectanglesContainingDot; my $alg = Algorithm::RectanglesContainingDot->new; while(<>) { chomp; my ($rect_name, $x0, $y0, $x1, $y1) = split; $alg->add_rectangle($rect_name, $x0, $y0, $x1, $y1); } my @rect1 = $alg->find_rectangles_containing_dot(23.2, 42.5); my @rect2 = $alg->find_rectangles_containing_dot(-12.4, 5.0);
The thing is that I find the name Algorithm::RectanglesContainingDot too long, any suggestion for a better one?

Replies are listed 'Best First'.
Re: module name: Algorithm::RectanglesContainingDot?
by pemungkah (Priest) on Mar 02, 2007 at 19:35 UTC
    Well, let's see.

    Is it a strictly geometric module, a graphics module, or what? This will help constrain the namespace. I'm guessing it's a geometric algorithm, so the Math::Geometry:: namespace is probably appropriate.

    I think you're being overly granular as well. For instance, Math::Geometry::Planar implements isInside() as a method. Is this significantly different than what you're doing? If so, you might want to think about Math::Geometry:: as the namespace, and add a descriptive tag (Math::Geometry::Spherical::RegionSearch). If it's similar ... maybe you just want to use that module instead?

    Algorithm:: as toplevel namespace is probably better applied to modules which provide an abstract way of doing something that doesn't necessarily map into a particular problem space. If this is a truly unique search algorithm, then yes, Algorithm:: is appropriate, especially if it's applicable across a range of different problems; if it's based on a known computer science algorithm, then name it after that (e.g., Graph::Kruskal, which is a specific algorithm for graphs, devised by J. Kruskal - also note: named after the problem space!). If it's your own abstract algorithm, then a more-descriptive name (with perhaps a deeper namespace) would be appropriate (Math::Geometry::PointInRange::DivideAndConquer, making something up at random).

    The general point is that the more constrained you can make your namespace the better; it makes it much easier for people to search for, and easier for them to decide about.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://602932]
Approved by ikegami
[Discipulus]: my father sometimes gives the same result.. good fellow

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2018-02-21 14:02 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (280 votes). Check out past polls.