Dec
2007
hey all. i'm back, and i'd like to officially apologize for going all bermuda triangle on you in the middle of the "going OO" series. i'd like to take a few minutes and reflect on some of what happened, because some of it is actually relevant.
first... the non-relevant bits. we moved (again). i thought it would be a fairly easy thing to do this time around... because unlike the last 2 times it wasn't an across country move (from AZ to FL and then from FL to CA). this time it was from CA (southern) to CA (east bay)... but it still really really sucked. it was just a very draining experience (both physically and mentally) and I never ever want to do it again (but i will).
factor in starting the new job (which is going great so far, thankyouverymuch) and i just haven't even had time to keep up with reading blogs, let alone writing an entry.
but things have settled down (somewhat) so i'm going to try and get back into the swing of things.
So the $64,000 question is... where'm i at with all of this OO stuff? hell of a question. sorta wish you hadn't asked. >sigh< but you did, so...
to be perfectly honest, i'm where I was afraid i'd be. i got so hung up on trying to do things "right" that my brain exploded (just a little, i'm ok, thanks for asking). but i did learn something, and i think it's something valuable. i'd love to share it with you.
ready? this is big...
"right" is, in many cases, subjective.
ok so maybe that's not earth shattering news to many of you... but it tripped me up, and it's pretty friggin' important to understand in the world of OO (and other places as well, i figure. like marriage.).
interestingly enough, it wasn't really the OO journey that led me to understand this. oh sure, that sort of planted the seed in my brain (in the part that hadn't yet exploded), but it was actually learning model-glue that got that seed to sprout.
learning model-glue is something that i'm still undertaking for the new job. there's currently not a framework (or anything beyond the most rudimentary of coding standards) in place, and we wanted to change that. for a couple of different reasons (that I may discuss in greater detail in a subsequent post), we chose to pursue model-glue.
so one of my very first assignments on the new job is to learn model-glue. for the most part i think it's going pretty well. i really like the framework, and i've got about 90% of one of our sites re-written in it already. fact of the matter is, though, that 90% of that particular site is just presenting data. it's a marketing web site... not by any means a "web application". i'm now at the 10% that requires little things like database interaction, session management, and the like.
let's focus for the moment on the session management aspect.
after a bit of googling, i came across some sample code that showed one particular implementation of referencing session data in model-glue. the session was referenced directly from a CFC within a controller. was that "right"? one of the first things that I learned about CFCs was that they shouldn't reference outside scopes. yet, it seems to be "right" to reference the session from a CFC within a controller... at least, in this instance.
back to google. hmm... some people use a session façade. sounds interesting... ok i see what they're doing there. so is that the "right" way? and if it is, was the previous way not the right way?
back to google. oops... looks like there are people out there that don't like the session façade. they go about accessing session data a whole 'nother way. is that the "right" way?
my brain started to throb. i knew this feeling. explosion imminent. must stop thinking. i'm feeling like a confused baby bird asking "are you my mother?" (dr. seuss reference).
then it hit me.
in a manner of speaking, they're all "right", aren't they? their applications work (presumably). they understand what they did. more importantly, they understand why they did it that way. what's "wrong" with that?
so for those of you who, like me, have been running around in circles trying to find the ever elusive one "right" way... stop it. just stop. don't make me pull this blog over.
what you need to do is understand the underlying concepts. with that understanding, you can choose the way that works best for you. that particular way might not work for others, but that's ok. as long as you truly understand why you did it that way, and you can justify it (to yourself... not to anybody else unless you choose to engage in that debate), and it works when you run it... then congratulations. you have achieved "right". or at least "right enough"... but sometimes that's gotta be ok.
bottom line? if you want to learn "right", you first have to define "right". you can't possibly do that without understanding the underlying concepts that make up the particular discipline that you're trying to learn.
so i'm going to basically reboot this series. it's not going to be "how to go OO in coldfusion". it's going to be about learning OO. that means starting at the beginning (yes, the first entry in the reboot will likely talk about what an object is... what a class is... etc). i'll tie it into coldfusion when applicable and appropriate (e.g. a CFC is similar to a class... an instance of a CFC is an object... etc). that might be too basic for many of you, but it's where I need to be right now. if that's you, go on ahead. i'll catch up. everybody else... let's try and do this thing once and for all.


Comments
Add Comment | Subscribe to Comments
-
-
-
-
-
-
-
-
-
-
Add Comment# Posted Dan Wilson on 12/6/07 5:48 PM
How 'Right' you are Charlie. The right answer really comes down to which trade-offs you are willing to accept. I touched on this very topic in:
Application Architecture and the Elusive Right Answer (http://www.nodans.com/index.cfm/2007/11/6/Applicat...)
A Right Solution is one that:
Works.
A solution can be academically correct and not function very well
Has Clear Intent.
Can I come back to this code in a year and understand what the intent is?
Is as simple as possible.
simply put, good code is simple.
# Posted Jon Clausen on 12/7/07 11:06 AM
Charlie,
I couldn't agree more. I think a "right" solution is a moving target.
One of my struggles has been that more time I spend trying to understand OO as it relates to Coldfusion, the more time I spend questioning my applications of the principles and practices I've already learned.
At some point, one has to simply choose the best collection of existing best practices for the task/application at hand and move forward with the confidence in your understanding.
If you dont', self-doubt starts to creep in. Inertia is the real danger when that happens.
I look forward to your re-boot of the series.
# Posted Nolan Erck on 12/7/07 1:03 PM
Hear hear! While each "recommended/best practice" has its ups and downs, at the end of the day I'm a big believer in "if it's the right solution for you, then it's right". And I apply that not only in web development (sometimes to the dismay of other engineers) but also to, say, recording music (which i do a fair amount of as well). "Oh you shouldn't use that much compression on drums!" Oh yeah...well, that's the sound I want, so thanks for your input, but I'm going to keep going with what works, thanks. :)
-nolan
# Posted Jim Priest on 12/7/07 2:44 PM
That is one of the biggest hurdles with learning new things in general. Trying to define the 'right' way. I'm struggling with the same thing learning jQuery. There are dozens of ways to do the same thing - which one is correct? Fastest? Least code?
# Posted Jaime Metcher on 12/7/07 3:32 PM
Charlie,
I really think you're on to something with this back to basics idea. I think web programming, and CF in particular, has got to be about the hardest environment in which to learn OO. Picture yourself as a college professor proposing a new course in OO, going to the curriculum committee and saying - "I'm going teach an intro to OO using a stateless client/server distributed transactional multi-language environment. We're going to learn ColdFusion, HTML, Javascript, XML, CSS, SQL, and maybe a bit of Java. Oh, and we're going to take on ORM, design patterns and IOC frameworks while we're at it. Oh, yeah, and the primary language will be one where the OO concepts are entirely optional and many of the important entities aren't objects at all" - you'd be laughed out of town.
Jaime Metcher
# Posted Tony Garcia on 12/7/07 8:35 PM
Hi Charlie,
I can totally relate to what you've gone through, having made the transition to OO myself in the past few months. I almost drove myself nuts trying to figure out the "right" or "best" way to do things -- Googling code samples, online presos, and blogs without even writing a single line of code.
Then my CFUG manager, Brian Rinaldi, basically told me to "just do it" and let me know that, basically, my first few attempts won't be very good. And he was right. Until you just decide to get your hands dirty and dive into actually coding, you'll never figure out what approaches work for you. The bottom line is that one of the best ways to learn is to first make mistakes.
# Posted Peter Bell on 12/8/07 6:36 PM
It really is all about "just doing it". The more OO code you write (as long as you keep thinking and trying new things), the more you'll discover two things:
1. There isn't just one right way.
2. The way you're doing things (whatever it is) is probably wrong :->
Look back at any code you wrote more than 3 months ago. If you can look at it smiling and say "that is great" then either it was very simple code, you're an exceptionally gifted guru who knows everything there is to know about that type of programming, or you've learnt nothing in the last three months!
I lose track of the number of times I've tried different directory structures, coding conventions, design patterns and approaches. As I keep refining my approach, my apps keep getting better and I'm continually factoring in more subtle considerations. "Getting" OO isn't something binary. You don't wake up one morning and "get it". You just keep learning more and more about the drivers for given design decisions, giving you a richer understanding of the toolbox for solving specific problems.
# Posted Tim Davis on 12/9/07 2:17 AM
Thanks for getting back to this OO-get started series! I look forward to reading your views, in you no-nonsense easy to understand style of writing (aka, I don't get it please slow down and explain please approach).
# Posted Fitz on 12/13/07 10:09 AM
Awesome Charlie! Glad to hear your getting back in the mix with the reboot. Looking forward to hearing about your insights and discoveries.
Fitz
# Posted Higgy Asshat on 12/19/07 9:12 PM
Maybe your a writer, not a programmer. Now quit stalling and start coding.