Are you curious about ColdFusion?

Hello, everyone,

I was just perusing Raymond Camden’s blog, and today’s entry was a small blurb about an online presentation that he’s giving, tonight, on ColdFusion.

If you’re interested in ColdFusion, or curious, and if you have time, check it out. It’s only tonight, 17 DEC 14 at 1800 (6pm) Central.

The link is here.

V/r,

:slight_smile:

Oops, just read this today. Is CF still used a lot? We used it years ago (I think right when Macromedia bought it? Is that right?) Anyway, it’s been a long while but I really liked it. It seemed easy. I can only imagine what could be done with it now with all the current technology (jquery et al.) But I don’t hear so much about it anymore.

Amazingly, even though CF provided stiff competition for another Adobe product, Adobe has been improving CF Server since they bought MacroMedia. I am current up to CF10, but CF11 is already out.

CF10 brought massive improvements in security (I haven’t explored half of it), and didn’t deprecate too many tags. Yeah, CF has come a long way from the MM days. And I believe that Ben Forta is still involved, although I don’t know to what extent.

:slight_smile:

I had to use coldfusion in my last job. Hated it. Really don’t understand why people pay for it when they can just use php for free.

What was it about CF that you hated? I’ve been developing CF since 2000, and I absolutely love it.

PHP is nice, I have tutorial knowledge of it, and I’ve played with it quite a bit.

The logic is the same, the only difference is syntax.

V/r,

:slight_smile:

Well it’s been a long time since I used it so lots of it has faded from memory now.

But it was little things like indexes starting from 1 instead of 0, and it being more difficult to find documentation on just writing code rather than using the strange xml format, also the fact that it is so stupidly expensive, I can’t see how that cost is justified. Another thing is the fact that there are a load of default settings that make your site vulnerable to hacking is also annoying (can’t remember the specifics but thats how the last company I worked for got hacked).

Just my opinion though :slight_smile:

1 Like

I have to agree with you on the cost. When Allaire first started CF, the price wasn’t too bad. When MacroMedia snapped up Allaire, the price did go up a bit. When Adobe bought MacroMedia, the cost immediately skyrocketed. Yes, the price is ridiculous, and given the economy (even though it’s improving), it’s just not an option. However, there are two pretty good (from what I understand) open-source alternatives - Railo and Blue Dragon. I also understand that the open-source versions usually add features BEFORE Adobe includes them.

But CF has changed a lot, since you last worked with it.

Adobe has become more serious about security (esp in CF10), and although the defaults are still as they were, Adobe does have “lockdown” guides on how to make it more secure. And 99% of what is normally done via “strange xml format” (which I never had a problem with) can be done within CFSCRIPT tags - which more resembles JavaScript or Perl.

V/r,

:slight_smile:

True, but the documentation is more scarce too. I think it’s a love it or hate it thing. It’s not for me, I find it’s too much typing to do something that should be pretty simple and as a result, the chance of typos is higher (and I am quite typo prone :frowning: ). I also find it more difficult to read the code.

I’m not trying to argue. Trying to help! :smile:

Documentation for CFSCRIPT is not as detailed as the standard tags are, but it’s mostly understood by CF developers that most of the functions and whatnot are identical to their tag counterparts; the exceptions are the ones that are documented (I think… I’ve never really had to look up much.) Certain tags (like CFLOOP) don’t have a CFSCRIPT counterpart because they would be done manually (ie, for(var i = i; i < thisValue; i++) and the like for loops.)

And I’ve found that most of the time (especially for things like CFOUPUT, which can do either just plain dynamic output or can loop a query recordset) CF code is LESS typing than PHP.

For example, I have not seen the PHP equivalent of CFOUTPUT’s “groupby” attribute. Say a query returns columns “Country”, “State”, “City”. Last I looked at PHP, if you wanted to output one row per country, with subrows for state, each subrow containing subrows for city, you’d have to declare a variable for each sub-query iteration as blank, then check that value against the next subquery values, and manually build your output using if/else conditional (this may have changed, I don’t know.)

But in CF, it’s as simple as:

<cfoutput query="qry" groupby="Country">
   Country: #qry.Country#<br />
  <cfoutput groupby="State">
    State: #qry.State#<br />
    <cfoutput><!--- the last nest can't use the groupby attribute - it will error if you do --->
      City: #qry.City#<br />
    </cfoutput>
    <br />
  </cfoutput>
  <br />
</cfoutput>

:slight_smile:

Of course not :slight_smile:

I think the other reason I don’t like it is the code I inherited was aweful, so perhaps I am a bit biased. And the way it differs from common standards (like indexes starting from 1), is irritating, especially if you are switching between several languages, it is easy to catch you out.

Nice example!

Well that would be one (sort of lame) way to do it. I usually structure my system so that data is extracted into classes, so I don’t really have that problem. But if I did, a re-usable function like this:

// returns an array of rows grouped by a column name
// 1) The value in the row assosiated with the column name you are grouping by is used as the first dimensional key
// 2) The second dimension is a numerical iterative key 0-n
// 3) The value of used in the first dimensional key is removed from the row, to avoid duplicating data
function groupBy($queryResult, $columnName) {
    foreach ($queryResult AS $row) {
        $colValue = $row[$columnName];
        unset($row[$columnName]);
        if (count($row) == 1) {
            $keys = array_keys($row);
            $row = $row[$keys[0]];
        }
        $grouped[$colValue][count($grouped[$colValue])] = $row;
    }
    return $grouped;
}

Then I could solve the problem where ever it popped up like this:

function row($val='') {
    echo "$val<br />";
}
// res = query results
foreach (groupBy($res, 'country') AS $country => $countryRows) {
    row($country);
    foreach (groupBy($countryRows, 'state') AS $state => $stateRows) {
        row($state);
        foreach ($stateRows AS $city) {
            row($city);
        }
        row();
    }
    row();
}

Which I think it is pretty simple.

:smiley:

That’s not a matter of bias, that’s a matter of someone else not knowing what they are doing and you being the unfortunate soul upon which said lousy code was thrust. :smile: I don’t know anyone who has ever enjoyed wrenching someone else’s code (even excellent code.) I live that almost every day. The original lead developer (who had been here for over a decade) wrote some (I suspect intentionally) lousy code, just coz he was bored and knew that someone else would eventually have to work it. :frowning:

And, yes, even I have occasionally been caught out by the whole “1 index” difference. Easily caught and fixed, though, as soon as you see the error message.

Interesting. When I used to do Classic ASP, something like this would have come in VERY handy.

V/r,

:slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.