Class Design Question



I have a class which holds key-value pairs where the keys are common
Windows file extensions and the values are associated file content
descriptions (for each extension).

This class has a method which gets a value given a key.

e.g.:

class FileDescriptionTable {
public void Get(string fileExtension) {
return GetDescription(fileExtension);
}
}

I was considering changing it so that, instead of taking a key (a file
extension), it takes a full file name, and determines the extension itself
(by making a routine call):

class FileDescriptionTable {
public void Get(string fileName) {
return GetDescription(FileUtility.GetExtension(fileName));
}
}

Is this a good idea, or would it give FileDescriptionTable too much
responsibility? I can't quite decide.
.



Relevant Pages

  • Re: Common Dialog - Change file extension
    ... VB's dialog (in fact no common dialog) provides this ... In order to change the extension you have to: ... - send a message to the control to extract the current text in the filename ... the 'Save as type' combobox in the Common Dialog Control. ...
    (microsoft.public.vb.general.discussion)
  • Re: Flame Bait! Windows vs: The Unices
    ... > the existence of Word. ... WordStar might have used .doc way back then?) ... Even then it was a common enough extension that there ...
    (comp.programming)
  • Re: Interpretion of file name suffixes
    ... > fortran include files. ... Some C programmers use *.h as the extension. ... my include files were almost invariably for common blocks. ... I switched to .inc as the extension. ...
    (comp.lang.fortran)
  • Re: save attribute for module variables
    ... like variables in common blocks. ... > of extension of Fortran, which is supported by a lot of vendor compilers. ... they are more so than variables in common. ...
    (comp.lang.fortran)
  • Re: Fortran Standard question: COMMON, SAVE and EQUIVALENCE
    ... of the sequence resulting from equivalence association." ... the common block but not really x. ... The extension is 49 storage units. ...
    (comp.lang.fortran)