Re: Is this good use of Properties?
- From: Rick Elbers <rick.elbers@xxxxxxxxx>
- Date: Sat, 14 May 2005 19:36:12 GMT
On Sat, 14 May 2005 14:51:28 GMT, "Bill Butler" <qwerty@xxxxxxxx>
wrote:
>
>"Rick Elbers" <rick.elbers@xxxxxxxxx> wrote in message
>news:bpib811gbr1so3shs9p4dpeudcnjaefcp9@xxxxxxxxxx
>> On Sat, 14 May 2005 01:54:03 GMT, "Bill Butler" <qwerty@xxxxxxxx>
>> wrote:
>>
>> Also I am not any more in the habit of programming for free,
>> nor in the business of programming as a backing of design-heuristic
>> statements nor- and thats most important- in the business of
>> lengthy discusions/arguments. You can try my heuristic in the process
>> of mentoring if you want, or you don't...suite yourself. If you don't
>> do mentoring and you are not a beginner yourself then my heuristic
>> will probably not apply to you.
>>
>
>Listen, we are not trying to get you to give away intellectual property for free.
>We are attempting to understand your assertions.
>It would HELP if you demonstrated with code. (Pseudocode will do)
>
>Do you have any Links you can post that will get across your point?
>Can you list any books that promote your point of view?
>
>...
>
>>>Assuming some class external to string needed to know it's length How would you get it?
>>
>>
>> Thats where my heuristic points! You dont get it is my *short(rude) *
>> answer. Think design Think Encapsulatin and take on the challenge to
>> make your client encapsulate the needed behavior of the client wanting
>> to know lengthy string..
>>
>> Not ment to be stupid ofcourse, ment to put programmer in design frame
>> of mind.
>
>OK, let's expand upon this.
>For the sake of arguement (and there has been a lot of that)
>I NEED to know the length of a string ... No IFS, ANDS, or BUTS about it.
>
>Since the ElbersString class does not expose it's length I have a dilema
>Do I inherit from ElbersString to get at the protected Length?
>Is the length available to subclasses or is it inaccesible to them too?
>Do I perform a foreach on all of the characters of an ElbersString to get the length.?
>Do you call ElbersString.ToCharArray() and then use the length property of the array?
Nice but no tx about ElbersString...its too lengthy:-)
Lets for the sake of argument say I am programmer of the .net
framework team for version 3.0 and we are at this moment just
reviewing features of the framework. The string class has no problems.
It's practically exactly the c++ string class from the stl. NP there.
Do you know that only 10% of programmers are writing business
framework code ? That those are the most experienced in the field.
Do you know that only 1% of programmers write widely published
framework code ? That those are probably the best or most experienced
in the world, or should be ?
Therefore to test some heuristic for learning OO on the hypotheses
that a beginner is writing instead of using stringclass is not sane
imho.
>...
>>>
>>>----------------------
>>>Simple example
>>>I read in a string from a file (I don't control the format).
>>>I need to send it across the pipe to another process (I don't control the format)..
>>>The other process is expecting it in this format
>>> NNstring
>>>where NN is the 2 digit length.
>>>anything over 99 characters is truncated to 99 characters
>>> so
>>>"QWERTY" would be 06QWERTY
>>>"Happy Birthday" would be 14Happy Birthday
>>>
>>>I would do something like this
>>>
>>
>> Oke stop there!
>> You have a kind of file! why would you want to send it anywhere if you
>> know it can't be processed there ? Make either your file check it
>> himself, or change put to pull mechanism and let your client tell the
>> file the format he understands.
>
>This is a third party file. I have no control over it's format.
>The process uses a predefined format that I need to conform to if I am to use it.
>I am tasked with creating a way to join the 2.
>Thus I need to morph the file format to the format that the external process expects.
>
Its a third party file. You have no control over its format. Do you
have control over its parsing ? Yes you have. Do you have control over
its use. Yes you have..The design question is not *if you have to
validate*. I can understand that often we have too. The question is
where !( like always with encaps). As soon as possible would be my
answer. Meaning that there is no publicity about the length and all
other features. Its just your first class encountering the format
which knows everything there is to know to connect the 3d party file
to your own components.
>I cannot realistically ask either of them to change.
>This situalion comes up frequently in my experience.
>
Yes, sure. Its however besides the argument.
>
>I really can't think of many good reasons for NOT exposing the string length
>The only reason that I can think of is that the string is limited to ~4Gig in size.
>In the domain of VERY LARGE strings this is a problem.
>in that case you would need to wrap the length inside a class that represented
>numbers of arbitrary size. This is massive overkill for most strings.
>
The reason is that exposure should be avoided if possible. Exposure !=
Encapsulation. Therefore.
> Thank you
> Bill
>
>
Thanks too,
Rick
.
- References:
- 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?
- 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: Bill Butler
- Re: Is this good use of Properties?
- Prev by Date: Re: string manip
- Next by Date: Re: string manip
- Previous by thread: Re: Is this good use of Properties?
- Next by thread: Re: Is this good use of Properties?
- Index(es):
Relevant Pages
|