Re: Business objects with no properties and data binding
"Ivanoff, Alex" <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.web |
|---|---|
| Organization | FDTD |
| Message-ID | <[email protected]> |
Properties are not encapsulation. They are syntactical sugar of a language. Getters usually do not change the state of the object. Setters might. For instance, if you want to keep a list of properties that are changed you would have a BitArray which gets updated whenever setters are called. -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Pardee, Roy Sent: Friday, March 02, 2007 14:54 To: [email protected] Subject: Re: [DOTNET-WEB] Business objects with no properties and data binding But isn't hiding the details of how a property getter is implemented encapsulation? Consumer doesn't need to worry about exactly how an object manages to produce the prop value when it's asked--it just knows that it will. I'd be interested to hear about how your object's state changes when your prop getters are called... -----Original Message----- From: Discussion of building .NET applications targeted for the Web [mailto:[email protected]] On Behalf Of Alex Ivanoff Sent: Friday, March 02, 2007 12:32 PM To: [email protected] Subject: Re: [DOTNET-WEB] Business objects with no properties and data binding OO is about encapsulation, polymorphism and inheritance, not properties. On 3/2/07, Pardee, Roy <[email protected]> wrote: > > I thought that was a feature of OO--that you could hide the > implementation of a property from the end-user? > > -----Original Message----- > From: Discussion of building .NET applications targeted for the Web > [mailto:[email protected]] On Behalf Of Ivanoff, Alex > Sent: Friday, March 02, 2007 6:56 AM > To: [email protected] > Subject: Re: [DOTNET-WEB] Business objects with no properties and data > binding > > My original sample was simplified. My real object accessors are more > involved (change object state). Plus, I do not like properties since > they look like fields but behave like methods (Jeffrey Richter > explained it great in his book "CLR via C#"). > > > -----Original Message----- > From: Discussion of building .NET applications targeted for the Web > [mailto:[email protected]] On Behalf Of Paul van Brenk > Sent: Friday, March 02, 2007 03:21 > To: [email protected] > Subject: Re: [DOTNET-WEB] Business objects with no properties and data > binding > > Why are the objects designed this way... just asking, maybe there is > something I'm missing. > > I would do this: > > public class State > { > private String _abbr; > private String _name; > > public String Abbr > { > get{ return this._abbr; } > } > > public String Name > { > get{ return this._name; } > } > } > > -----Original Message----- > From: Discussion of building .NET applications targeted for the Web > [mailto:[email protected]] On Behalf Of Alex Ivanoff > Sent: Thursday, March 01, 2007 22:20 > To: [email protected] > Subject: [DOTNET-WEB] Business objects with no properties and data > binding > > Is it possible to data bind a web control (DropDownList) to a list of > business objects which do not have properties but accessor methods > instead: > > public class State > { > private String _abbr; > private String _name; > > public String GetAbbr() > { > return this._abbr; > } > > public String GetName() > { > return this._name; > } > } > > Thank you, > Alex > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor. http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > > View archives and manage your subscription(s) at > http://discuss.develop.com > =================================== This list is hosted by DevelopMentor http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor. http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com