Home > Attributes > About Attributes

About Attributes

From 2011 to late in 2013, I worked in Delphi XE, exclusively, and for the last 5 months, I have been working in Delphi 2007. Now, however, I am on the brink of leaping forward to Delphi XE5. Compared to D2007, The changes are very large, indeed:

  • Unicode
  • Generics
  • Attributes
  • Live Bindings

I have already been accustomed to the shift to Unicode, from working in XE. Similarly, I did make use of generics in XE, though not extensively. Attributes and Live Bindings, on the other hand, are uncharted territory.

I expect to dive first into attributes, and suspect they may help me to deal with some currently thorny problems. I say suspect, as I am still mainly scratching my head over how attributes can and should be used. Attributes can be applied to many types in Delphi, as seen in this article. But the mere fact that they can be applied to something does not mean that they should be. My slowly increasing understanding of them–some features simply elude my comprehension for a time, until I see a compelling example, then the light goes on–includes an appreciation of two important considerations:

  1. Making use of attributes requires using RTTI, which brings with it significant performance penalties, so if performance is an issue, it may be best to avoid their use.
  2. Using attributes provides late binding, which in turn means that the compiler cannot protect us from our own stupidity: if we misuse attributes, then we may run afoul of run-time errors.

One challenge is that in numerous examples, all too often the use of the attributes seems to be almost a bit of magic. Not being a fan of clever code, I hope to avoid using them in ways which make the code less comprehensible.

More later, as I find something worth demonstrating in code.

Advertisements
Categories: Attributes
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: