Methods vs functions

  • Thread starter Thread starter Stefan
  • Start date Start date
Hello,

Fergus Cooney said:
As I see it, a property (in its simplest form) is just a different
accessor for a field. I don't see fields as methods, and therefore don't see
properties as methods.

100% ACK. Both are used to model "attributes" of an object.
There are those who consider that writing a property that
"takes action" is bad design as they would define "action"
as a side-effect - something not desired in a property.
It depends, of course, on how you define "action." :-)

100% ACK.
Both "procedure" and "method" used to mean a routine that didn't return a
value, ie a Sub, but that distinction has been trampled on, RIP.

;-)

Regards,
Herfried K. Wagner
 
Fergus,
Nothing wrong with it, but native English speaking people often thinks that
the meaning of an English word makes things clear.
I heard that English is a poor language for describing things like my own
native language Dutch.
Why don't you try it to describe it once in a rich language. Lets say
Chinese.
And before you ask it. No I don't know anything about that language.

Cor
 
You two are so clever late in the evening, when Dutch people say "She
doesn't speak languages they mean she speaks only Dutch"
 
Fergus
It was just for fun, but let me say it in other words, there are a lot of
descriptions (not yours) but like the last 2 days when someone did write
"overide", who had the right to decide of the meaning of that word? When
they give another meaning for that word in China so what?
You can say in this program language the meaning of x=...................,
but that is all in my opinion.
Cor
 
Hi Cor,

I understand. You mean she doesn't speak any <additional> languages. Which
is what I would hopefully have realised if my brain wasn't so tired after
clubbing all last night :-)

Regards,
Fergus
 
Fergus,
I'm not going to get into a public debate of something that is largely
academic.

Hope this helps
Jay
 
Herfried,
I'm not going to get into a public debate of something that is largely
academic.

Hope this helps
Jay
 
Hello,

Jay B. Harlow said:
I'm not going to get into a public debate of something that is largely
academic.

OK.

;-)

Regards,
Herfried K. Wagner
 
Should have enabled Option Strict.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit

"Maybe it's a game called 'Punish the User'"
 
Hello,

Tom Spink said:
Indeed I must agree. Unless you are talking about the Get and Set parts of
the property.

I use the terms "method", "property", "event", "attribute" more abstract,
language-, and implementation-independent.
Using a tool like ILDASM or .NET Reflector to disassembly or
decompile an Assembly clearly shows that there are two methods
created, a get_### and set_### (unless of course the property is read-
only or write-only).
ACK.

I'd class the property as an attribute, like you say Herfried, but the code
within the Get and Set blocks as the method part of a property.
ACK.


Totally Agree. Properties shouldn't be used to perform time-consuming
tasks, such as this:

Public ReadOnly Property AskUser() As DialogResult
Get
Return MsgBox("Foo", "Bar")
End Get
End Property

That is BAD.

The sample above is really good. AskUser is an _action_, it should not be
implemented as a property (attribute).
What *I* think is acceptable is something like checking for the
presence of your window handle:

Public Property SubTitle() As String
Get
Return m_Title
End Get
Set (Value As String)
m_Title = Value
If Me.IsHandleCreated Then RepaintMe()
End Set
End Property

ACK. I would accept this as a property too:

\\\
Public ReadOnly Property InstalledFonts() As FontFamily()
Get

' Enumerate fonts and return an array of FontFamily objects.
End Get
End Property
///

Sure, the code performs an action, but this action is transparent to the
user of the class. When implementing something like your 'AskUser' property
as a property, the action is not transparent to the user any more.

Regards,
Herfried K. Wagner
 
Hello,

Cor said:
It was just for fun, but let me say it in other words, there are a lot of
descriptions (not yours) but like the last 2 days when someone did write
"overide", who had the right to decide of the meaning of that word?
When they give another meaning for that word in China so what?
You can say in this program language the meaning of x=...................,
but that is all in my opinion.

That's a problem indeed. There are lots of programmers who are not native
English speakers. These programmers have problems understanding the
keywords, ...

http://brucem.mystarband.net/vbnet.htm

Regards,
Herfried K. Wagner
 
Hello,

Cor said:
You two are so clever late in the evening, when Dutch people
say "She doesn't speak languages they mean she speaks only
Dutch"

That's how I understood it.

;-)

Regards,
Herfried K. Wagner
 
Hi Cor,

|| Why don't you try it to describe it once
|| in a rich language. Lets say Chinese.

LOL

|| I heard that English is a poor language for
|| describing things like my own native language Dutch.

Here, we have two phrases for language that can't be understood. "It's all
Greek, to me", and "He's talking double Dutch" :-) I've looked on the net for
the origin of the phrase but can't find it. It's from the 1870's.

As for native Dutch, I'm pretty sure that it is able to express plenty of
things for which English is inadequate (and likewise for Greek).

Regards
Fergus
 
Hi Tom,

|| What *I* think is acceptable is something like
|| checking for the presence of your window handle:

Indeed, an Enabled/Checked/whatever Property that <didn't> update the GUI
would be pretty useless!

Regards,
Fergus
 
Hi Jay,

|| I'm not going to get into a public debate
|| of something that is largely academic.

A lot of academics would love the chance. :-)

Regards,
Fergus
 
Hi Cor,

|| ... Lets say Chinese. And before you ask it. -
|| No I don't know anything about that language.

There is a strong debate about which language will become the World
Tongue. Many think that it will be (Americanised) English. Certainly in our
current period this looks the most likely.

However, there are an awful lot* of Chinese in the world. And it is a
country that has yet to exert its potential influence in the World arena.
There are plenty of people who think that major shifts are ahead and that
Chinese may well become the dominant language.

One thing's for sure - it's not going to be Cockney, Gaelic or Dutch!!

Forget English, Cor, it's time to start learning Chinese!! ;-)

Regards,
Fergus

* No, this doesn't mean that the Chinese are an "awful lot"!! Lol. That would
be "<is> an awful lot".
 
Hi Cor,

I'm taking it all as fun, I hope you see my responses the same way. :-)

Regards,
Fergus
 
Hi Fergus,
There is a strong debate about which language will become the World
Tongue. Many think that it will be (Americanised) English. Certainly in our
current period this looks the most likely.

Only a minority of the people on the world speaks English as native
language.
I gues when I count maybe maximum 400.000 that is nothing.
And when you think about that the US is the second largest spanish speaking
country in the world mayby even less.
However, there are an awful lot* of Chinese in the world. And it is a
country that has yet to exert its potential influence in the World arena.
There are plenty of people who think that major shifts are ahead and that
Chinese may well become the dominant language.

One thing's for sure - it's not going to be Cockney, Gaelic or Dutch!!
Once it was, but that is 300-200 years ago. Those languages where as
powerfull as now (Americanised) English
And therefore maybe there are so many sentences like "double dutch"," going
dutch" in the English language.

3 Years ago I did eat in a Chinese restaurant in Soho, I was thinking I was
in China, very nice.

Did you know that the main Polish swear words are "Cholera" and "Hollander"
:-)
The Netherlands did not alway be that polite nation like now.Regards,
Cor
 
Hi Herfried,

It was an interesting article. Amongst other conclusions - no doubt the
guy will bounce back and produce Hardcore VB.NET when he's found enough holes
in the Framework.

Shame about the background - it sure did my eyes in!

Regards,
Fergus
 
Back
Top