Like Delphi, Delphi Prism uses a special property keyword to both get and set the values of properties. The read and write keywords are used to get and set the value of the property directly or through an accessor method. For a read-only property, leave out the write portion of the declaration.
Prism also supports a shortcut syntax called implicit fields (known as auto-generated properties in C#):
property CyborgAge: Integer;
You can give properties any visibility you wish (private, protected, etc). It is common in Delphi and Delphi Prism to start member fields with "F" (FCName in our example) and drop the "F" with properties that manage member fields (CyborgName in our example).
FWIW, good points. Nothing wrong with standards. I'll sweep thru and update all these examples. For what it's worth, I agree that private and protected probably could both be camel capped.
Reader...
mtiede
Rank: Cadet 3rd Year Joined: May 2009
Location: Grand Island, NY USA
Says that Properties should be Pascal Case and Protected (non-public?) instance fields should be Camel Case.
So I think in your example, CyborgName should be Pascal, as it is, but the backing field should be fcName or Camel Case.
Admittedly, they DON'T specifically say what to do with PRIVATE instance fields so that muddies the waters. But if the backing fields are Pascal and properties are Pascal, then it gets harder to read the code and tell which is which.
Of course, personally, I think having case sensitivity in a language is dumb and the same thing goes for these kinds of "case conventions".
However, I believe that camel case for the (non-public) fields is the recommendation.
FWIW.
Would you like to comment? Reply? Ask a question? Say thanks?