1

This is a pretty vague question, but, sometimes, I'm not very good at naming specific tasks, but I know it's very important and I don't want to name it something ungood.

I have the following file structure:

Project/
|-- project/
|   |-- Connection.py
|   |-- ???.py  
|
|-- Tests/
    |-- test_connection.py
    |-- test_???.py

The connection class contains several instance methods, which contain methods, such as upload, download, delete, etc.

I, now, need to apply those methods to specific sets of files. E.G.: read a file, which contains the paths of the files that should be uploaded and use them as arguments to the upload method.

Because of this, I created a class, which is full of static methods, which, e.g., apply methods from Connection several times (e.g., in a loop).

I don't really like having a class full of static methods, but I don't really know what else to do. The other problem is that I don't know how I should name this class. I named it "FileHandler", but I don't really like the name.

Any advice on what I should do? Should I keep the class, do something with it, change the name?

Hopefully, this is the place to post questions like this; if it's not, please tell me and I'll delete the question.

3
  • 1
    It seems what you mean to ask is "What is the name for a class that provides input for another class's methods?" As it is your question is hard to interpret. There is no particular name for a class that prepares calls to methods of another class. This is so common in software, it play on every level. Your upload method will in turn call some I/O API so would also have that preparing role. Jun 25, 2022 at 18:17
  • 1
    "I'm not very good at naming ... and I don't want to name it something ungood" - you mean, you don't want to name it something bad?
    – Steve
    Jun 25, 2022 at 20:18
  • @Steve It's old English, but yeah, something bad
    – YozNacks
    Jun 25, 2022 at 21:15

1 Answer 1

5

Change your perspective.

You keep describing this class based on what happens inside it and what it uses. That point of view creates terrible names.

Instead think about what is using this thing. What need it is fulfilling. Disregard how it accomplishes it’s goal and focus on the goal. Draw your name from that.

Choose your name that way and you can refactor how it works without changing the name. This will make it a powerful abstraction.

2
  • I see your point. The goal of the class is to prepare the data for its calls on the Connection's methods. Would PrepareConnection be good enough? I keep scratching my head, because it still seems to be missing something.
    – YozNacks
    Jun 25, 2022 at 18:36
  • Wait, I know. Since, the [APP_NAME]'s server is the one doing all this connections, I think it should be called [APP_NAME]Server. Sounds good to me anyways.
    – YozNacks
    Jun 25, 2022 at 18:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.