M
mavrick_101
Hi,
I'm writing an application for clubs. So I make a class called 'ClubsCS'.
Ideally I want to write a contructor where I would provide the ClubId and all
the related fields will be updated for that club, like club name, club
members, club flag etc. So I can use club properties for these attributes.
Would it be wise to have the same class provide functionality to add a new
Club? But if I write another contructor with no ClubId, would that be
confusing for other developers who may want to use the class. What if they
instantiate the class with a contructor with no clubid and expect to use the
club properties like clubName?
What would be a good design? should the same class provide functionality to
add new club and at the same time if the user provides a club id then provide
all the club properties? or should I write two sepearte classes each to serve
just one purpose?
Thanks
I'm writing an application for clubs. So I make a class called 'ClubsCS'.
Ideally I want to write a contructor where I would provide the ClubId and all
the related fields will be updated for that club, like club name, club
members, club flag etc. So I can use club properties for these attributes.
Would it be wise to have the same class provide functionality to add a new
Club? But if I write another contructor with no ClubId, would that be
confusing for other developers who may want to use the class. What if they
instantiate the class with a contructor with no clubid and expect to use the
club properties like clubName?
What would be a good design? should the same class provide functionality to
add new club and at the same time if the user provides a club id then provide
all the club properties? or should I write two sepearte classes each to serve
just one purpose?
Thanks