3 ms·
Clean code has always meant to simple, easy to understand, not elegant.
by UK-Al05 7y ago
Clean code has always meant to simple, easy to understand, not elegant.
- collyw 7y agoI don't think they are mutually exclusive. In a recent interview question I was asked to find the largest three numbers in python list. My first attempt looped through the starting list, comparing the number to the previous minimum number in the result list - replacing the number if it was larger. I needed a get_minimum(function). It was the obvious solution that came to my head at thr time. An hour later I realized a far more elegant solution was to sort the list and slice the last three elements. It felt far more elegant to me and was as easy to understand as the initial obvious solution that came into my head. (Though this is why I dislike these type of interview questions. the first solution in an interview situation is not always the best or final one)