Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Classes aren't named consistently #921

Closed
kain88-de opened this issue Aug 1, 2016 · 14 comments
Closed

Base Classes aren't named consistently #921

kain88-de opened this issue Aug 1, 2016 · 14 comments
Assignees
Labels

Comments

@kain88-de
Copy link
Member

There is AnalysisBase, Reader, ProtoReader and I'm sure some that I forgot in the topology system and other places. Almost pure Abstract classes like AnalysisBase should follow a consistent naming scheme.

Personally I would like BaseXXX because my fingers always want to type it this pattern but XXXBase is just as fine.

List of abstract base classes

  • AnalysisBase
  • ProtoReader
  • Reader
@richardjgowers
Copy link
Member

Yeah a good point while we can still change these things. It is worth remembering that these all live in a base submodule, but coordinates.base.ReaderBase seems like a nice name.

ProtoReader is just an intermediate subclass which we could probably squash out of existence..

@jbarnoud
Copy link
Contributor

jbarnoud commented Aug 3, 2016

Being all in a base.py file, couldn't we just remove the Base part of the name? I prefer base.Analysis rather than base.AnalysisBase that feels redundant. Just a thought, though.

@jdetle
Copy link
Contributor

jdetle commented Aug 3, 2016

I move to upgrade Jonathan's thought to a good suggestion.

@richardjgowers
Copy link
Member

@jbarnoud I did think the same, but we should probably make the Bases available from the module (not submodule) so coordinates.ReaderBase == coordinates.base.ReaderBase. And second, once things get imported around the base submodule gets lost.

@mnmelo
Copy link
Member

mnmelo commented Aug 3, 2016

I came up with the ProtoReader to have a Reader base class without a __del__, for the cases that don't need one, such as the SingleFrameReader.

If we want to do away with ProtoReader and have only a Reader base class we still need a way to disable __del__ where unneeded. A pythonic alternative would be to have the __del__ implemented in a second base class (say, ReaderCleanup) and have individual subclasses that need __del__ inherit from both Reader and ReaderCleanup.

@richardjgowers
Copy link
Member

@mnmelo I'm actually hacking together a Reader that doesn't maintain an open file handle.. so hopefully that whole __del__ issue becomes moot :)

@mnmelo
Copy link
Member

mnmelo commented Aug 3, 2016

@richardjgowers, perfect!

@jbarnoud
Copy link
Contributor

jbarnoud commented Aug 3, 2016

On 03/08/16 19:44, Richard Gowers wrote:

@jbarnoud https://github.com/jbarnoud I did think the same, but we
should probably make the Bases available from the module (not
submodule) so |coordinates.ReaderBase == coordinates.base.ReaderBase|.
And second, once things get imported around the |base| submodule gets
lost.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#921 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUWujP-Dfll8NziDJ2vZC6-iABt8yZkks5qcNNhgaJpZM4JZ1eT.

Good point. You convinced me.

@orbeckst
Copy link
Member

orbeckst commented Aug 7, 2016

I like @richardjgowers's

  • base.ReaderBase
  • base.AnalysisBase
  • base.XxxBase

Slightly preferred over base.BaseXxx just because I like to read more distinguishing information up-front and I find it aesthetically more pleasing in the context of base.. As @jbarnoud #921 (comment) I am also convinced by the argument that it is still necessary to keep Base in the name for when importing from the base module.

@kain88-de
Copy link
Member Author

OK so we keep @richardjgowers proposal. That leaves the second part of the questions. What is a list of all abstract base classes in MDAnalysis. I would also like to use the list to track progress with #919.

@orbeckst
Copy link
Member

orbeckst commented Aug 9, 2016

Base classes:

coordinates

  • coordinates.base.Timestep
  • coordinates.base.IObase
  • coordinates.base.ProtoReader
  • coordinates.base.Reader
  • coordinates.base.SingleFrameReader
  • coordinates.base.Writer

topology

Not sure if the following still exists in #363:

  • topology.base.TopologyReader

selections

  • selections.base.SelectionWriter

analysis

  • analysis.base.AnalysisBase

@orbeckst
Copy link
Member

orbeckst commented Aug 9, 2016

(Did I forget any?)

@richardjgowers
Copy link
Member

So Timestep is fully functional as-is, so isn't really a base like the others (which need to get methods added before use).

@orbeckst TopologyReader still exists and is much the same!

@orbeckst
Copy link
Member

orbeckst commented Sep 9, 2016

@kain88-de you opened this discussion – is there a consensus/conclusion, what are we going to do?

richardjgowers added a commit that referenced this issue Mar 6, 2017
Renamed various base classes:

IObase -> IOBase
Reader -> ReaderBase
SingleFrameReader -> SingleFrameReaderBase
Writer -> WriterBase
SelectionWriter -> SelectionWriterBase
TopologyReader -> TopologyReaderBase
richardjgowers added a commit that referenced this issue Mar 6, 2017
Renamed various base classes:

IObase -> IOBase
Reader -> ReaderBase
SingleFrameReader -> SingleFrameReaderBase
Writer -> WriterBase
SelectionWriter -> SelectionWriterBase
TopologyReader -> TopologyReaderBase
richardjgowers added a commit that referenced this issue Mar 6, 2017
Renamed various base classes:

IObase -> IOBase
Reader -> ReaderBase
SingleFrameReader -> SingleFrameReaderBase
Writer -> WriterBase
SelectionWriter -> SelectionWriterBase
TopologyReader -> TopologyReaderBase
orbeckst pushed a commit that referenced this issue Mar 8, 2017
Renamed various base classes:

IObase -> IOBase
Reader -> ReaderBase
SingleFrameReader -> SingleFrameReaderBase
Writer -> WriterBase
SelectionWriter -> SelectionWriterBase
TopologyReader -> TopologyReaderBase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants