More C# properties

Somebody was kind enough to add a link in comments to Ted Neward’s response to my earlier blog on C# properties. I appreciate Ted’s insights, although I think he missed my point a little. As I said it is good to have properties as a first-class concept. No question there.

I guess what I really was getting at was that it would be nice to use a simple public field as the implementation of a property, even if that property is declared in an interface implemented by the class. This could be changed to the method style property definition, if required, without changing the type’s interface. Maybe that is a little too much syntactic sugar.

With regard to Ted’s position on components v objects, I don’t take such an extreme position as Ted:

First of all, we need to stop thinking about classes and objects–that’s the 90’s way, and it failed. Simply put, thinking in objects is a terrible idea, and it’s only becoming more and more obvious as time goes on.

I remember Betrand Meyer’s description of component software in his 1999 IEEE Software column:

The phrase “objects are dead, long live components,”although a good attention-getter, does not make much sense technically. All the evidence
suggests that successful component technology must build on object orientation. For one thing, no one knows how to build complex, mission-critical software today without the help of OO techniques. But even more importantly, most of the fundamental ideas that define object technology are just as fundamental to any successful component development

Maybe I’ll have to do a bit more reading …

One Reply to “More C# properties”

  1. Hi Conor

    > I guess what I really was getting at was that it would be nice to use a simple public field as the implementation of a property

    FWIW we took this approach with Groovy…

    http://groovy.codehaus.org/beans.html

    i.e. that ‘public/protected fields’ in groovy are really public/protected properties (getters/setters) and fields are always private by default.

Comments are closed.