#18529: Topological manifolds: basics
-------------------------------------+-------------------------------------
       Reporter:  egourgoulhon       |        Owner:  egourgoulhon
           Type:  enhancement        |       Status:  needs_info
       Priority:  major              |    Milestone:  sage-7.0
      Component:  geometry           |   Resolution:
       Keywords:  topological        |    Merged in:
  manifolds                          |    Reviewers:  Travis Scrimshaw
        Authors:  Eric Gourgoulhon,  |  Work issues:
  Travis Scrimshaw                   |       Commit:
Report Upstream:  N/A                |  3cd03a48d847e12745ed8c25b23f19db141c179a
         Branch:                     |     Stopgaps:
  public/manifolds/top_manif_basics  |
   Dependencies:  #18175             |
-------------------------------------+-------------------------------------

Comment (by tscrim):

 There are 2 really, really good ideas for having a more complicated class
 hierarchy: encapsulation and localization.

 You had many `if self._manifold is self:` statements, which breaks the
 localization principle; it is acting differently because it is essentially
 a different object. This is a strong code smell and you had enough of
 these at this level to (IMO) warrant splitting the classes.

 Additionally, subsets of a manifold are precisely that, subsets. So we
 should encapsulate that in separate classes. Mathematically we identity an
 open subset as a manifold, but by doing so, we loose the information that
 it is really a subset of another manifold. As such, I feel that having
 separate classes actually better reflects the mathematics.

 In an ideal world, I would like to have a hierarchy similar to Hierachy-2,
 but with an additional subclass corresponding to each type of manifold
 that is obtained by adding a subset mixin class. Yet, that doesn't seem
 possible with the current core design.

 While the Hierarchy-1 seems more complicated, it actually will be easier
 to maintain and debug as code is local to the class (i.e., if you are a
 subclass of `A`, then you act in the same way and like `A` irregardless of
 your input).

 This assessment is based on my experiences and what I learned as good OOP
 principles. However, I have not looked at !SageManifolds beyond this
 ticket at present, whereas you have worked heavily on it. So perhaps we
 can get some more data. How many times before the refactoring did you have
 to do a `self._manifold is self` test? Also what is your thoughts on
 maintenance and extendability?

 Something else might be to get a 3rd party's opinion (Nicolas and/or Darij
 comes to my mind). I could also sit down and plan out how I would do
 everything from the ground up to see if I can devise a better overall
 strategy if you think there might be some benefit to that at this stage.

--
Ticket URL: <http://trac.sagemath.org/ticket/18529#comment:108>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to