Home All Groups Group Topic Archive Search About

Shared/Static methods & functions

Author
13 Jan 2005 1:18 AM
MPF
When designing a n-tier architecture, what is the preferred method/function
accessibility?
<Specifically for asp.net apps>
A private constructor and shared/static methods & functions?
A public constructor and non-shared/static methods & functions?

Are there any drawbacks with regards to performance with either model?

Thanks,

Morgan

Author
13 Jan 2005 11:35 AM
Dmitriy Lapshin [C# / .NET MVP]
Hi,

> A private constructor and shared/static methods & functions?

This approach (and the Singleton design pattern) are good for objects who
should have only one instance. These include various facades, utility
classes etc.

> A public constructor and non-shared/static methods & functions?

This approach is recommended for classes representing business entities,
where there can be an arbitrary number of instances.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Show quote
"MPF" <a***@senditon.com> wrote in message
news:OPl9R2Q%23EHA.3840@tk2msftngp13.phx.gbl...
> When designing a n-tier architecture, what is the preferred
> method/function accessibility?
> <Specifically for asp.net apps>
> A private constructor and shared/static methods & functions?
> A public constructor and non-shared/static methods & functions?
>
> Are there any drawbacks with regards to performance with either model?
>
> Thanks,
>
> Morgan
>
>
>
>
Author
13 Jan 2005 2:07 PM
Morgan
Thanks for the clarification.

Show quote
"Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.com> wrote
in message news:%232siPQW%23EHA.1084@tk2msftngp13.phx.gbl...
> Hi,
>
>> A private constructor and shared/static methods & functions?
>
> This approach (and the Singleton design pattern) are good for objects who
> should have only one instance. These include various facades, utility
> classes etc.
>
>> A public constructor and non-shared/static methods & functions?
>
> This approach is recommended for classes representing business entities,
> where there can be an arbitrary number of instances.
>
> --
> Sincerely,
> Dmitriy Lapshin [C# / .NET MVP]
> Bring the power of unit testing to the VS .NET IDE today!
> http://www.x-unity.net/teststudio.aspx
>
> "MPF" <a***@senditon.com> wrote in message
> news:OPl9R2Q%23EHA.3840@tk2msftngp13.phx.gbl...
>> When designing a n-tier architecture, what is the preferred
>> method/function accessibility?
>> <Specifically for asp.net apps>
>> A private constructor and shared/static methods & functions?
>> A public constructor and non-shared/static methods & functions?
>>
>> Are there any drawbacks with regards to performance with either model?
>>
>> Thanks,
>>
>> Morgan
>>
>>
>>
>>
>

AddThis Social Bookmark Button