As one of the leading "it depends" advocates, let me chime in here...
I come from a C++ / Java background with some Smalltalk (and a myriad
other programming languages, some procedural, some functional, some
declarative - my early career was focused on compiler development and
language design!). When I started in CFML, it was already based on
Java and had components. I naturally followed my experience of using
OO as the "best" way to help solve many problems and when I shared my
thoughts it was from that perspective. I got badly burned! People
simply copied my examples and pasted them into their applications with
no understanding and when I tried to create some simple guidelines I
thought folks would understand, they blindly applied them as inviolate
rules! Argh!
So I pulled the examples out of my guidelines and started to say "it
depends" a lot and then started to push back even more emphatically on
use of the guidelines without understanding. I guess I underestimated
the "level" of development in the CF community because all of my IT
experience up to that point was around Comp Sci people building
systems with a lot of business logic and relatively little data (or,
sometimes, vast swathes of data but again mostly focused on logic to
process said data). In other words, I wasn't used to being around
people who were a) mostly self-taught b) did not have any Comp Sci
background c) dealt primarily with CRUD-based data-centric apps and d)
often knew only one language.
I've had to try to adapt my recommendations to that new world and it's
made me a bit gunshy of sounding too "definitive" about anything.
I sympathize to some extent with Hal's position, especially since he
was previously such an OO advocate in the CFML world as well, but I
think now he's suffering from what I got burned by: folks talking his
words as gospel and believing "OO is bad!" when that isn't really what
he's saying (at least, I *hope* not!). Overall, I'm much more aligned
with Brian's position and I think demonizing his advice and
misrepresenting his ideas and suggestions - however humorously - does
a disservice to CFML developers who genuinely want to learn OO
techniques.
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
event: a new event to be announced such as "customerFormDisplayed"
display: the HTML to be placed on the client "canvas" as well as the
JavaScript needed to respond to user events for this part of the
client "canvas"
build: an array of files used to create the display -- typically a
.cfm file and a .pgm file containing the JS
context: the id of the element into which to place the display
displayAction: should the display replace, append to, or prepend to
the context element?
data: a struct of data that may be needed on the client
timestamp: used for client-side timeouts, polling, etc.
controller: the controller that processed the event. In the case of
one controller calling another, it's the initiating controller
originatingEvent:what event spawned this response?
As to the business logic, placing so much of the interaction on the
client really does simplify the server code. I built a small,
lightweight server framework, although one could easily substitute
ColdBox, Model Glue, Fusebox, Mach-II, etc. Personally, I'm weary of
the front controller pattern.
I've built some pretty sophisticated apps with this and haven't needed
to go deeply into domain modeling. In fact, as I stated, I feel
prohibited from doing deep domain modeling given the problems with OO
in CF.
On Tue, Jul 14, 2009 at 2:22 PM, Adam Presley<ad...@adampresley.com> wrote:
>
> As for AJAX and smaller bites of functionality, sure, no argument
> there. But what then is your approach for managing the business logic,
> domain modeling, and so on for your server side pieces that are used
> by your client side? Are they simply little CFM pages that execute a
> query and transform to JSON? Is there some type of structure you are
> recommending?
>
> Part of the arguments listed had to do with a deficit in strong
> direction from community leaders, with too much OO theory, and "it
> depends" answers. So what strategies should budding CFers look for?
>
> I typically approach OO in CF from the standpoint that I model my
> domain logically and smartly, but try not to overuse where I know CF
> can't handle it. For example, I cannot, due to performance, return an
> array of 1,000 bean objects from a Gateway, when I know that CF will
> choke on it.
Hal Helms
Training, Mentoring, Consulting
Railo apps based on Transfer ORM run up to 10x faster than on CF8 and
I'm seeing people report a similar speed improvement in CF9 Beta (I
generally see Railo running code 3-4x faster than CF8 but
Transfer-based apps are extremely CFC-heavy so the speedup is more
dramatic).
Is an order of magnitude performance boost sufficient to assuage some
of your concerns? If not, what would it take for you to leverage CFCs
more?
--
Sean A Corfield -- (904) 302-SEAN
Railo Technologies US -- http://getrailo.com/
An Architect's View -- http://corfield.org/
Of late, I've been working with Ruby on Rails (Oh, the humanity!) and
I can tell you there's no idea of having to compromise the OO paradigm
because the language does an excellent job of supporting OO. In
fact,in many languages, you can change the language itself, allowing
you to add in the features you need. That's possible exactly BECAUSE
the language really is OO to the core.
Possibly CF9 will solve all problems. I'll...uh...believe it when I see it.
On Tue, Jul 14, 2009 at 3:08 PM, Adam Presley<ad...@adampresley.com> wrote:
> Like you I lean toward Brian's argument. Be smart in your use of the
> methodology. Purists fail to see that not every tool works for every
> job. That goes for OO purists, and old-school CF purists.
On Tue, Jul 14, 2009 at 3:28 PM, Hal Helms<hal....@gmail.com> wrote:
> A couple of years ago, I had a real "Aha!" moment when it dawned on me
> that, due to my own prejudice (for server-side languages and against
> JavaScript), I was missing an opportunity to create much better user
> experiences. So, holding my nose (I REALLY didn't like JavaScript back
> then), I dug into JS until I felt I really knew it. I now really LIKE
> the language. That led me to events and it transformed the way I write
> code. jQuery was really the icing on the cake, making it very easy to
> manipulate the client canvas.
--
Brian,
You inspired me!
http://www.bryantwebconsulting.com/blog/index.cfm/2009/7/17/OO-OI-Oy-Vay
(for those that don't want to read it, I basically offer a definition
for OI and argue that this may be more helpful than the more formal
term "OO").
Thanks,
Steve