Well actually its currently the former, the caller passes in the temp
directory for the report generator to use. I did it like this because
the report generator is a separate assembly (a class library) so the
caller reads the configured value from the app.config and passes it in
to the library. Is this not the way to go maybe?

On Wed, Jun 9, 2010 at 12:06 PM, David Connors <da...@codify.com> wrote:
> On 9 June 2010 11:59, Bec Carter <bec.usern...@gmail.com> wrote:
>>
>> eg. I have a class which generates reports. Part of the process is to
>> create a directory if it does not already exist. If the create
>> directory  fails several types of exceptions can be thrown like
>> System.UnauthorizedAccessException, DirectoryNotFoundException and so
>> on. Should the caller of this class care about all of these or should
>> they just worry about catching a ReportGenerationException which tells
>> them exactly what went wrong?
>
> In the interests of lower module coupling & abstraction, I would always
> choose the latter. The fact that you need to create directories to do
> whatever is (well, should be I would think) pretty irrelevant to the caller
> (which might be an ASPX or something that wants to show the report to the
> end user).
> In the future you might choose to rewrite your class to work off a DB, cloud
> storage, or something else.
> --
> David Connors (da...@codify.com)
> Software Engineer
> Codify Pty Ltd - www.codify.com
> Phone: +61 (7) 3210 6268 | Facsimile: +61 (7) 3210 6269 | Mobile: +61 417
> 189 363
> V-Card: https://www.codify.com/cards/davidconnors
> Address Info: https://www.codify.com/contact
>
>

Reply via email to