|
Hi,
I am using structs and am also using property accessors to access those
private member fields... TO me this is a good way of handling them, but I
find alot of people using direct access to the struct memebers, since
structs is just a type similar to a class (with differences I know) why
should I allow direct access like that... I looked at the Size and other
parts on Control etc and I find its the same way by using property
accessors.
Seems to me people think struct = direct access, small, and easy.. Its just
a type like all the rest (except with differences i Know blah blah) but why
why why allow direct access. its just lazyness.. Code it once, and thats it,
where is the saving? I mean if its coded well in the first place then you
dont have to keep engineering it so its not exactly a lot of work to use
those extra lines..
I also find ppl balk at the concept of using parameterized constructors and
methods in a struct, theyre just not thinking .NET , and are thinking the
old way of structs on C. The object is still lightweight even tho there are
methods, properties, and constructors..
I just hate lazy coding.
/End gripe. | |
Share:
|
"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
I am using structs and am also using property accessors to access those private member fields... TO me this is a good way of handling them, but I find alot of people using direct access to the struct memebers, since structs is just a type similar to a class (with differences I know) why should I allow direct access like that... I looked at the Size and other parts on Control etc and I find its the same way by using property accessors.
It really depends on what your doing, when doing quick, dirty interop code,
writing property accessors is usually not important, and is infact a real
waste. However, exposing properties is often the best choice (in some cases
the only choice) to provide a simpler interface for structs that may be
accessed externally. However there is no hard and fast rule that I follow.
Seems to me people think struct = direct access, small, and easy.. Its
just a type like all the rest (except with differences i Know blah blah) but
why why why allow direct access. its just lazyness.. Code it once, and thats
it, where is the saving? I mean if its coded well in the first place then you dont have to keep engineering it so its not exactly a lot of work to use those extra lines..
I also find ppl balk at the concept of using parameterized constructors
and methods in a struct, theyre just not thinking .NET , and are thinking the old way of structs on C. The object is still lightweight even tho there
are methods, properties, and constructors..
I use methods, properties, and constructors where appropriate. I don't break
my back to add property accessors on structs sometimes, if it will just be a
get\set combo wrapped around a field. I would much prefer to see a method on
a struct than a static method that takes a parameter on that struct if at
all possible. I just hate lazy coding.
Don't we all, ;). /End gripe. | | |
No i agree for quicn n dirty stuff but I mean for things that are going to
be used outside like components and user controls..
I seen people write formatting methods when its more sensible to override
ToString in the object and I just think they dont fully understand the
concept of an object. Theyre thinking straight C.
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message
news:Kk5pb.83729$Fm2.63853@attbi_s04... "news.microsoft.com" <di********@discussion.microsoft.com> wrote in
message news:%2****************@tk2msftngp13.phx.gbl... Hi,
I am using structs and am also using property accessors to access
those private member fields... TO me this is a good way of handling them, but
I find alot of people using direct access to the struct memebers, since structs is just a type similar to a class (with differences I know) why should I allow direct access like that... I looked at the Size and other parts on Control etc and I find its the same way by using property accessors.
It really depends on what your doing, when doing quick, dirty interop
code, writing property accessors is usually not important, and is infact a real waste. However, exposing properties is often the best choice (in some
cases the only choice) to provide a simpler interface for structs that may be accessed externally. However there is no hard and fast rule that I follow.
Seems to me people think struct = direct access, small, and easy.. Its just a type like all the rest (except with differences i Know blah blah) but why why why allow direct access. its just lazyness.. Code it once, and thats it, where is the saving? I mean if its coded well in the first place then
you dont have to keep engineering it so its not exactly a lot of work to use those extra lines..
I also find ppl balk at the concept of using parameterized constructors and methods in a struct, theyre just not thinking .NET , and are thinking
the old way of structs on C. The object is still lightweight even tho there are methods, properties, and constructors.. I use methods, properties, and constructors where appropriate. I don't
break my back to add property accessors on structs sometimes, if it will just be
a get\set combo wrapped around a field. I would much prefer to see a method
on a struct than a static method that takes a parameter on that struct if at all possible. I just hate lazy coding. Don't we all, ;). /End gripe.
| | |
"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:e3****************@tk2msftngp13.phx.gbl... No i agree for quicn n dirty stuff but I mean for things that are going to be used outside like components and user controls..
I seen people write formatting methods when its more sensible to override ToString in the object and I just think they dont fully understand the concept of an object. Theyre thinking straight C.
Very probably.
"Daniel O'Connell" <onyxkirx@--NOSPAM--comcast.net> wrote in message news:Kk5pb.83729$Fm2.63853@attbi_s04... "news.microsoft.com" <di********@discussion.microsoft.com> wrote in message news:%2****************@tk2msftngp13.phx.gbl... Hi,
I am using structs and am also using property accessors to access those private member fields... TO me this is a good way of handling them,
but I find alot of people using direct access to the struct memebers, since structs is just a type similar to a class (with differences I know)
why should I allow direct access like that... I looked at the Size and
other parts on Control etc and I find its the same way by using property accessors.
It really depends on what your doing, when doing quick, dirty interop
code, writing property accessors is usually not important, and is infact a
real waste. However, exposing properties is often the best choice (in some cases the only choice) to provide a simpler interface for structs that may be accessed externally. However there is no hard and fast rule that I
follow. Seems to me people think struct = direct access, small, and easy..
Its just a type like all the rest (except with differences i Know blah blah)
but why why why allow direct access. its just lazyness.. Code it once, and
thats it, where is the saving? I mean if its coded well in the first place then you dont have to keep engineering it so its not exactly a lot of work to
use those extra lines..
I also find ppl balk at the concept of using parameterized
constructors and methods in a struct, theyre just not thinking .NET , and are thinking the old way of structs on C. The object is still lightweight even tho
there are methods, properties, and constructors.. I use methods, properties, and constructors where appropriate. I don't break my back to add property accessors on structs sometimes, if it will just
be a get\set combo wrapped around a field. I would much prefer to see a
method on a struct than a static method that takes a parameter on that struct if
at all possible. I just hate lazy coding. Don't we all, ;). /End gripe.
| | |
"news.microsoft.com" <di********@discussion.microsoft.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi,
I am using structs and am also using property accessors to access those private member fields... TO me this is a good way of handling them, but I find alot of people using direct access to the struct memebers, since structs is just a type similar to a class (with differences I know) why should I allow direct access like that... I looked at the Size and other parts on Control etc and I find its the same way by using property accessors.
Seems to me people think struct = direct access, small, and easy.. Its
just a type like all the rest (except with differences i Know blah blah) but
why why why allow direct access. its just lazyness.. Code it once, and thats
it, where is the saving? I mean if its coded well in the first place then you dont have to keep engineering it so its not exactly a lot of work to use those extra lines..
I also find ppl balk at the concept of using parameterized constructors
and methods in a struct, theyre just not thinking .NET , and are thinking the old way of structs on C. The object is still lightweight even tho there
are methods, properties, and constructors..
I just hate lazy coding.
/End gripe.
You've hit the nail on the head with "and are thinking the old way of
structs on C".
Structs and unions are UDT's that predate the OO revolution. People who are
"into" OO will find the defaults associated with structs bothersome, as they
provide no OO benefits. From an OO perspective, struct defaults need a lot
of "fixing", but that's not always the context in which they're used.
--
Peter - [MVP - Academic] | | This discussion thread is closed Replies have been disabled for this discussion. Similar topics
6 posts
views
Thread by James Pascoe |
last post: by
|
5 posts
views
Thread by Paminu |
last post: by
|
10 posts
views
Thread by Angel |
last post: by
|
8 posts
views
Thread by news.microsoft.com |
last post: by
|
5 posts
views
Thread by Bilgehan.Balban |
last post: by
|
61 posts
views
Thread by Marty |
last post: by
|
11 posts
views
Thread by Cliff Martin |
last post: by
|
29 posts
views
Thread by Dom |
last post: by
|
43 posts
views
Thread by JohnQ |
last post: by
| | | | | | | | | | |