Javascript naming convention for Photoshop

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

Mike Hale

Javascript naming convention for Photoshop

Post by Mike Hale »

Is there a naming convention that works well for Photoshop?

I did a Google search and it seems that every group has it's own.

Mike
Andrew

Javascript naming convention for Photoshop

Post by Andrew »

Can you explain more - naming scripts, naming variables, naming functions?

Andrew
Mike Hale

Javascript naming convention for Photoshop

Post by Mike Hale »

What I was looking for is a guide to naming variables, functions, and any thing else one has to come up with a name. I hadn't thought of the script name itself, but that too.

For Visual Basic, I have a naming and style guide. It gives a suggested way to name objects and how to format the code.

I know it's poor programing on my part. but sometimes I can't tell what type of object a variable is when I go back to edit so old code of mine.
For example, is myFilePath a string, file, or folder object? When I started scripting for photoshop, I just copied parts of others code and changed it when needed. Now that my skills have advanced slightly and I find myself creating more complex scripts I want to make them more understandable.

I can adapt the VB guides I have. I just thought if there was a JS version, I could adopt it. If there not, and you are willing to share your thoughts I would be grateful.

Mike
Andrew

Javascript naming convention for Photoshop

Post by Andrew »

I'm self-taught so my ideas on this are likely to be way off. Xbytor I am sure will have some good ideas. The CS JS scripting guide notes:

1. Do not use _, use intercaps in names (note to self - wooops);

2. Always start a property or method name with lowercase.

3. Always start a Class name with Uppercase.

With Bridge scripting in particular it seems to me that name collision is a serious potential problem. Even more than before I am making sure

1. no variables I generate are global

2 all scripts are wrapped in a single external function

3. that single function has a name that is very unlikely to be duplicated

Looking forward to hearing from those that know more on this.

Andrew