Michael Offel [ARCHIVE] on Nostr: 📅 Original date posted:2011-07-12 🗒️ Summary of this message: A programmer ...
📅 Original date posted:2011-07-12
🗒️ Summary of this message: A programmer suggests a complete rewrite of Bitcoin's codebase, citing the need for clean and readable code, but disagrees with the idea of starting from scratch.
📝 Original message:Monday, July 11, 2011, 10:33:04 AM, Mike Hearn wrote:
>> My overall suggestion is to begin a complete rewrite, inspired by the old
>> code rather than moving a lot of "known to be somehow functional" around.
> This essay is old but still relevant, I think:
> http://www.joelonsoftware.com/articles/fog0000000069.html
It is indeed a very good one but I disagree in two points. First
> As a corollary of this axiom, you can ask almost any programmer
> today about the code they are working on. "It's a big hairy mess,"
> they will tell you. "I'd like nothing better than to throw it out and start over."
If someone asks me this question about the project I'm currently
working on I would never answer like that. This is important in the
threads context because it gives me the confidence to say you can
build very large C++ projects with lots of programers attached over
multiple years and still have a very clean and nice code base. And the
article does also accidently points to one of the roots of messy code.
> Back to that two page function. Yes, I know, it's just a simple
> function to display a window, but it has grown little hairs and
> stuff on it and nobody knows why. Well, I'll tell you why: those are
> bug fixes. One of them fixes that bug that Nancy had when she tried
> to install the thing on a computer that didn't have Internet
> Explorer. Another one fixes that bug that occurs in low memory
> conditions. Another one fixes that bug that occurred when the file
> is on a floppy disk and the user yanks out the disk in the middle.
> That LoadLibrary call is ugly but it makes the code work on old
> versions of Windows 95.
Well, if you can not identify the meaning of some hairs, they are
either attached to the wrong place, in an unclear way or are just
missing a line of comment. There are studies about what size of
function and up to what number of variables per function can be
covered by the average code reading programer. And these numbers are
low.
Second, I agree with the point that you can not give up your market
leadership by beginning from scratch and you will if you do so. Unless
you do it like microsoft did in his example by simultaneously extend
the old code base. And microsoft does this all the time, just look at
Windows 9x compared to Windows NT and the dead object oriented Windows
kernel. (They did buy lots of that but that is not the point here)
The mistake is to compare a small project like Bitcoin to any
application like Word or Netscape. The author did explicitly write
that he does not mean that partial rewrite is a bad thing. And
rewriting the Bitcoin client with three or four guys is like a tiny
rewrite in a real world application like Word.
> It's important to remember that when you start from scratch there is
> absolutely no reason to believe that you are going to do a better
> job than you did the first time.
In case of Bitcoin there is reason to believe that a rewrite would be
better. The first version was hacked together by far less programmers
and by at least one who did not care about readability, what tells me
that he possibly did never work on a real project before. And we now
have a known to work protocol, what did for sure slow down the
development a lot and caused rewrites.
Michael
🗒️ Summary of this message: A programmer suggests a complete rewrite of Bitcoin's codebase, citing the need for clean and readable code, but disagrees with the idea of starting from scratch.
📝 Original message:Monday, July 11, 2011, 10:33:04 AM, Mike Hearn wrote:
>> My overall suggestion is to begin a complete rewrite, inspired by the old
>> code rather than moving a lot of "known to be somehow functional" around.
> This essay is old but still relevant, I think:
> http://www.joelonsoftware.com/articles/fog0000000069.html
It is indeed a very good one but I disagree in two points. First
> As a corollary of this axiom, you can ask almost any programmer
> today about the code they are working on. "It's a big hairy mess,"
> they will tell you. "I'd like nothing better than to throw it out and start over."
If someone asks me this question about the project I'm currently
working on I would never answer like that. This is important in the
threads context because it gives me the confidence to say you can
build very large C++ projects with lots of programers attached over
multiple years and still have a very clean and nice code base. And the
article does also accidently points to one of the roots of messy code.
> Back to that two page function. Yes, I know, it's just a simple
> function to display a window, but it has grown little hairs and
> stuff on it and nobody knows why. Well, I'll tell you why: those are
> bug fixes. One of them fixes that bug that Nancy had when she tried
> to install the thing on a computer that didn't have Internet
> Explorer. Another one fixes that bug that occurs in low memory
> conditions. Another one fixes that bug that occurred when the file
> is on a floppy disk and the user yanks out the disk in the middle.
> That LoadLibrary call is ugly but it makes the code work on old
> versions of Windows 95.
Well, if you can not identify the meaning of some hairs, they are
either attached to the wrong place, in an unclear way or are just
missing a line of comment. There are studies about what size of
function and up to what number of variables per function can be
covered by the average code reading programer. And these numbers are
low.
Second, I agree with the point that you can not give up your market
leadership by beginning from scratch and you will if you do so. Unless
you do it like microsoft did in his example by simultaneously extend
the old code base. And microsoft does this all the time, just look at
Windows 9x compared to Windows NT and the dead object oriented Windows
kernel. (They did buy lots of that but that is not the point here)
The mistake is to compare a small project like Bitcoin to any
application like Word or Netscape. The author did explicitly write
that he does not mean that partial rewrite is a bad thing. And
rewriting the Bitcoin client with three or four guys is like a tiny
rewrite in a real world application like Word.
> It's important to remember that when you start from scratch there is
> absolutely no reason to believe that you are going to do a better
> job than you did the first time.
In case of Bitcoin there is reason to believe that a rewrite would be
better. The first version was hacked together by far less programmers
and by at least one who did not care about readability, what tells me
that he possibly did never work on a real project before. And we now
have a known to work protocol, what did for sure slow down the
development a lot and caused rewrites.
Michael