<story><title>The Hardest Program I&apos;ve Ever Written</title><url>http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/</url></story><parent_chain></parent_chain><comment><author>greggman</author><text>Great blog post and super interesting.&lt;p&gt;My feeling though is the problem is they have a line limit. Maybe they should rethink their style. I&amp;#x27;m serious.&lt;p&gt;Before I worked at Google, in 30 years of programming I never worked at a company that had a line limit. Adding a line limit at Google did not make me more productive. At first I thought &amp;quot;hey, I guess 80 chars makes side by side comparison easier&amp;quot; but then I thought back, hmm. I never had problems comparing code before when I didn&amp;#x27;t have a line limit.&lt;p&gt;Instead what I found was that 80 character limit was a giant waste of time. The article just pointed out a year of wasted time. I can point to searching and replacing an identifier and then having to go manually reformat hundreds of lines of code all because of some arbitrary style guide. I also had code generators at google that had to generate code that followed the line limit. I too wasted days futsing with the generator to break the lines at the correct places all because of some arbitrary line limit.&lt;p&gt;That should be the real takeaway here. Make sure each rule of your style guide actually serves a purpose or that its supposed benefits outway its costs.</text></comment>
<story><title>The Hardest Program I&apos;ve Ever Written</title><url>http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/</url></story><parent_chain></parent_chain><comment><author>sytelus</author><text>I have tried few code formatters and almost always regretted it. The big problem is that code formatting contains a significant portion of intent and explanation. Sometimes I want to put two assignments on same line because it emphasizes relationship and atomicity but other times it&amp;#x27;s better to keep them on separate lines for sparcity. There are actually quite a few times I wanted a line go well beyond 80 chars because I wanted to de-emphasize unimportant monotonous part taking away all attention and have far more more important steps immediately stand out to reader. I take code formatting very seriously and consider an integral part of my expression. Style guides are good but they shouldn&amp;#x27;t be followed like a robot, let alone enforced by robot. In fact code formatting tells a lot about culture and philosophy of an author. For example K&amp;amp;R C starts braces on same line to emphasis compactness as elegance, C# doesn&amp;#x27;t to emphasize sparse code as elegance. In SQL sometime it&amp;#x27;s great to put subquery on same line and sometime it doesn&amp;#x27;t - it really depends on what you want to emphasize and convey rather than hard and fast rules on number of tokens and syntax analysis. Code formatting is not just set of fixed rules, it&amp;#x27;s a communication mechanism that guides reader on what to focus, what is unimportant, where is a gasoline spill and where wild fires may burn. This is not to say everyone takes their formatting seriously which is where automate formatter would probably add value (and the case where you are importing&amp;#x2F;copy pasting from somewhere else). I think K&amp;amp;R C is likely the gold standard for code formatting. You should try out your formatter on those snippets ;).</text></comment>