4 ms·
Design for readability – A primer on code typography
- magnat 9y ago> Lexicographical sorting by class-name to make things easier to find This is weird. I've never encountered (or noticed) ordering parameters by their type names. Semantic ordering (subject, object, adverb, optionals) makes more sense to me - especially if you see type names only once at declaration, but have to guess/deduce parameters order at every call site.
- aetherspawn 9y agoI agree, I think the most relevant arguments should be first and dilute out to less relevant arguments (eg. it’ll probably still work if you pass null or zero). Then you can typically collate your useless short arguments on one line and you don’t get wierd formatting at the call sites, right?
- asamarin 9y agoAnd it's even impossible to do in some cases, e.g. default arguments in C++, which must be at the end of parameter list
- ameyakarve 9y agoIt does make sense. I'll experiment with a combination of the two going forward (probably semantic first, lexicographical later)
- seandougall 9y agoAmong other issues, it breaks down completely as soon as you have subclasses of any sort.
- kqr 9y agoI really like the look of that right-aligned thing and I wonder if it works in practise. Any way to get Emacs to do that for me?
- Derbasti 9y agoM-x align-regexp