Dave Batton Site Admin

Joined: 14 Sep 2004 Posts: 411 Location: Denver, CO
|
Posted: Sun Feb 26, 2006 11:54 am Post subject: Don't Cheat When Developing Components |
|
|
In many places in the Foundation code I need an empty method (a method with no code) to use as an error handler or as the method to call when a window's close box is clicked. There's a method like this in the General component called Fnd_Gen_DummyMethod, so I've been using that in all of the components.
The problem is that the Fnd_Gen_DummyMethod component is a private component, not a public one. So I shouldn't be using it at all from other components. But some quick testing revealed that I could use it as an error handler and a close box routine because in these instances the method name is always enclosed in quotation marks. Because it's hidden in quotation marks, it's hidden from 4D Insider, so there's no problem installing components with this trick.
Or so I thought. I just discovered that If I move a private project method to the public folder, 4D Insider offers to move some methods around to make sure that public methods call only protected methods, not private ones. And when it does this, it moves my Fnd_Gen_DummyMethod from the General component folders to another component's folder. That's bad, especially if you don't notice that it has done this.
Of course, somewhere in here there's a bug with 4D Insider, but it's not a major one. And the best solution is for me not to use another component's methods improperly just because I can get away with it.
I could move the Fnd_Gen_DummyMethod into the protected folder so it can be called from other components, but I try to avoid creating any protected methods that have no value to the database developer. They just complicate the Explorer window, plus I have to document and support them. So instead there will be a bunch of new dummy methods in the next Foundation release. But fortunately you won't know it unless you examine the source code in the Foundation Construction Set. _________________ Dave Batton
Author of the Foundation Shell |
|