Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
20 lines (14 sloc) 1.01 KB
title description
I don't like camelCase
Snake case, camel case… Why different languages made different choices?

Which one is the most readable?

function getFirstUserFrom(SiretNumber $siretNumber): User {}
function get_first_user_from(Siret_Number $siret_number): User {}

I think the snake case version is much more readable than the camel case.

How we name our functions is not a technical choice, it's a convention. Nobody can say that the snake case version is worse than the camel case one. The people from the PSR committee decided a long time ago that, in PHP, methods will be named in camel case and classes will be named in studly case. But in Rust, or in Python, a different choice was made: it's snake case for functions and methods.

Don't let other people decide what works best for you. Recently, I started using snake case for all my functions, methods and variables. And I think I'll switch to the Siret_Number approach for all my classes.

You can’t perform that action at this time.