Sometimes it is necessary to write different code for Adobe ColdFusion vs Railo vs OpenBD, due to differences in implementation.
Do people have a specific method that they use for this?
For example, switching on ProductName is one option:
<cfswitch expression="#Server.ColdFusion.ProductName#">
<cfcase value="ColdFusion Server">
...
</cfcase>
<cfcase value="Railo">
...
</cfcase>
<cfcase value="BlueDragon">
...
</cfcase>
</cfswitch>
Is that the best way, or can anyone suggest something better?
When you get down to it, that's probably the most reliable way. You might be safer doing feature detection rather than explicit product checks, but CFML doesn't have a lot of introspection features you can use for that kind of thing.
If you use CFCs in your work, then you can also hide some of these alternate implementations using patterns like Strategy and Template Method. But when you're choosing an implementation, you'll probably still come back to
ProductName
.