looking is 90% of the upside. Certainly you can gain trust by looking.
And you can always touch if you want to. (It just makes updates a bit more work.)
It’s no different. If a library ships as a compiled DLL, or an OLE or whatever then it is trusted less. Not necessarily untrusted, but trusted less. The ideal is all source - in whatever form that comes. Which is why trust is orthogonal to templates - templates are either trustworthy or not, just like every other bit or reusable code.
It is harder because templates are different in that they mix “code” with “output”. When reading a class I’m just reading code - all the code, nothing but the code. When reading templates my brain is having to distinguish between two different programs at the same time - the template program that is running, and the program output it is creating.
Like all tasks this becomes easier with practice, and is a lot easier in the new IDE with the color syntaxing, but it still takes time for the brain to catch on. It’s not “hard” but it is “harder” in the same way that 2 is not large, but 2 is categorically greater than 1.
It’s weaker for a number of reasons;
a) Classes can be used in hand-code projects, whereas templates are limited to being used in an app.
b) Classes can be used directly in test code, and the code in those classes can thus be more reliable. The template layer can be unit tested as well, but that becomes more tricky the more possible inputs there are.
c) Clarion Classes are easy to use in any Clarion framework. plugging them into Legacy, ABC or NetTalk or whatever requires different template code for each framework - but by minimising the template code for each, it’s possible to easily create an maintain templates for any of the frameworks.
d) Classes are more extensible - in the sense that every virtual method call is an implicit embed point. This can be overcome in templates by adding lots of embed points, but that has to be actively done by the author, whereas with classes it comes for free (well, as long as ,VIRTUAL is used.)’
e) Someone can derive a class, add their own spin to it, but continue to use the existing template without change. In other words you might have a derived StringTheory class (say RichTheory) - which doesn’t need to alter shipping code (class or template) but which can be completely used by the StringTheory template.
f) Most of all though it’s better because it separates “clarion code” from “template code”. It lets the template do what it does best - provide the visual interface to the class. Reading the template is easier, the template itself is smaller and so on.
When I started writing add-ons they were naturally in the form of monolythic templates. That’s all we had to work with. The adding of OOP in C4 meant we could create classes, and let templates be just glue. I’ve found that the classes approach has meant a lot less work, and a lot easier work, and that’s the way I’ve been doing it ever since. We still have a couple old products which are “just templates” and they seem a bit strange to me now. I always want to go back and refactor them into classes, but time is limited.
Incidentally I don’t say classes + templates > templates to damn templates. On the contrary I say it to praise them. Templates are an integral part of the equation - and they are still the Clarion special sauce.
Exactly - 100% my point. Classes are great, template makes using them easier. This is the point of my original post. Writing reusable code has been getting steadily easier for decades now. Using reusable code has not. Templates are magic because they focus on making reusable code easier to use. That’s why I write them, that’s why I use them.
It’s not a question of “templates or classes”. Both are strong alone. But together you get the best of both, and the combination is worth a lot more than either alone.
I think this point is something of a digression. They weren’t really designed for loop based processing, they were designed to generate code. As such they generate any code just fine. You’ll find that they’re equally good at any code. I’ve been generating JavaScript functions with them and it generates fine. Obviously they are good at generating Clarion - I’m saying they are equally good at generating everything else.