Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class member organization

What is the best way to sort class members?

I'm in conflict with a team member about this. He suggests that we should sort the members alphabetically. I think it's better to organize in a semantic manner: important attributes first, related methods together, etc.

What do you think?

like image 826
Marcio Aguiar Avatar asked Oct 11 '08 20:10

Marcio Aguiar


1 Answers

I like semantic. Alphabetical doesn't seem to make a lot of sense to me, cause when you're looking for a member, you rarely know exactly what it's called. Also, if you're using any sort of naming convention (eg: Hungarian), alphabetical is going to lead to grouping by type, which may not be what you want.

like image 172
Nick Avatar answered Sep 17 '22 20:09

Nick