Bitcoin Forum
November 06, 2024, 09:25:08 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2] 3 4 5 »  All
  Print  
Author Topic: Bitcoin source code is a giant mess  (Read 10754 times)
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
June 04, 2013, 03:11:14 PM
 #21

Close enough to have a working goto... Smiley

Hmm... am not really sure about that (and no C++ guru would ever recommend using it) - the problem is that the compiler needs to handle all the object dtors correctly (the reason why it is *not easier for the compiler*).

I am not sure that g++ (or other major compilers) give such a guarantee.

It's a bit like using *void* pointers (another common C idiom that is *bad* in C++).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
jdbtracker
Hero Member
*****
Offline Offline

Activity: 727
Merit: 500


Minimum Effort/Maximum effect


View Profile
June 04, 2013, 03:24:01 PM
Last edit: June 04, 2013, 09:24:41 PM by jdbtracker
 #22

I don't know how to program C++, but I can tell from what I do know that the Bitcoin system feels intentionally limited.

the block chain limit of 1mb... creates fee scarcity fluctuations; The limit will be hit sooner and economic effects from the fees will be visible once we get close to it.

the size of the coin limit of 21 million, if it had been 210 million with 500 coin initial block release, the price would more easily be able to handle large fluctuations a far smoother accent to it's final value.Having the limit that small to me feels like it was done intentionally for experimental observations, more scarcity econonomics.

also the number of zeros past the period also feels like a mistake with large disparities in value between two currencies it becomes very difficult to transfer financial information when large chunks of an economy are absorbed, Think along the lines of 100 trillion yen cap value to bitcoin with someone trying to exchange a small amount to a country like zimbabwe with a 1million/1USD value... there are not enough digits to transfer the value accurately in that situation, you'd be limited to doing 100 thousand zimbabwe dollar transaction... what if you can buy a cup of coffee in zimbabwe with 100 Z dollars? you wouldn't be able to do the micro-transaction.

10 minute confirms? when transactions can go around the globe in under a second. with a 1mb limit every 1 minute it could more effectively use the network overall power and increase security on a timed basis.

It would not surprise me that the code was written intentionally for big problems to occur much sooner, for expermentation... Bitcoin really is an experiment, the limits it has are made to cause instability intentionally or to observe data fluctuations more easily. The code itself could be flawed and vague on purpose.

So what is everyone doing to improve these possibly intentional limitations?


If you think my efforts are worth something; I'll keep on keeping on.
I don't believe in IQ, only in Determination.
misterbigg (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001



View Profile
June 04, 2013, 03:34:56 PM
 #23

...

Completely off-topic. This post is only about the form of the code and not its content (which is equally important, but not the subject of this thread).
jdbtracker
Hero Member
*****
Offline Offline

Activity: 727
Merit: 500


Minimum Effort/Maximum effect


View Profile
June 04, 2013, 03:45:16 PM
 #24

it ties into the topic,

What are the problems that the code creates? What problems will it cause?

If you think my efforts are worth something; I'll keep on keeping on.
I don't believe in IQ, only in Determination.
misterbigg (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001



View Profile
June 04, 2013, 03:46:40 PM
 #25

it ties into the topic, What are the problems that the code creates? What problems will it cause?

Hard to read, harder to change without breaking something.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
June 04, 2013, 03:47:42 PM
 #26

The fact that goto has been used badly doesn't make it a bad instrument: it's a great instrument if you know exactly when to use or not use it.

Donald Knuth and Linus Torvalds both agree with this sentiment.  Smiley

Just like any other tool, you have to know when to use it, and when not to use it.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1134


View Profile
June 04, 2013, 03:47:53 PM
 #27

If you're working on a native Mac wallet, you might want to contact Colin Tulloch. He's also exploring this. I've been trying to convince him to use bitcoinj compiled down to native code with GCJ/CNI. I prototyped this last year and got an Objective-C++ app that could load bitcoinj wallets up and running, the end result was a native .app without any Java dependencies. Unfortunately for various reasons I stopped rebasing that branch and the support wasn't fully documented or integrated into bitcoinj. But writing a real SPV wallet app is a lot of work, so reusing the work we've done in the Java world makes a ton of sense. From the code perspective it looks like writing C++ except you don't need to delete objects and the API uses jstrings instead of std::string or NSString.
misterbigg (OP)
Legendary
*
Offline Offline

Activity: 1064
Merit: 1001



View Profile
June 04, 2013, 04:06:11 PM
 #28

Donald Knuth and Linus Torvalds both agree with this sentiment.  Smiley Just like any other tool, you have to know when to use it, and when not to use it.

Bitcoin source is by no means even remotely close to being a model of C++ exposition. Expedience always takes priority over tidiness.
oleganza
Full Member
***
Offline Offline

Activity: 200
Merit: 104


Software design and user experience.


View Profile WWW
June 04, 2013, 04:42:08 PM
 #29

2. Excessive use of C++ subclasses and operators makes it hard to read code. You see a << b, but it actually goes to a very specific place which is not entirely obvious where.

Streaming operators << and >> have always been the standard way of doing I/O in C++ so are you saying these operators are being used for something *other than streaming*?


I have nothing against using << as a streaming operator. The problem is that it's much harder to search for any operators in use (be it "<<" or "+"). Especially when you pointer-dereference operator overload. Or implicit copy constructors. Yes, code may look elegant for a mathematician, but inside an app where you have tons of multi-word symbols, operator density or implicitness is painful.

When you have "[a add:b]" instead of "a + b" it's much clearer what is going on and you can quickly find all occurrences of -add: method call.


Bitcoin analytics: blog.oleganza.com / 1TipsuQ7CSqfQsjA9KU5jarSB1AnrVLLo
piotr_n
Legendary
*
Offline Offline

Activity: 2055
Merit: 1359


aka tonikt


View Profile WWW
June 04, 2013, 04:43:39 PM
 #30

2. Excessive use of C++ subclasses and operators makes it hard to read code. You see a << b, but it actually goes to a very specific place which is not entirely obvious where.

Streaming operators << and >> have always been the standard way of doing I/O in C++ so are you saying these operators are being used for something *other than streaming*?


I have nothing against using << as a streaming operator. The problem is that it's much harder to search for any operators in use (be it "<<" or "+"). Especially when you pointer-dereference operator overload. Or implicit copy constructors. Yes, code may look elegant for a mathematician, but inside an app where you have tons of multi-word symbols, operator density or implicitness is painful.

When you have "[a add:b]" instead of "a + b" it's much clearer what is going on and you can quickly find all occurrences of -add: method call.
+1
I also hate these symbols, because of the same reason.
You just cannot find a function that implements it. And worse; it can either be in a header, or in a cpp file... and it can be overridden/inherited, so: good luck looking for it!

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
sickpig
Legendary
*
Offline Offline

Activity: 1260
Merit: 1008


View Profile
June 04, 2013, 04:57:27 PM
 #31

Presented without comment:



link (github.com)


Linux kernel use goto quite extensively

Bitcoin is a participatory system which ought to respect the right of self determinism of all of its users - Gregory Maxwell.
mmeijeri
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500

Martijn Meijering


View Profile
June 04, 2013, 05:05:45 PM
 #32

Let's not turn this into a C++ coding standards discussion.

ROI is not a verb, the term you're looking for is 'to break even'.
willphase
Hero Member
*****
Offline Offline

Activity: 767
Merit: 500


View Profile
June 04, 2013, 10:57:49 PM
 #33

I would suggest that if you see problems with the bitcoin codebase, you submit a patch (and appropriate tests for your patch) via the bitcoin github, and make the codebase better!  The code is open source!

Will

mmeijeri
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500

Martijn Meijering


View Profile
June 04, 2013, 11:00:08 PM
 #34

We're far beyond that point. The code needs very thorough restructuring. That can be done incrementally, even while others are adding functionality, but I think it is going to be very hard to get a consensus on the needed changes.

ROI is not a verb, the term you're looking for is 'to break even'.
2112
Legendary
*
Offline Offline

Activity: 2128
Merit: 1073



View Profile
June 05, 2013, 01:45:44 AM
 #35

We're far beyond that point. The code needs very thorough restructuring. That can be done incrementally, even while others are adding functionality, but I think it is going to be very hard to get a consensus on the needed changes.
The consesus about the needed changes could conceivably be that the official Bitcoin client switches from the "Satoshi legacy C++" to one of the newer candidate codebases, e.g. the Java code from Hungary.

For me it is good to read more and more comments about the need to stop treating Satoshi (and his legacy code base and protocol) as an inviolate revelation and more as an ingenious sketch of the future.

Time for me to repost my favourite picture of an amber:
It is an ambodiment of both the mess and the beauty.

Please comment, critique, criticize or ridicule BIP 2112: https://bitcointalk.org/index.php?topic=54382.0
Long-term mining prognosis: https://bitcointalk.org/index.php?topic=91101.0
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1086


Ian Knowles - CIYAM Lead Developer


View Profile WWW
June 05, 2013, 03:24:20 AM
 #36

Linux kernel use goto quite extensively

Am pretty sure that it is C not C++ (and yes they are two very different languages).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
mmeijeri
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500

Martijn Meijering


View Profile
June 05, 2013, 06:37:59 AM
 #37

Switching to another codebase is certainly one possibility,  but refactoring the existing code is also a realistic option. Starting with a good test harness around bitcoind would be a good start for both options. And the existence of an API makes this a lot easier.

ROI is not a verb, the term you're looking for is 'to break even'.
LvM
Full Member
***
Offline Offline

Activity: 126
Merit: 100


View Profile
June 09, 2013, 05:45:38 PM
 #38

Worst problem of BTC is not the code but the basic "cash/change" logic ignoring all fundamentals of GAAP.
Ripple -though in this respect much better structured- cannot be trusted due to many other reasons.

BTC violates GAAP, result a MESS  https://bitcointalk.org/index.php?topic=211835.0
Anforderungen an eine PROFESSIONELLE BTC-Anwendung https://bitcointalk.org/index.php?topic=189669
BANKGEHEIMNIS mit BTC gleich NULL!? https://bitcointalk.org/index.php?topic=188383 Antwort: Ja, wenn man nicht höllisch aufpaßt.
oleganza
Full Member
***
Offline Offline

Activity: 200
Merit: 104


Software design and user experience.


View Profile WWW
June 09, 2013, 06:47:19 PM
 #39

Worst problem of BTC is not the code but the basic "cash/change" logic ignoring all fundamentals of GAAP.
Ripple -though in this respect much better structured- cannot be trusted due to many other reasons.

Can you expand on cash/change problem? What's wrong with it?

Bitcoin analytics: blog.oleganza.com / 1TipsuQ7CSqfQsjA9KU5jarSB1AnrVLLo
mmeijeri
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500

Martijn Meijering


View Profile
June 09, 2013, 06:48:05 PM
 #40

Not again, he already has his own thread.

ROI is not a verb, the term you're looking for is 'to break even'.
Pages: « 1 [2] 3 4 5 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!