5 ms·
This post misses, for me, the greatest benefit of programming without syntax highlighting enabled. I went through a period of doing it for 5 years or so and the
by philbo 11y ago
This post misses, for me, the greatest benefit of programming without syntax highlighting enabled. I went through a period of doing it for 5 years or so and the biggest effect was ultimately on how I wrote code, not how I read it.
Without syntax highlighting I gradually became more focused on the legibility of what I was writing, because none of the visual cues were there when I read stuff back. Function length, module size, naming and vertical whitespace were are all things that I began to think more deeply about.
I turned syntax highlighting back on a few years ago because I was getting so many complaints from co-workers when pairing on stuff at my machine. But I definitely think the experience made me a more considerate, better programmer and I'm glad I did it.
- scottLobster 11y agoI'm glad you had a positive experience, but I'd like to point out that thinking about legibility, whitespace, naming etc should be done regardless of highlighting. I don't blame you, IMO it's one of the major issues with computer science education. Even basic principles of clean code are often neglected or never taught, in large part due to the lack of professional experience in academic circles. This leaves aspiring developers to figure it out on their own, as you did through turning off highlighting. I'm glad you did, but there are better ways to learn the same concepts IMO.
- crdoconnor 11y ago>Even basic principles of clean code are often neglected or never taught, in large part due to the lack of professional experience in academic circles. There's a lack of experience in professional circles too. One of the questions I always ask during programming interviews (on either side) is "is your code clean? if so, why?". Invariably the answer is a variant along the lines of "if it passes the linter it's clean", which is stupid. I'd like to say that's an automatic fail or automatic "don't work at this company" but it's just far too common.
- dave2000 11y agoPerhaps 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.
- lokedhs 11y agoThis reminds me of one of my favourite peeves when reading code written by maths people: Every variable is one or two characters long, the code barely indented, and absolutely no spaces anywhere in the code. Given that a lot of mathematics involves computer programming these days, I find it remarkable that basic programming principles does not seem to be taught at all. My point here is that this is not just a problem in computer science education. It seems as though every field that touches on programming fails spectacularly in this regard.
- majewsky 11y agoThat's an interesting point. However, this will only work when you're only ever reading your own source code. In Ruby code, I've seen a lot of very long expressions formatted without any spaces at all, like: (artifical example) @posts = Post.where(author:params[:author_id].to_i).map{|p|p.comment_count}.select{|c|c>5&&c<10} I often found myself properly formatting the code before I could even read it.