4 ms·
One of the things I really enjoy about developing in Python is that - somehow - various code style smells seem fairly apparent when reading the source. Over ti
by jka 7y ago
One of the things I really enjoy about developing in Python is that - somehow - various code style smells seem fairly apparent when reading the source.
Over time in a well-maintained project there's a tendency for these to clean themselves up, and a feeling that the codebase is in good shape emerges.
Variables become clearly and simply-named, the code starts to read more like a hybrid between a human language and a programming language, and the formatting and syntax become - generally - more straightforward and less 'clever'.
Ideally the patterns and algorithms also gravitate towards readable and efficient patterns (using generators, dunder methods, collection types, and so on where appropriate) until the code feels pleasant to understand and modify.
What's your favourite language for intuitively assessing code quality, and what are the indicators and criteria that you think you use?
- 9wzYQbTYsAIc 7y agoThere’s something about JavaScript and the length of files, grouping of related lines, and usage of functions that can make it immediately obvious that the quality is either atrocious or decent. I suppose that that extends in part to any C-style language, but the relative looseness of JavaScript really makes it stand out to me, for some reason.
- jka 7y agoNice :) It's a principle of pattern recognition[1] regardless of language, I suppose. It just takes time to learn and internalize the patterns to look for -- and perhaps some languages and syntax highlighters are better than others at exposing those patterns to the reader. [1] - https://en.wikipedia.org/wiki/Pattern_recognition_%28psychology%29 https://en.wikipedia.org/wiki/Pattern_recognition_%28psychol...
- 9wzYQbTYsAIc 7y agoTrue, check this out if you’ve not heard of it before. It’s is a great springboard into the topic of perception: https://en.wikipedia.org/wiki/Gestalt_psychology https://en.wikipedia.org/wiki/Gestalt_psychology
- noema 7y agoTo this I would add a couple of classic mid century studies on perception: Arnheim's "Art and Visual Perception" (which imo should be mandatory for any UI designer), and Merleau-ponty's "Phenomenology of Perception" (this one requires some extensive background reading, but it's well worth the effort)
- searchableguy 7y agoI don't understand why js psychologically force me to write smaller files. Whenever I write in any other language, I feel totally fine with 1000+ LOC in single file but when it's js, the zeitgeist force me to put them into bunch of folders exporting from an index.ts I can't put my fingers on it.
- johnchristopher 7y agoMaybe you want to have the feeling to be in control ? Smaller files, each having one well defined usage, nicely ordered in structured folders, gives me the feeling I understand what's going on. Maybe JS projects feels less solid or grounded sometimes ?
- krebs_liebhaber 7y agoI feel queasy when I see a 1000-line file in any language, but JS in particular is just... yikes. I guess it's because the language has a reputation for being inconsistent (whether that's deserved is another thing entirely), so the less you have to reason about, the better.
- beckingz 7y agoSQL. Because SeLeCt * FrOm <table> is valid.