Holger's Thoughts on Delphi

Sunday, December 25, 2005

ECO: Custom Fun

Design-time and run-time: Both working fine. This is the first time, I've tried to build my own operations. As you can see in the following screenshot, my additional OCL methods are getting more complex by the minute. At first I used no parameters for the methods "getAgeInYears" and "getAgeInDays". Both methods calculate the current (in relation to today) age for a person's birthday.

However, the method "getDiffToDate" (which I might have to rename as the name is not that good...) has two additional parameters. If you e.g. want to get the difference of two dates in days you'd write:
  • myDate.getDiffToDate( otherDate, 'd' )

The 'd' specifies days. You could also use 'm' or 'y'. I think it is pretty obvious which result that would yield. 'm' will return the difference in months and 'y' will do the same in number of years.

Now, the possibilities with ECO are really infinite. Just consider that you can build customized OCL operations for your customers. It really improves the structure of your code.



(Thanks to my friend Jim for his help to improve grammar, structure and spelling in my posts!)

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home