public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Jeff Garzik <jgarzik@exmulti.com>
To: Alan Grimes <agrimes@speakeasy.net>
Cc: bitcoin-development@lists.sourceforge.net
Subject: Re: [Bitcoin-development] overall bitcoin client code quality
Date: Tue, 12 Jul 2011 01:19:28 -0400	[thread overview]
Message-ID: <CA+8xBpcu8dT54sPKCJyjdEcYD=TWsrNx80fjj4S9qtq_XzcFOQ@mail.gmail.com> (raw)
In-Reply-To: <4E1BC9D0.3080104@speakeasy.net>

On Tue, Jul 12, 2011 at 12:13 AM, Alan Grimes <agrimes@speakeasy.net> wrote:
> While spying on the old code, I noticed one major problem that could be
> fixed quite easily. That is, the 1 class-per .h/.cpp rule is completely
> ignored in main.h/cpp and net.h/cpp If all of the classes in the project
> were re-factored to their own files,

This is about the last thing we should do, and it's one of the worst
coding practices of many C++ projects (and unfortunately carried over
to Java by force).  See Knuth and his work on literate programming.
Putting logically similar code -together- is often more impactful and
meaningful than splitting up files into dozens (hundreds or thousands,
in large projects) of tiny, 20-line files.

A project attains zen in the -balance-.  Bitcoin was not well served
by "everything in main.cpp" approach -- but neither is it well served
by splitting wallet / transaction / etc. logic across a great many
files.  We should not have to ask ourselves, Is This Code In
WalletFactory.cpp, WalletTx.cpp, WalletStore.cpp, WalletKey.cpp,
WalletCrypt.cpp, or in s/$F.cpp/$F.h/ ?

Strict, unthinking rules do not buy anything, and can cost us much.

Plus, no matter how you slice it, bitcoin is Hard To Learn and there's
no getting around that.

-- 
Jeff Garzik
exMULTI, Inc.
jgarzik@exmulti.com



  reply	other threads:[~2011-07-12  5:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-10 22:37 [Bitcoin-development] overall bitcoin client code quality Michael Offel
2011-07-10 23:07 ` Douglas Huff
2011-07-10 23:31 ` Jeff Garzik
2011-07-10 23:36 ` Matt Corallo
2011-07-11  2:01 ` Luke-Jr
2011-07-12  4:13   ` Alan Grimes
2011-07-12  5:19     ` Jeff Garzik [this message]
2011-07-11  9:33 ` Mike Hearn
2011-07-12  3:31   ` Gavin Andresen
2011-07-12  7:21   ` John Smith
2011-07-12 22:50   ` Michael Offel
2011-07-12 21:47 Michael Offel
2011-07-12 23:40 ` Gregory Maxwell
2011-07-13  0:17 ` Matt Corallo
2011-07-13 11:50   ` Mike Hearn
2011-07-13 13:04     ` Andy Parkins
2011-07-13 18:37       ` Luke-Jr
2011-07-13 21:41         ` Andy Parkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CA+8xBpcu8dT54sPKCJyjdEcYD=TWsrNx80fjj4S9qtq_XzcFOQ@mail.gmail.com' \
    --to=jgarzik@exmulti.com \
    --cc=agrimes@speakeasy.net \
    --cc=bitcoin-development@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox