Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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
share|improve this question
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. –  MichaelT 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
add comment

1 Answer 1

up vote 2 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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