Should Optional Method Parameters Be Defaulted To Blank, Or Left Undefined?

Today I offer you a question of preference. Should optional method parameters be defaulted to blank and assumed to exist, or should they only be defined if you intend to use them?

In the name of code reusability I will find myself writing generic service methods such as userService.loadUser() which have a large list of optional parameters such as lastName, firstName, userName, companyID, userID, password etc. I will reuse this method any time I want to load a user or a list of users. The question is this: is it more correct to default all of the arguments or check for their existence?

[More]

CF 9 new cfscript syntax

A couple days ago Ray posted a screen shot from Adam L showing some new cfscript syntax in Bolt. I personally am excited about it. I certainly don't use cfscript for everything I code, but I definitely have gotten to the point where all my business logic is in cfscript. I just think it is cleaner. I have some questions of my own out the new Centaur syntax though. Here is my best stab at what the code in the screen shot looked like:

[More]

New Centuar Features Demoed! ORM, Bolt (IDE), Code Generation, CFScript

I just got out of a session with Jason Delmore talking about some of the new features being looked at in ColdFusion 9. He mostly talked about the ORM features being baked into the next version of ColdFusion courtesy of Hibernate. We also squeezed a few other tidbits of information out of him too.

[More]

LightWire, Constructor Injection, And Inheritance

As we push ahead with our app using ColdBox and LightWire, we have been configuring our Dependency Injection as we go. DI is one of those things I'm pretty certain I see the benefit to, but I'm not sure how sold on it I am. At this point, we may only have 50 to 60 CFCs so perhaps we're just not deep enough in to see the real profit yet. The only real advantage I've seen to date is having all of our dependencies spelled out in one configuration file (with the exception of the stuff you are auto-wiring). Other than that, I don't know that I have really saved any code. That being said, I don't have any circular dependencies, and my dependency levels don't get much more than 2 or 3 levels deep right now so maybe I just need to be patient.

[More]

ActionScript Implicit Getters And Setters Are Growing On Me

Here's a little tidbit that will be old-hat to any Flex/Flash people out there, but as a CF guy, I found it pretty interesting. Most ColdFusion programmers have probably heard of implicit getters and setters as a pattern some have adopted in CFML (and others seem to vehemently oppose). While learning Flex, I have found that ActionScript 3 also supports implicit getting and setting but it means something completely different that what I had expected.

[More]

Do You Know Your OO Acronyms?

Lately I've noticed how impossible it is to talk about Object Oriented Programming without peppering your conversations with scholarly-sounding acronyms. I don't know if we programmers just like to sound smart or if we see it as part of a special club of sorts. As my good friend Anonymous once said, "If it is Computer Oriented and if it doesn't have an Acronym, then it doesn't exist" That being said, here is a list I comprised of acronyms that are related to OO or have come up recently in blogs about OO. See how many you can identify, and comment with any additional ones you think of.

[More]

Design Patterns And Framework We've Chosen: ColdBox, DI, and IBO

Christine and I, having settled into our new jobs, are rolling up our sleeves to dig in and start some hardcore re-factoring. The legacy applications we are dealing with run smoothly and quickly for the most part, but are teetering on the edge of being un-maintainable. They suffer from the standard trademarks of any legacy code which has seen many programmers over the years-- lack of code reuse, absent standards, poorly normalized data structures, and minimal separation of view, business, and data. Don't think I'm knocking it too hard though. It's probably not much different than a lot of the code bases out there. We believe it can be better though. Easier to maintain, understand, and extend. Enter our plan for world domination...

[More]

Flex Has Forced Me To Think Differently About My Code

I have been enjoying my dip into Flex so far. Sometimes you don't notice habits until you have to change them. One rut I've gotten into over the years is the procedural way web-based apps have gotten be thinking about programming.

[More]

ColdFusion's Object Instantiation Penalty: How Bad Is It?

There has been a lot of talk recently about design patterns aimed at circumventing the overhead ColdFusion imposes upon us when creating CFCs. I'm not sure who coined the term "Object Instantiation Penalty", but the first reference to it I can find in the CF community was over at the Dot Matrix blog. Everyone seems to agree that object creation in ColdFusion leaves something to be desired, but I haven't seen anyone really quantify the price yet. I decided some line charts were in order.

[More]

Synthesized Objects

The other day I was writing a wrapper CFC to consume a web service, and return the results. Several of the web services' method returned arrays of structs and I was in the mood to experiment, so I decided to have my CFC present the data back as an array of components. I knew that there would really never be more than 20 or 30 objects coming back so the cost of object instantiation wouldn't be a big deal. There were 7 different "types" of objects coming back in the various method containing mostly strings and an occasional binary image. I didn't want to do all the typing so I decided to toy with Object Synthesization similar to what Peter Bell has been talking about.

[More]

More Entries

BlogCFC (5.9.004) by Ray Camden. Blog Owner: Brad Wood