Is lower or Upper case class names better?

This is more of a question about general JS, but I wanted to ask this (awesome) community about your opinions.

Given a class with a bunch of static properties and such, do you think that upper or lower case names are better? For example:

//example or Example ?
class <insert name here>{
	static staticProp;
	static staticMethod(){
		...
	}
	prop;
	constructor(){
		...
	}
	method(){
		...
	}
}

You are open to choose your own convention - some people say consistency is more important than the actual convention.

In BabylonJS:

  • classes are ProperCase
  • instance methods are camelCase
  • static class methods are ProperCase
  • factory functions (like mesh builders) are ProperCase
  • enumeration values are UPPER_CASE

I think that is standard in other languages as well. In BabylonJS underscore prefixes on methods are used to denote what is not public, so if you use those then you would need to accept those can change as the implementation changes, but not the public API.

edit: I would like to add as well that the MeshBuilder was split out to builder methods and that may occur in other places to help with tree shaking. Helper classes like “Tools” is another candidate.

4 Likes