Monday, May 29, 2006

A case against DAOs?

Ok, maybe the title is a little provocative, but here is the thought. 100% of the work that I do, plan to do, and have done in the past have dictated the database to be used. A lot of CF devs are pushing the use of DAOs as a way to encapsulate the interaction between their business objects and the database. The argument goes that it's easier to swap out the database, roll a new set of DAOs and you're back in business.

For some projects this is probably true, especially when you need your project to support multiple databases (MSSQL, ORACLE, etc.) out of the gate. You let the user/administrator set a switch for the type of db and the code is already in place. This makes a lot of sense when you are building an application that you plan on distributing.

For the type of work that I do, this looks like a lot of extra work for little or no gain when the db choice is stable and your app has little chance of seeing any kind of distribution.

For me, just adding the CRUDS (create, read, update, delete, save) methods to the business objects themselves seems to work just fine and reduces the size of the app. As long as they are done consistantly and in roughly the same place, I don't really see a down side. If you found that you had to change to support multiple dbs down the road, it's not really that much trouble to strip the functions out and set up DAOs if needed, although it's a little more work than if you had set it up that way from the beginning.

Is this too short-sighted?

Some new blogs

I started a few new blogs to segregate some of my postings. Now that I'm doing more work with Flex (and have a lot more questions than answers), I put up FlexFactory. I plan on putting my posts about Flex and ColdFusion that interacts with Flex there since they may contradict some of the stuff I do with CF alone. There isn't much there yet, but I imagine that eventually, it will become the blog that I post on most, although I am still working on doing more with CF. I'm currently working on building out a library of collaboration patterns for cfcs, but I've got a lot of work to do with that yet. (I'm not sold on the idea completely myself yet).

I'm a huge movie fan, so just for fun, I put up Drive-in Movies. I do short little movie reviews there just as an experiment to see if I want to do more. I focus mainly on B-movies, but anything is fair game. There are a few other posters on that one, and I'd be happy to open it up to other people that want to try posting a review or two.

Wednesday, May 17, 2006

Bad cfc form?

Is the following code considered bad form?


<cffunction name="init" access="public" output="false" returntype="templateSectionName">
<cfargument name="dsn" required="false" default="#session.managedApp.getDsn()#" type="string" />


How big of a problem is it to violate encapsulation by pulling values in from persistent scopes? Are there varying degrees of acceptability, for example, is it okay to do this hear where I'm just supplying a default value as opposed to using a value in the rest of the component.

Are different scopes more acceptable than others for doing something like this. I would guess that pulling in a value from the application scope is probably more reliable than pulling something in from the session scope.

The problem I see with the code above is that code that uses this component may be written without defining a datasource directly. In that case the component may still work as long as the user's session is maintained and the ManagedApp component is in good shape in the session scope. The problem that I think this approach introduces is that where this code


<cfargument name="dsn" required="true" type="string" />


fails the first time it's run and fails consistently until corrected, the other method may run fine for quite a while before it fails because a session has timed out. Had the value existed in the application scope, I'd be more inclined to let it slide.

Any thoughts?

Tuesday, May 16, 2006

FB2 and VSS Plugin for Eclipse

I can't seem to get the fantastic VSS Plugin for Eclipse to install on the FlexBuilder stand-alone version. I haven't yet tried it on eclipse with FB installed as a plugin.

Let me know if you've been able to make this work.

SourceForge.net: VSS Plugin for Eclipse

Monday, May 08, 2006

Flex2Beta3 on its way

Looks like the download page has been updated for Beta3. I think we're just waiting for the files to be pushed to the fulfillment server.

Adobe - Downloads