Holger's Thoughts on Delphi

Saturday, July 22, 2006

ECO Pitfalls #1: Synchronize ECO Code on idle

Yes, I like Nick's numbering approach so much, that I will number all my posts that belong into a certain category too.

I will try to deal with common pitfalls that you may encounter when developing ECO applications. As some of you might now, I have been doing some ECO sessions in Germany and from the questions that I got during those, I derive these posts.

This first post will deal with a feature called "Synchronize ECO Code on idle". What does it do? Well, basically it means that ECO generates the code for your model, while you design the model. Meaning: You drop a class on your model surface and the source code immediatelly gets the code for the class. If you remove the class, the source code will lose the class too.

Well, this all sounds very nice and as much as I love ECO in BDS 2006, but from my practical experience - and this is my opinion, nothing more - I have to say:

"Switch it off!"

It won't help, it will make things more complicated. You will run into issues when you rename classes or when you delete classes e.g.

So go to the Tools / Options... dialog and remove the check, so that it is switched off. You will, however, have to generate the code manually. This can be done by the buttons on top of the model view. I always use 'Regenerate ECO code' -never the update one.

Another common misconception is that 'Regenerate code' will delete all the lines of code you added manually to the code, e.g. in the constructor of your classes or to derive attributes. This is wrong. ECO will keep your code. It only touches code it has generated.


Post a Comment

<< Home