I've been thinking about creating a class that handles importing and exporting of data, and I feel that naming it FooImporterExporter might look too long, I wan't to see if there's a name convention that I could use to name it.

These are some of the names I think would be appropriate:

  • FooProcessor
  • FooPorter / FooPort - ( as Import/Export comes from trading goods in a Port )
  • FooTrader
  • 6
    You should consider creating two classes, one that does exporting and one that does importing. – Blrfl Apr 23 '13 at 19:53
  • 1
    Long names that make sense (within reason) are better than cryptic abbreviations – Dan Pichelman Apr 23 '13 at 19:56
  • Doing 2 clases for seems another good option as well. However, in many core clases for languages you have IO (input/output). That was my reasoning behind the question too. – adantj Apr 23 '13 at 20:06
  • @adantj then follow the convention of that language. In Java, there is BufferedReader and BufferedWriter as different things, and this is followed reasonably consistently. More languages than not seem to follow this pattern. If there is a language that doesn't that you are writing in, please tag it appropriately so that people know to follow those conventions instead. – user40980 Apr 23 '13 at 22:18
  • 1
    I think the number of classes you write depends on the nature of the import and export operations. If importing is reading standard file formats and exporting is writing reports in standard formats, then yes, separate classes make sense. If import and export are custom object serialization operations (from and to JSON, for example), then there is tight coupling between the data format and the object state, so centralizing that knowledge into a single class might be preferable. – Randall Cook Apr 24 '13 at 0:16

The name of the class should make the responsibility of that class obvious. FooProcessor is ambiguous; FooPorter and FooTrader are each a cute play on words.

FooImporterExporter tells the reader exactly what the class does, it imports and exports Foos.

Having said that, you really should split it into two class, FooImporter and FooExporter. The reason it is a pattern that Java and other languages follow is because they are respecting Single Responsibility Principle.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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