complexvariables / conformalmapping

Conformal mapping toolkit for MATLAB
Other
11 stars 9 forks source link

Naming of classes line, circle, polygon, etc. #52

Open tobydriscoll opened 9 years ago

tobydriscoll commented 9 years ago

There is some reason for caution when it comes to the classes line, circle, disk, polygon, and ellipse, namely that these are very common and generic names that easily clash with user choices. The options I see are:

  1. Ignore the problem. Except that you really can't with line, because that's a built-in.
  2. Put closedcurve and region classes in the +cmt naming scheme.
  3. Prefix these class names with a "z" (as in complex).

My approach in the early version was to use number 3 with the line class only, and leave the others naked.

ehkropf commented 9 years ago

I think we should use a combination of 1 and 3. Since line is a not-uncommonly used graphics built-in, sticking with zline make more sense.

On the other hand, given someone is using the toolkit, classes like disk, polygon, and ellipse make sense to have handy. Simpler names are better from a user perspective, and if someone is using this toolkit they either will not have these geometric primitives or if they do will probably have enough knowledge to be able to work around the names without bother.

I think we should leave the cmt namespace for things used mainly internally by the toolkit itself. Again, for user simplicity, common classes should be as exposed as possible. (At least for a matlab implementation. If we were doing this in another language, e.g. Python, my argument would be completely different.)

tobydriscoll commented 9 years ago

I don't know...I'm getting less happy as I go. I'm up to zline, zgrid, zrectangle, and zbox so far. Ugly. I suppose there's option

3a. Prefix everything with 'cmt' or just 'cm'.

ehkropf commented 9 years ago

Ugh, I see, matlab toolbox function name clashes.

I hesitate to use the 'cm' prefix, but I guess it's no worse than 'z'. Other than 'z' indicates a "complex number" version, or something special, but then why not do all of the basic boundary/region classes like this? Having said that, 'cm' also denotes something special, but then its between cmline and zline. How do we feel about the following on the command line:

cmrectangle
cmgrid
cmbox

I could live with these. But then do we also prefix map class names? If not, why would they be special?

But the alternative, putting disk, polygon, ellipse and friends in the cmt namespace seems worse. Because then why don't we put map names in the same namespace? (I have no good solution here yet, just thinking out loud.)

tobydriscoll commented 9 years ago

No resolution yet, but the cmt. namespace is probably just too clunky to contemplate.

Here's a kind of logic. Geometric objects, which could be 2D real or complex, will all get the z prefix. Nothing else needs it. (?)

ehkropf commented 9 years ago

I can buy into that scheme. The consistency it applies to geometric objects makes sense.

Though are we classing only closed curves as 2d objects or do region objets fall into this category as well? We have disk as a region, which would then be zdisk. But we also have circleRegion. Should it then be zCircleRegion?