Design question

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Design question

Fernando Rodriguez
Hi,

        I'm starting a new application that will handle web sites of 2
different kinds: remote sites and local sites. Remote site will be
accessed via http and will have a url, while local ones reside in the
local computer's HD and haven't been uploaded yet. They will have a
path, not a url and will be accesed as set of local files.

How would you design the WebSite classes? Should I have a WebSite
class for the remote ones and a subclass for the LocalWebSite? What
happens with the url aspect that the local one doesn't need?

Thanks


Reply | Threaded
Open this post in threaded view
|

Re: Design question

Schwab,Wilhelm K
Fernando,

> I'm starting a new application that will handle web sites of 2
> different kinds: remote sites and local sites. Remote site will be
> accessed via http and will have a url, while local ones reside in the
> local computer's HD and haven't been uploaded yet. They will have a
> path, not a url and will be accesed as set of local files.
>
> How would you design the WebSite classes? Should I have a WebSite
> class for the remote ones and a subclass for the LocalWebSite? What
> happens with the url aspect that the local one doesn't need?

You could avoid that by having an abstract base class and putting the
URL only in remote subclass.  However, you might be able to get away
with a file:///x:/somewhere/etc/etc/etc/something.youGetTheIdea type of
URL??  Please check the format.

Have a good one,

Bill

--
Wilhelm K. Schwab, Ph.D.
[hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Design question

Chris Uppal-3
In reply to this post by Fernando Rodriguez
Fernando,

> I'm starting a new application that will handle web sites of 2
> different kinds: remote sites and local sites. Remote site will be
> accessed via http and will have a url, while local ones reside in the
> local computer's HD and haven't been uploaded yet. They will have a
> path, not a url and will be accesed as set of local files.
>
> How would you design the WebSite classes? Should I have a WebSite
> class for the remote ones and a subclass for the LocalWebSite?

I think that I'd do one of two things.

If the URL/pathname handling was an essential part of the application, then I'd
probably use URLs throughout, and access the local disk via file: URLs.  That
way there'd would be little or no special code needed to handle the different
cases.

OTOH, if the URL stuff is basically irrelevant (the application is about
handling hierarchically arranged data, and it's only an "accident" that it
happens to be able to access websites as one possible source of that data),
then I think I'd factor out the data-source into a separate object.  The main
application would talk to that object without ever knowing about URLs,
filenames, etc, and I'd have different classes of data-source that accessed the
local disk, website, ftp sites, or whatever.

(Actually, there's not too much difference between the above cases --
considered at a sufficiently high level of abstraction.  The distinction is
really a matter of emphasis rather than reflecting a different separation of
responsibility.)

HTH.

    -- chris