Artificial intelligence

Just by curiosity, is there Artificial Intelligence which write/create CFML programs/coding ? (Personaly, I do not see the need)

Sure:

I prompted it with:

Can you pls write some CFML code that actively demonstrates that you can, indeed, write CFML code (if you see what I mean, don’t just use a “hello world” example).

It did take clarification for it to understand I wanted it to talk about itself in the code.

// Display a message indicating that this code was written by ChatGPT
writeOutput("Hello, I'm ChatGPT, and I'm writing some CFML code!<br>");

// Define a function that takes a string as input and returns the reverse of that string
function reverseString(str) {
    var reversed = "";
    for (var i = len(str); i >= 1; i--) {
        reversed &= mid(str, i, 1);
    }
    return reversed;
}

// Test the reverseString function
testString = "racecar";
reversedString = reverseString(testString);
writeOutput("The reverse of the string '"&testString&"' is '"&reversedString&"'.");

Other than that, in my experience Github Copilot is not great with CFML… it keeps writing JS instead. I do not find it helpful.

But I find it good when using PHP or Kotlin. My guess is that it’s got a larger body of work to base its learning on in other languages as CFMLers don’t tend to participate in their community much, sadly :frowning:

Being more abstract about it, I was just able to ask ChatGPT this:

OK, changing topic. I need to write a tutorial about how to test abstract classes in PHPUnit. I’ve got the technical side covered, but I’m struggling to come up with a handy few classes to use to use in the demonstration. I wanna avoid the usual AbstractAnimal which Cat and Dog extend, if you see what I mean. I’m after something simple, but conceptually “real world” (animals and cats and dogs are not things one would have in a business app). Got any suggestions? I just need like the abstract class and two implementation classes. Maybe one implemented method in the abstract class, and one that requires implementing in the concrete classes? Sorry that’s a lot to digest, and I know I’m being lazy :wink: (this is for PHP btw, but pseudocode would be fine)

And it nailed it conceptually, and the code it wrote was tidy and correct (PHP though)

So even if not helping in the copilot sense of “help”, it is handy to get the ball rolling.

PS: asked it to translate the PHP into CFML and it messed a few things up.

@Pierre_Larde

I use GitHub Co-Pilot.
Naturally, the more I use it, the better it gets.

I use it mainly for short-cutting logic boilerplate.
That is : if I have a struct / array etc - and I want to loop through it…

Then co-pilot, sets up the code for the looping for me with the correct index / item and the “thing” that I am wanting to loop through.

OK, I understand, this is your own (or for a team) AI to be more and more efficient in your personal work. Is this applicable for CFML programming ? (I suppose all type of programming ?)
Thanks.
Now, a question of time to topple to new habits of working. Considering gain of time in future.