I think components are great for methods that: 1. Rely only on local variables.
2. Are useful everywhere (Generic, Utility etc.) I call mine Core_ 3. If a component method is causing issues. I copy and paste it into the host library fix the issue. ________________________________ From: 4D_Tech <4d_tech-boun...@lists.4d.com> on behalf of David Adams via 4D_Tech <4d_tech@lists.4d.com> Sent: Thursday, April 20, 2017 6:01 AM To: 4D iNug Technical Cc: David Adams Subject: Components: How do you reuse utility code? I try out components every couple of versions and inevitably seem to give up on them. I really like the idea, but am not sold on the implementation. Since other people seem to be using them very happily, I suspect there are some concepts or practices that I'm missing. <rant>It's a complete nightmare that there isn't a clear boundary between host and component. Some things are distinct (variables), some are shared, some are sort of shared (method names). What makes this a nightmare is that *there is no syntax for distinguishing what you're talking about*. A few 4D commands take a * parameter to overcome this very problem, but we have nothing like that. What your code operates on depends on where its located, You really have to keep a lot in your head to predict, understand, and control this.</rant> Anyway, before I sink more time into this, I figured I'd ask for some advice. Here's the deal, I've got a standard module called ErrorStack where I can, well, stack errors. That way you can run a bunch of lines of code without constantly checking for errors - but then go back and check that they were all okay. Nice for handling inputs, etc. If I bake the code into a component and copy the code into the host, it's just a total mess. Unless you duplicate and rename everything, it won't work. If you do duplicate and rename everything, what a hassle. So I'm imagining that I should have something like this: Host.4DB /Components ErrorStack.4dbase MessageHub.4dbase So, Host.4DB and the .4DB/.4DC inside of MessageHub.4dbase would _both_ use ErrorStack.4dbase. Is that the right idea? So, my source for MessageHub would _not_ have the ErrorStack module but would have a copy of the component? Is that the general idea? Does that even work? Is there a better approach? I'd like this to work out and I'm open to reworking and partitioning code a bit to make it happen. But if it's just going to be a long, weird, mess I'd rather know soon so that I can bail and move onto more dignified pursuits. I mean, if I want to screw around all day pointlessly I can always try and get better at configuring Apache... ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html lists.4d.com<http://lists.4d.com/faqnug.html> lists.4d.com Information about the 4D Tech Mailing List <4D_Tech@lists.4D.com>, 4D Biz Mailing List <4d_...@lists.4d.com>, and 4D Pub Mailing List <4d_...@lists.4d.com ... Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com ********************************************************************** ********************************************************************** 4D Internet Users Group (4D iNUG) FAQ: http://lists.4d.com/faqnug.html Archive: http://lists.4d.com/archives.html Options: http://lists.4d.com/mailman/options/4d_tech Unsub: mailto:4d_tech-unsubscr...@lists.4d.com **********************************************************************