Coldfusion and the art of Object-Oriented Fu

Feb 19, 2009

I've picked up a small Coldfusion project this weekend and have been spending my evenings working on that. After spending so mcuh time away it's really great to come back to my first love: Coldfusion. I'm my time spent learning and dealing with other technologies (Java & EJB's, in particular) I've picked up a good bit of object oriented concepts but I still feel that OOP in Coldfusion still doesn't "click" and it's especially evident as I have come back to CF with this project. I get the concepts but I'm still at a loss when it comes to combining them all into something that adds value to my work. I could blindly start forcing everything into objects and messing around with DAO's and gateways but that seems counter productive to me. Especially when this project is so small and the tools that I developed years ago do the job just fine. While thinking about all this I was reminded of the excellent OOPhoto application put together by Ben Nadel. So I've been re-reading it in it's entirety and it's great to have someone else explore and articulate the same problems that have been filling my brain this past week.

My ideal solution would be to completely scrap my current application framework and move over to a ColdBox, ColdSpring, Transfer solution, but as we all know life is rarely ideal. And I really want to understand exacty what these frameworks are providing for me. Due to time constraints with this project I have come to a compromise (generally following Ben Nadel's first few steps, except lacking the actual entity objects) and I'm finding a few places to refactor and improve old code:

  1. Move all queries / database calls into separate service cfc's for each "object".
  2. Build a BaseService object to contain global functions.
  3. Build a nifty "ServiceFactory" to create the service objects and inject DB initialization info.

I realize that this could hardly even be considered a baby step in the direct of OOP but despite these limitations I'm quite happy with what I've refactored on this project. I no longer have to deal with updating SQL in many different places in my code. Each "thing" that I'm dealing with has it's own service to consume and I'm pushing more and more business logic into them. I really feel like I have to start somewhere and this is a quick way providing some immediate benefit.

My biggest questions right now are focusing around the "why's" of OOP. What sort of things can provide the most benefit to my CF apps without introducing bloat or complexity in the name of being pure OOP? Once again I'm finding the CF community an invaluable source of information. Thanks everyone! I'm definately going to be thinking about and developing my ideas on this subject in the coming weeks so any comments anyone may have are welcome!

Delicious Cake

Feb 10, 2009

I've spent this past weekend buried in the CakePHP documentation. There's some truely great documentation there, some of the best I've ever seen for an open source project (barring ColdBox of course) . A majority of my questions were answered easily and really felt like the docs gave me a handle on the framework while keeping my interest by allowing me to "accomplish" small tasks. It takes a lot of hard work to present things in a way that can easily bring new comers to an understanding of your project. I also loved the examples included in the documentation. I went from the 15 minute blog demonstration and a feeling of accomplishment (getting something, ANYTHING to work) to understanding exactly how things worked (API). I think that's the key thing here. The sheer volume of information without context provided in Java type documentation seems insurmountable when first attempting get a handle on an application and for many projects that's all a newbie is given to start developing. Don't get me wrong, JavaDocs and API documentation do indeed satisfy my need for deep and very complete information but only when I'm comfortable with an application. However, when I'm first starting out, hand holding is key. I've found that even the default Rails docs (wiki) are very confusing. Rails didn't start making sense for me until I when out and purchased a book. I guess my whole point here is that is very refreshing to find a software project that provides enough properly laid out documentation for a newbie to start without purchasing a how-to book.

I'm happy to report that after a few hours of coding I've (somewhat) easily converted my latest web project, webbandwebb.net to run on CakePHP. Granted, this was simple templating and page work but I'm happy with my progress so far. My next goals are to get some actual dynamic sections of the website setup and running. My other goal is to get some blog posts up detailing the small issues that I encountered switching over from pure xhtml to running on CakePHP with templates.

Re-Launched WebbandWebb.net

Feb 05, 2009

Today I finished up the main design of webbandwebb.net and finally replaced their old site which, though well intentioned, was attrocious. It really felt good to get back into the swing of things. Since my focus lately has been on coding enterprise applications I've been forced to use the graphics and styles handed down by marketing. Generally, that isn't a bad thing (that's what marketing does best - design things that look pretty) but it certainly was fun to flex my old graphics muscles and get back into being a bit creative. The other reason I'm excited about this website is because it's for my in-laws. They're great people who do tremendous work building cedar log homes (you should check out their work some time </shameless plug>) and they really deserved a great site that would show off their work.

The site isn't done yet either. When I first started this project I was working under the assumption that they had only a very basic hosting plan (I should know better than to accept technology information from non-techincal people without some scrutiny) so I happily designed in HTML, CSS, and javascript. Talking to their host today I learned that they, in-fact, have a php hosting plan with MySQL. The new plan is to upgrade the site into using PHP and provide some much needed self-update ability for the users (my non-techincal in-laws).

My question to anyone out there is this? Being relatively naive to the modern world of PHP (frameworks, coding standards, etc). Which framework would you recommend to someone who has an extensive ColdFusion background, a fairly new set of Java skills, years of experience in XHTML/CSS/JS and little to no experience in PHP? Currently I'm examining CakePHP and I like what I'm reading so far.

About

Dan Miller: Agile coder, Coldfusion junkie, Java padawan, Rails regular and all around great guy.

-Not sold in stores.
-Beware of Danfusion imitators.

Twitter

Categories

Monthly Archives

Blogs I Read

Feeds