Just dropping a quick design question in here, what do you guys implement / prefer, including a beanFactory (di/1 e.g. ) as a dependency in a component for creating (transient) beans or just creating the beans using the fully qualified path (e.g.
new <app>.models.beans.BeanName( args )
)?
e
Evil Ware
10/24/2022, 10:44 AM
I like the path model better than the java "bean" model. It's easier on the eyes, the comma is far too close to the period and it's easy to make a mistake, plus the point of Coldfusion was to move away from the complication of the java language.
a
Adam Cameron
10/24/2022, 11:48 AM
If the object in question (whether it's a "bean" or not) doesn't have any untoward overhead / dependencies on external services / any other considerations that will impact testing efficacy and stability, then I'd say it's OK to create it inline.
Avoiding industry-standard design patterns (nothing to do with Java) is not one of CFML's USPs. That's just something shit CFML devs say to justify writing poorly-designed code. Avoiding design patterns was a legit thing perhaps back in the 90s / early 2000s when websites were mostly myWebPage.cfm being maintained by "the IT guy" [hyuck hyuck hyuck]. But not really viable given most web app requirements these days. Of course "if you wanna do Java just go do Java" is still a mantra we hear from CFMLers who ought to be listed on yer Do Not Hire list. [shrug]
s
satauros
10/24/2022, 11:54 AM
@Adam Cameron your first paragraph answered my question perfectly.