Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: How much do you use uppercase vs. lowercase characters in your code?
2 points by Victerius on Sept 15, 2022 | hide | past | favorite | 7 comments
some programmers use lowercase exclusively. SOME USE UPPERCASE EXCLUSIVELY. Some only capitalize the initial of variable names. What's your preference?



Whatever the language community and the team I'm in do. Anything that goes strongly against the grain is you choosing to be hard to work with. Especially when there's already a convention in place. A variable like this in C would communicate that the value is meant to be a constant (maybe is a constant via a macro definition):

  int CONTACT_ID = 10; // weird if it's meant to be reassigned later
  // elsewhere
  int x = CONTACT_ID;
If I saw this after the initial definition:

  CONTACT_ID = 20;
I'd be very confused as to why they chose to shout the name when that, by convention, marks it as a constant but are now assigning to it.

Choose to communicate poorly at your own peril. Naming conventions (including these typographical elements like capitalization and case style) are how you communicate with other people.


There's something what's called a naming convention. ALL CAPS are usually constant

All other use of CAPS is dependent on the language and it's naming convention.

One does not simply write like preferred.

Why you ask?


C is a bit of a free-for-all with case, but some languages have well-established conventions for this. E.g. type names are almost always CamelCase in Haskell, and the compiler requires the first letter be a capital. If there's a convention already, I mostly just try to follow it.


I would respectfully ask for someone to show me EXCLUSIVE UPPERCASE code which was not assembler, fortran 77, nor cobol.


Your list omits BASIC, much of which looked like this:

https://github.com/coding-horror/basic-computer-games/blob/m...


Up until about the 80s, lowercase capability was a very expensive optional-extra in I/O computer equipment.

So any language/program/data-entry used in the 30 years before about that era will be (almost) exclusively UPPER-CASE.


I EXCLUSIVE UPPERCASE SQL, not really sure why, just find it more readable




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: