4 ms·
Perhaps you should use a less ambiguous term than "clean". They're giving you a correct answer, so perhaps you should ask the correct question? "Is your code r
by dave2000 11y ago
Perhaps you should use a less ambiguous term than "clean". They're giving you a correct answer, so perhaps you should ask the correct question? "Is your code readable", perhaps? "Are you proud of your code?". Something like that. No-one's going to admit their code isn't clean, regardless of how they interpret that term.
- true_religion 11y agoI think 'clean' can only be evaluated in context. For instance, whenever I write code for public distribution I try to use the same layout principles and code style rules that are popular within my target audience. Additionally, I try to present concepts in a way that will either be idiomatic to the target audience or at the very least not judged as unusual. To give a silly hypothetical example. If I were writing code to be delivered to a company that never uses list comprehensions within Python, I'd write everything as an explicit for-in-loop. This is less of a problem in certain languages where there's explicit global style guides and a tendency to conservatism (Python). Other communities where that's not the case, like Smalltalk, Lisp, and now Elixir, one can see varying control statements and code inheritance methodologies practiced by different groups simply because of how easy it is to implement, and that doing so isn't shunned.
- crdoconnor 11y ago>They're giving you a correct answer Is spaghetti code clean if it lints successfully?
- dave2000 11y agoYes. And no. Depends on the context. Microsoft and malware coders both think windows is great for the same reason; it's very popular.
- crdoconnor 11y ago>Yes. Depends on the context. I can't think of any context where I'd consider spaghetti code clean. It's exact opposite of clean.
- dave2000 11y agoClean...in the sense that it passes lint, unit testing, continuous integration etc. Not clean in the sense that "internet user #1209828 approves of its aesthetics", which is a metric subject to fashion, opinion etc.
- raarts 11y agoIt's A correct answer but not THE correct answer. The best answer would be clean code is just beautiful and that's why I strive for it.
- marssaxman 11y agoLeaving the definition of "clean" ambiguous does give you some useful information, though, because the context implied by the answer shows you something about the interviewee's priorities. Of course their code is "clean" according to whatever metric is important to them - but what's their metric? What are they focusing on as they work?