× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



They had to do this to reduce the bytecode footprint for
mobile devices (or something like that - after the third go 'round, my
eyes
glazed over and I quit trying).

Ewwww.... :)

Does "myvar = x" really indicate that you
are calling something as well as "setMyvar(x)"?

To my way of thinking (again opinion and style) getter/setter "methods"
are extremely lightweight, where method calls may not be. And why does
it matter if you're calling something or not? Seriously, with a good
optimizing language compiler (c#->IL orJava->ByteCode) and JIT compiler
(IL/ByteCode->machine code) your running code will likely not look
anything like you thought it did anyway. With the language compiler
doing code rewriting, and some inlining and the JIT doing more inlining
and throwing entire hunks of the code away if it knows it's not going to
be used in this invocation.

What I do like is that if I have to add a second parameter to the
setter, I already have the code in place and I just have to add
the variable, whereas if I have to change the
"myvar = x" syntax, it's more of a change.

OK, so actually, "setter" and "getter" are a convention thing in Java,
not a language thing? Correct? Does Java have "properties" as part of
the language spec?

In the .net mvar=x syntax there is _no way_ you could add a second parm
to a setter or getter. The getter returns a T and takes no parms and the
setter returning nothing and takes a T where T is the property type
(string, int, Object, etc.). And you don't actually ever see those parms
in the code.

String FirstName {
Get {return _firstName;}
Set {_firstName = value;}
}

Is the property FirstName in c#. The "value" in the setter is a reserved
word that stands in for the input parm to the setter. And you could, of
course, leave out the get or set line to have a write-only or read-only
property.

If you wanted to add a "second" parm to your you're create a method that
did what you wanted.

-Walden


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.