Re: Class design question



Responding to Sundeep....

Let me first describe the requirement. I have to design a small system
that should be able to manage websites on a hosting environments. The
tasks that i need to do are
- CreateWebSIte
- DeleteWebSite
- ModifyWebSite
- ChangeIPAdress

Now, I have two options to design the Biz functionlity.

Option 1-
Create a class WebSite as following

Class WebSite
Attributes:
Name
CustomerId
PackageType
.....

Functions
- CreateWebSite
- DeleteWebSite
- ModifyWebSite
- ChangeIPAdress

This is the Holub School of Ill-Conceived OOA/D. Web sites don't build themselves; they are a unique entity that needs to be instantiated. Since they do not exist prior to instantiation, somebody else clearly needs to do that.

Option 1-

Create a class WebSite

Class WebSite
Attributes:
Name
CustomerId
PackageType
.....
Functions
SomeFunctions....


and one class for each reques implementing a common interface

Class RequestCreateWebSite
Functions
...
...


Class RequestDeleteWebSite
Functions
...
...

and so on.

This is closer, but it really represents an interface to the external world. For example, to create a web site one needs to do a whole lot of different things, from creating HTML pages to installing a web server. That will very likely require a number of specialized objects that all collaborate together to create the overall web site in response to an external request to create a web site. IOW, you would need a subsystem to create the web site and that subsystem would have a RequestCreateWebSite interface that would dispatch to the encapsulated objects.

For something less complicated than creating a web site, one would probably employ a "factory" object or one of the GoF construction patterns to encapsulate the rules and policies of instantiation.


*************
There is nothing wrong with me that could
not be cured by a capful of Drano.

H. S. Lahman
hsl@xxxxxxxxxxxxxxxxx
Pathfinder Solutions -- Put MDA to Work
http://www.pathfindermda.com
blog: http://pathfinderpeople.blogs.com/hslahman
(888)OOA-PATH



.



Relevant Pages

  • Re: Bringing out-of-print math books into print
    ... a website or Wiki where consumers of math books could "vote" for which books ... with statistics from MathSciNet showing that matroid theory is thriving; ... Setting up a web site to elicit suggestions for bringing a work back ... effectiveness of producing titles); and it is uncertain how to ...
    (sci.math.research)
  • Re: DNS Internet
    ... www delegation changing to ns415.hostgator.com ns416.hostgator.com ... I can ping ns416.hostgator.com, successfully. ... department agonized wanting to have unfettered access to the web site. ... Are you sayin your website is hosted externally AND internally?? ...
    (microsoft.public.win2000.dns)
  • Re: VS 2008 New Website...create on server?
    ... When you create a website *on a non-standard port*, like 99 instead of 80, ... you need to first create the website manually using the IIS manager. ... at the root level where you are creating the new Web site. ... FrontPage Server Extensions must be enabled for the Web site. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Papajohn, Responsibility and LIES !!!
    ... >> his personal reasons are. ... >> boys are permanently banned from accessing my web site. ... >> papajohn >> who have ... He refers to his website as being a "personal" site, ...
    (microsoft.public.windowsxp.moviemaker)
  • Re: Papajohn, Responsibility and LIES !!!
    ... > boys are permanently banned from accessing my web site. ... > papajohn who ... > The original reason paojon was banned was because I simply did not want ... He refers to his website as being a "personal" site, ...
    (microsoft.public.windowsxp.moviemaker)