Re: Is this good use of Properties?
- From: Rick Elbers <rick.elbers@xxxxxxxxx>
- Date: Fri, 13 May 2005 16:15:22 GMT
On Thu, 12 May 2005 21:38:02 +0100, Jon Skeet [C# MVP]
<skeet@xxxxxxxxx> wrote:
>Rick Elbers <rick.elbers@xxxxxxxxx> wrote:
>> I challenge: And it would be nice if you came up with the best
>> practice Pattern example to use Properties instead of telling the
>> world that ensapsulation might be a good idea after all..lol
>
>Sorry, I'm not entirely sure what you're after here. I maintain that:
>
>a) Properties are better than exposing variables directly
>b) Properties are useful in many situations
>
>That doesn't mean they're universally applicable, of course, but then
>no-one said they were.
>
>Out of interest, if you don't think accessors should be used, how would
>you expose the length of a string? Or wouldn't you? What would you use
>instead?
Very good example (of my point). Never expose the length of the string
would be the instantiation of my global advice here. Give me one
reason why you would want to and I show you two why doing it is less
design then not doing it.
Rick
.
- Follow-Ups:
- Re: Is this good use of Properties?
- From: Jon Skeet [C# MVP]
- Re: Is this good use of Properties?
- References:
- Re: Is this good use of Properties?
- From: Rick Elbers
- Re: Is this good use of Properties?
- From: Bill Butler
- Re: Is this good use of Properties?
- From: Rick Elbers
- Re: Is this good use of Properties?
- From: Jon Skeet [C# MVP]
- Re: Is this good use of Properties?
- From: Rick Elbers
- Re: Is this good use of Properties?
- From: Jon Skeet [C# MVP]
- Re: Is this good use of Properties?
- From: Rick Elbers
- Re: Is this good use of Properties?
- From: Jon Skeet [C# MVP]
- Re: Is this good use of Properties?
- From: Rick Elbers
- Re: Is this good use of Properties?
- From: Jon Skeet [C# MVP]
- Re: Is this good use of Properties?
- Prev by Date: Re: How can I randomly pick either 5 or 8??
- Next by Date: Re: how can I get the string representation of an enumeration??
- Previous by thread: Re: Is this good use of Properties?
- Next by thread: Re: Is this good use of Properties?
- Index(es):
Relevant Pages
|