I decided to drop into Meta AI to see how it did with this code. Unfortunately, it took a couple hours, and the code wasn’t as good as Gemini.
The code is here: https://github.com/johnkawakami/wp-plugin-llm-experiment/tree/meta1
This isn’t a fair comparison, because I started with the Gemini code, and then pasted it into Meta, and asked it to work on it. It wasn’t a new setup.
I asked it to refactor the reCaptcha stuff out into a class. It did a pretty good job. It wasn’t the way I’d do it, but it worked.
I then asked it to factor out the settings, and it did that well. Again, I’d do it a little differently, but it wasn’t bad.
(What I’d do differently is instantiate one ReCaptcha, and then pass it into the various callbacks. LLama instantiates the object just before using it.)
Then, I asked it to give me a toggle to turn the reCaptcha feature on and off. It did that acceptably. I was hoping it would toggle the entire thing off, by adding the logic into the class, but it didn’t do that. Instead, I could test if it’s enabled, from the calling functions. Again… acceptable, but just barely.
I was going to ask it to parameterize some things, but, that was a premature generalization. I don’t need to re-use this code. This is my bad habit: making code reusable, before I ever need to reuse it.
Here’s the line counts:
398 1271 11899 plugin.php
65 138 2082 ReCaptchaAdmin.php
61 129 1619 ReCaptcha.php
524 1538 15600 total
My complaints:
- Two spaces per tab.
- It doesn’t code how I code.
My Kudos:
- I showed it some code, and it refactored it!
- It seems to know WordPress.
Finally, there was the unintended consequence: avoiding premature generalization.
(I finally put the code onto GitHub, because it was getting too complicated to paste it into the post.)