DEV Community


Discussion on: AYDT - 03 ( Are You Doing This ❓ ) - Programming and Cases.

shushugah profile image

I think it is worthwhile to distinguish what syntax is enforced, and which is a convention. Ruby on Rails is very opinionated about camel casing because it also expects to find files with the equivalent snake name. But ruby itself doesn't enforce this. So for example Constants only need the first letter to be uppercase (capitalised), but by convention we upcase entire the entire variable.

These are two ways to assign a constant. Constants can also be re-assigned just like variables, but in certain cases it produces a warning. Class names are constants themselves, which are typically capitalised like in the first example.

Name = "Fred"
chintukarthi profile image
Karthikeyan Dhanapal Author

Hi shushugah,

The whole idea of this article is to point out the best practices of using the cases. Even though naming the constant like this,

Name = "Fred"

is allowed, but it will throw ' lint issue ' which is surely not a good practice.
If you would like, you can have an idea of possible good and bad practices here:

So whatever is mentioned here is said by considering the lint standards, which I am planning to cover in the next article.

I really appreciate your effort in pointing out this. Keep reading 🙂

Forem Open with the Forem app