Which programming case do you prefer (for MATLAB code)?
Chen Lin
홍보했습니다
설문은 2026년 6월 30일에 종료됩니다.
camelCase (variableName)
38%
PascalCase (VariableName)
11%
no capitalization (variablename)
5%
snake_case (variable_name)
29%
It varies for me
16%
추천 수: 347
댓글 수: 12
시간 내림차순I use camelCase for variables because it makes the variable names shorter than snake case and it's still just as readable. However I use PascalCase for function names because I'm used to having the first letter of all function names capitalized. Maybe it's a habit carried over from Visual Studio and Visual Basic.
I prefer snake case for most variable names, mainly because it is different than the capitalization styles used by MathWorks developers for other kinds of identifiers. It was a common capitalization style for C, back when I started programming with it in the late 1980s, so I was familiar and comfortable with it. I was disappointed that the recent coding style documentation provided by MathWorks specified a variable naming style that is the same as that used for function names.
For variable names that are based on mathematical symbols, I usually capitalize to approximate the symbols. For example, I'll use H for the Fourier transform of h, and I'll use Fs to mean sampling frequency.
I kind of like kebab-case (variable-name), as hyphens are easier to repeatedly type than underscores. But it is not supported in MATLAB, due to ambiguity with subtraction, given the first-class status of that operation.
참여하려면 로그인하세요