I would like to know the popular ways of naming files in JavaScript and PHP development. I am working on a JS+PHP system, and I do not know how to name my files.
Currently I do for JS:
framework/
framework/widget/
framework/widget/TextField.js (Framework.widget.TextField())
Framework.js (Framework())
So, my folders are lowercase and objects CamelCase, but what should I do when the folder/namespace requires more than one word? And what about PHP?
jQuery seems to follow:
jquery.js
jquery.ui.js
jquery.plugin-name.js
so that it is
jquery(\.[a-z0-9-])*\.js
but ExtJS follows completely different approach. Douglas Crockford only gives us details about his preference for syntax conventions.
Personally I'd go for all lower case names for the folders, separating words with "-" as per jQuery, but that's without any evidence to back it up.
However, what ever system you choose, be consistent. This will not only help you 6 months down the line, but will help someone coming to your system. They'll soon learn their way around even if it's not 100% the same as other systems they've used in the past.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With