ryan
05/02/2022, 8:03 PMbendur
05/02/2022, 8:03 PMbendur
05/02/2022, 8:05 PMwil-shiftinsert
05/02/2022, 8:08 PMScott Bennett
05/02/2022, 8:08 PMryan
05/02/2022, 8:12 PMfoundeo
wil-shiftinsert
05/02/2022, 8:17 PMryan
05/02/2022, 8:17 PMScott Bennett
05/02/2022, 8:19 PMwil-shiftinsert
05/02/2022, 8:19 PMScott Bennett
05/02/2022, 8:19 PMryan
05/02/2022, 8:19 PMwil-shiftinsert
05/02/2022, 8:20 PMScott Bennett
05/02/2022, 8:20 PMryan
05/02/2022, 8:20 PMScott Bennett
05/02/2022, 8:20 PMwil-shiftinsert
05/02/2022, 8:21 PMryan
05/02/2022, 8:22 PMwil-shiftinsert
05/02/2022, 8:22 PMwil-shiftinsert
05/02/2022, 8:26 PMryan
05/02/2022, 8:29 PMAdam Cameron
<cfquery>
(or: yikes inventing a <cf_query>
custom tag!) is the best place to deal with this.
You ought to have some manner of DB abstraction layer between your business logic tier and the storage tier (for brevity's sake, let's call your storage tier classes DAOs). Your storage tier just has methods that pass params to <cfquery>
calls. Your business tier talks in domain objects to a repo; your repo deals with the mapping between domain objects and values for the storage tier (so the methods with the <cfquery>
calls are pretty dumb.
If you have that, it would be trivial to implement a decorated DAO which is itself initialised with a collection of actual DAOs that are configured with each different DB connection you need. This decorated DAO iterates over its DAO collection, calling the same method/values on each. Job done.
The business tier doesn't need to know anything about this. Even the repo doesn't need to know: it still thinks it's got a DAO. The DAOs themselves don't need to know. All you need to change is initialising the repo with the "multi-DB-DAO", and... it just works.
It also keeps your concerns well separated and well defined.Adam Cameron
ryan
05/02/2022, 11:48 PMAdam Cameron
Adam Cameron
Adam Cameron
Adam Cameron
ryan
05/03/2022, 12:37 AMwil-shiftinsert
05/03/2022, 8:18 AMwil-shiftinsert
05/03/2022, 8:21 AMAdam Cameron
Customers wanting a well designed solution instead of a quick solution.This is - often - a red herring. The customers don't know how long things take, and they can seldom understand the lack of correlation between how quick something is to say, compared to how long it takes to do. However they are almost always prepared to take our guidance when saying "that's more work that it might sound, but def doable". They rely on us to tell them how long something will take, and the cost it will be to them. If you say something with take x time, they will go "yeah OK", or "actually screw it, it's not that important". They won't second-guess the nature of the work involved to deliver the solution. That's your job. It's almost always the developer screwing themselves out of the opportunity to do their jobs well. It's up to us as developers to provide professional level services to our clients; and this includes thoughtful design, testing, etc.
ryan
05/03/2022, 3:30 PMAdam Cameron
ryan
05/03/2022, 4:57 PMJonas Eriksson
05/06/2022, 9:21 AM