Re: Class design question
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Wed, 26 Apr 2006 13:19:13 GMT
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
.
- References:
- Class design question
- From: sundeep
- Class design question
- Prev by Date: Re: abstract factory -- a doubt ?
- Next by Date: Interface to a file?
- Previous by thread: Class design question
- Next by thread: Re: Class design question
- Index(es):
Relevant Pages
|