﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Moses commented on On Professional Code</title><description>You found Frequency misspelled :)
  FrequnecyToCheckForIdleDatabases </description><link>http://ayende.com/158369/on-professional-code#comment31</link><guid>http://ayende.com/158369/on-professional-code#comment31</guid><pubDate>Sat, 15 Sep 2012 15:29:44 GMT</pubDate></item><item><title>Karep commented on On Professional Code</title><description>Ok, I did not find a bug :) </description><link>http://ayende.com/158369/on-professional-code#comment30</link><guid>http://ayende.com/158369/on-professional-code#comment30</guid><pubDate>Thu, 13 Sep 2012 20:10:24 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Karep,
Scroll to the side in line 114, the == is there.</description><link>http://ayende.com/158369/on-professional-code#comment29</link><guid>http://ayende.com/158369/on-professional-code#comment29</guid><pubDate>Thu, 13 Sep 2012 09:44:17 GMT</pubDate></item><item><title>Karep commented on On Professional Code</title><description>Not in line 114, in line 111 there is == false.

https://github.com/ravendb/ravendb/blob/master/Raven.Database/Server/HttpServer.cs</description><link>http://ayende.com/158369/on-professional-code#comment28</link><guid>http://ayende.com/158369/on-professional-code#comment28</guid><pubDate>Thu, 13 Sep 2012 09:42:59 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Karep,
You missed the == false in the end.</description><link>http://ayende.com/158369/on-professional-code#comment27</link><guid>http://ayende.com/158369/on-professional-code#comment27</guid><pubDate>Thu, 13 Sep 2012 09:40:46 GMT</pubDate></item><item><title>Karep commented on On Professional Code</title><description>if (TryParse(configSetting, out val))
   val = 60

Shouldn't it be if (!TryParse) ?</description><link>http://ayende.com/158369/on-professional-code#comment26</link><guid>http://ayende.com/158369/on-professional-code#comment26</guid><pubDate>Thu, 13 Sep 2012 09:09:26 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Karep,
It is possible, what did you find?</description><link>http://ayende.com/158369/on-professional-code#comment25</link><guid>http://ayende.com/158369/on-professional-code#comment25</guid><pubDate>Thu, 13 Sep 2012 05:30:31 GMT</pubDate></item><item><title>Karep commented on On Professional Code</title><description>Did I just find bug in HttpServer.cs in line 114?</description><link>http://ayende.com/158369/on-professional-code#comment24</link><guid>http://ayende.com/158369/on-professional-code#comment24</guid><pubDate>Wed, 12 Sep 2012 20:52:34 GMT</pubDate></item><item><title>Aaron commented on On Professional Code</title><description>Great post -- and rightly points out the importance of production readiness in an application.  Code should be both Clean and Production Ready and it is almost always possible.

Some would argue you can't have both -- and they are right in some cases -- but like most software design problems, abstraction is the answer.

I subscribe to clean code wholeheartedly but the main point that many "clean code" zealots miss is that the writing of the code occurs in a small percentage of the overall lifetime of an application.  Fixing that code and adding incremental changes takes up the vast majority of the time so code should be designed considering that.  Another large percentage of an applications "interaction lifetime" is support -- identifying problems.  So builders of such a system should design with that in mind and build tools that enable support staff and even users to discover their problem and report details for help.

None of that requires "dirty code" -- that's a myth.  Dirty code may be more expedient or business appropriate and if we're honest about it we can accept that.  But most dirty code problems can be solved by better code and/or abstractions -- albeit less expedient.

Clean code AND Production Ready code is possible and usually practical... it just might take more investment upfront.</description><link>http://ayende.com/158369/on-professional-code#comment23</link><guid>http://ayende.com/158369/on-professional-code#comment23</guid><pubDate>Wed, 12 Sep 2012 15:02:23 GMT</pubDate></item><item><title>tames commented on On Professional Code</title><description>While I agree that "professional code" is something that is maintainable... the idea of keeping layers upon layers of technical debt just to avoid losing the dozens of bug fixes is a mistake.  Time and again I've faced the issue of legacy code that was "untouchable" because they didn't want to lose the "knowledge" embedded in the code.  I usually reply that if you don't know what it is that's embedded, then that knowledge is already lost.

Refactoring is an important part of the life of a codebase.  Each of those little bug fixes should have been accompanied by a change to the unit tests.  Those unit tests will help you ensure that the refactored code still works as expected, but is made cleaner... and clearer... for the next developer.</description><link>http://ayende.com/158369/on-professional-code#comment22</link><guid>http://ayende.com/158369/on-professional-code#comment22</guid><pubDate>Wed, 12 Sep 2012 12:50:52 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Doron,
If it is detached from context, it is going to make it harder to figure out.</description><link>http://ayende.com/158369/on-professional-code#comment21</link><guid>http://ayende.com/158369/on-professional-code#comment21</guid><pubDate>Wed, 12 Sep 2012 06:53:20 GMT</pubDate></item><item><title>Doron commented on On Professional Code</title><description>I think the code would be clearer as it would have less clutter. Small classes that do just one thing are easier to work with and evolve, regardless of reusability. Don't you agree?</description><link>http://ayende.com/158369/on-professional-code#comment20</link><guid>http://ayende.com/158369/on-professional-code#comment20</guid><pubDate>Wed, 12 Sep 2012 06:18:33 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Doron,
Sure, I can move the code to a helper class. What did I gain by that?
The code is NOT reusable, I have merely made it harder to understand by removing it from its usage location.</description><link>http://ayende.com/158369/on-professional-code#comment19</link><guid>http://ayende.com/158369/on-professional-code#comment19</guid><pubDate>Tue, 11 Sep 2012 20:15:48 GMT</pubDate></item><item><title>JV commented on On Professional Code</title><description>'About the most unprofessional thing that you can say is: “I have no idea what is going on.”'

Hmm, I often say this when interacting with the business people, though.

LOL, I just had to say it. :)</description><link>http://ayende.com/158369/on-professional-code#comment18</link><guid>http://ayende.com/158369/on-professional-code#comment18</guid><pubDate>Tue, 11 Sep 2012 15:15:01 GMT</pubDate></item><item><title>Doron commented on On Professional Code</title><description>Oren, 
Are you really saying you can't make that 1K lines class more elegant by splitting it to more classes that do less? Yes, error handling can get messy but you can put the messiness in smaller packages that are easier to work with. 

Looking at the code here:
https://github.com/ravendb/ravendb/blob/master/Raven.Database/Server/HttpServer.cs
There are lots of things you can put in another class, like all the Handle*Exception methods. 
(Although I must admit that as far as huge classes go, this is pretty clean).


</description><link>http://ayende.com/158369/on-professional-code#comment17</link><guid>http://ayende.com/158369/on-professional-code#comment17</guid><pubDate>Tue, 11 Sep 2012 15:05:07 GMT</pubDate></item><item><title>Raciel commented on On Professional Code</title><description>As everything in code, "it depends". 
Whenever I have started a new application it is my goal, and I put a lot of effort on it, to keep it simple, clean, readable, maintainable, etc...
As soon as the systems matures, it gets dirty, that type of dirt you don't like but you need to live with because "it works" and because -honestly- you can't make it better; it is simply ugly.
I have worked on several production systems, and I have failed miserably in a lot of reworks attempts. 
The older I get, the more I'm for the principle "why to fix/re-factor if not broken". Specially because there is a high cost (time, money, customer confidence lost when old-well-known-bugs arose) associated with it.
</description><link>http://ayende.com/158369/on-professional-code#comment16</link><guid>http://ayende.com/158369/on-professional-code#comment16</guid><pubDate>Tue, 11 Sep 2012 14:43:57 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Josh,
You can't really do that.

For example, let us take the case of handling an HTTP request, okay?

* Get context
* Dispatch request
* Flush request

Now, in any part here you may have errors, during the error handling, you may have errors as well.
You need to handle all of that.

Typical example, during the request processing, we threw an exception. We need to send the error to the client.
But we get an error there because they disconnected.
</description><link>http://ayende.com/158369/on-professional-code#comment15</link><guid>http://ayende.com/158369/on-professional-code#comment15</guid><pubDate>Tue, 11 Sep 2012 14:40:14 GMT</pubDate></item><item><title>Alwin commented on On Professional Code</title><description>Ayende: yes i used the wrong words there, I meant "started with a good design but grew ugly". But I only tried to explain the difference.

---

I also think that documentation is important: *why* is this code so ugly? Otherwise the next dev will just think "WTF?" and "clean up" everything.
Documentation like good function names (self documenting code) or maybe comments that reference issue numbers.</description><link>http://ayende.com/158369/on-professional-code#comment14</link><guid>http://ayende.com/158369/on-professional-code#comment14</guid><pubDate>Tue, 11 Sep 2012 14:37:51 GMT</pubDate></item><item><title>Josh Kodroff commented on On Professional Code</title><description>I think you can have it both ways.

As long as you keep your functions short and well-named, you can have readable code with all the necessary error handling.  Just keep the error handling in separate functions.</description><link>http://ayende.com/158369/on-professional-code#comment13</link><guid>http://ayende.com/158369/on-professional-code#comment13</guid><pubDate>Tue, 11 Sep 2012 14:24:12 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Alwin,
It isn't out of control. Ugly code is still pretty good code. But when you have to take into account error handling _in your error handling code_, that gets a bit messy.</description><link>http://ayende.com/158369/on-professional-code#comment12</link><guid>http://ayende.com/158369/on-professional-code#comment12</guid><pubDate>Tue, 11 Sep 2012 14:04:19 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>nNjy,
Yessss... although I am not quite sure that rough is the right word.
If you'll look at my code reviews, I rarely talk about things like Cyclmatic Complexity, naming conventions or things like that.
When I criticize code it is usually because it is doing things wrong.
Off the top of my head, the wrong things are usually:
* Needless abstractions - controller -&gt; service -&gt; repository
* Violation of known fallacies - select n+1, unbounded result sets, assuming no bandwidth / latency.
* Bad error handling.

The details of what constitute a problem may differ between layers of code, but the actual problems remain the same.</description><link>http://ayende.com/158369/on-professional-code#comment11</link><guid>http://ayende.com/158369/on-professional-code#comment11</guid><pubDate>Tue, 11 Sep 2012 14:03:28 GMT</pubDate></item><item><title>Alwin commented on On Professional Code</title><description>njy: I think there's a difference in wrong use of frameworks and libraries, NIH syndrome etc (code reviews by Ayende) and code that started with a good design but grew out of control because of bug fixes and error handling (this post).</description><link>http://ayende.com/158369/on-professional-code#comment10</link><guid>http://ayende.com/158369/on-professional-code#comment10</guid><pubDate>Tue, 11 Sep 2012 14:00:39 GMT</pubDate></item><item><title>Daniel Lang commented on On Professional Code</title><description>I couldn't agree more. I made the mistake twice and replaced old and awful code with fresh and clean code. In the end, I ended up fixing the same bugs twice and even worse, I didn't have a working release for a long time. 

I learned two things:
1) Make sure you always have a working release that is not older than a week.
2) Only throw out things that are small enough that you can replace them within a day or at most two. </description><link>http://ayende.com/158369/on-professional-code#comment9</link><guid>http://ayende.com/158369/on-professional-code#comment9</guid><pubDate>Tue, 11 Sep 2012 13:47:49 GMT</pubDate></item><item><title>njy commented on On Professional Code</title><description>@Oren: ok, so we may say that if the code is low level it is acceptable to have some sort of "roughness", and instead if it is high level it should be more readable, concise and overall understandable? I'm just trying to have a clearer view on your opinions about code quality, not to nitpick here and there ;)

btw thanks</description><link>http://ayende.com/158369/on-professional-code#comment8</link><guid>http://ayende.com/158369/on-professional-code#comment8</guid><pubDate>Tue, 11 Sep 2012 13:05:27 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Njy,
Most of the code that I review is a pretty high level one.
There are different set of considerations for the type of code that one write. 
And there are different sets of problems. 
</description><link>http://ayende.com/158369/on-professional-code#comment7</link><guid>http://ayende.com/158369/on-professional-code#comment7</guid><pubDate>Tue, 11 Sep 2012 13:01:59 GMT</pubDate></item><item><title>njy commented on On Professional Code</title><description>@Oren: not to start a flame or something, but don't you think that what you are saying right here is in a kind of conflict with your usual Ayende-style code reviews?

Things like "oh look at this crappy piece of code, it's unreadable!" or "it's not understandable, and this is important because code is written once and read a thousand times" or other stuff like that.

I mean, i would simply like to understand the different approach, because otherwise it may seems something like "do what i say, not what i do" and the likes.

Waddaya think?</description><link>http://ayende.com/158369/on-professional-code#comment6</link><guid>http://ayende.com/158369/on-professional-code#comment6</guid><pubDate>Tue, 11 Sep 2012 12:31:34 GMT</pubDate></item><item><title>Paul Shmakov commented on On Professional Code</title><description>"Release It" by Michael Nygard is a good book on making software production ready. </description><link>http://ayende.com/158369/on-professional-code#comment5</link><guid>http://ayende.com/158369/on-professional-code#comment5</guid><pubDate>Tue, 11 Sep 2012 12:22:45 GMT</pubDate></item><item><title>Ayende Rahien commented on On Professional Code</title><description>Doron,
You usually can't have both.

In particular, error handling is generally ugly code, and at low levels, you have a LOT of it.</description><link>http://ayende.com/158369/on-professional-code#comment4</link><guid>http://ayende.com/158369/on-professional-code#comment4</guid><pubDate>Tue, 11 Sep 2012 11:47:21 GMT</pubDate></item><item><title>Doron commented on On Professional Code</title><description>I disagree. Professional code should be *both* clean and production ready. "It works" is a pretty bad excuse for a class that has thousands lines of code. It's probably not fun to make changes to that class.</description><link>http://ayende.com/158369/on-professional-code#comment3</link><guid>http://ayende.com/158369/on-professional-code#comment3</guid><pubDate>Tue, 11 Sep 2012 11:12:18 GMT</pubDate></item><item><title>Craig commented on On Professional Code</title><description>I think Spolsky also makes a good argument in that article on why rewriting to clean up code is bad. Because you are throwing out all those hard to find  and fix bugs. You get cleaner code, but less stable system.</description><link>http://ayende.com/158369/on-professional-code#comment2</link><guid>http://ayende.com/158369/on-professional-code#comment2</guid><pubDate>Tue, 11 Sep 2012 10:48:16 GMT</pubDate></item></channel></rss>