BitShares Forum

Main => General Discussion => Topic started by: MartianMouse on September 02, 2014, 05:31:05 am

Title: Developers: Some observations about the codebase.
Post by: MartianMouse on September 02, 2014, 05:31:05 am
Hi Guys,

I'm fascinated with your idea for BitUSD, so I recently bought some BTSX on an exchange and then downloaded the wallet to start experimenting.  Because my wallet kept crashing, I started looking at the bitsharesx codebase on github.

There seems to be some missing tests.  I can't find tests for many of the classes.  I also noticed that several of the classes are very large with dozens of methods each, and frequently the methods themselves are quite long - this makes testing them very difficult.  If you could  refactor these large classes and methods into a more manageable object model, i.e., extract out new classes from the large ones so you have more classes, smaller classes, with fewer methods, it'll be a lot easier to test them.

Ideally, from the perspective of an investor, I'd love to see a TDD approach with the goal of 100% test coverage.  In that scenario I believe that many of the bugs users are experiencing would be avoided, and investor confidence would soar.

I haven't programmed in C++ for over a decade so maybe the tests are there and I just missed them.  In that case, feel free to kick me in the head and point me in the right direction :)
Title: Re: Developers: Some observations about the codebase.
Post by: bodenliu on September 02, 2014, 05:46:23 am
hope the dev look into this
Title: Re: Developers: Some observations about the codebase.
Post by: CrazyCriple on September 02, 2014, 07:09:49 am
Hi Guys,

I'm fascinated with your idea for BitUSD, so I recently bought some BTSX on an exchange and then downloaded the wallet to start experimenting.  Because my wallet kept crashing, I started looking at the bitsharesx codebase on github.

There seems to be some missing tests.  I can't find tests for many of the classes.  I also noticed that several of the classes are very large with dozens of methods each, and frequently the methods themselves are quite long - this makes testing them very difficult.  If you could  refactor these large classes and methods into a more manageable object model, i.e., extract out new classes from the large ones so you have more classes, smaller classes, with fewer methods, it'll be a lot easier to test them.

Ideally, from the perspective of an investor, I'd love to see a TDD approach with the goal of 100% test coverage.  In that scenario I believe that many of the bugs users are experiencing would be avoided, and investor confidence would soar.

I haven't programmed in C++ for over a decade so maybe the tests are there and I just missed them.  In that case, feel free to kick me in the head and point me in the right direction :)

 +5%

Even with the TDD approach it will be hard to get 100% Test Coverage. 70%-80% is more than enough I feel. I don't know c++ so I don't know how difficult it is to mock or stub dependencies but I can imagine it is allot harder then in c#.
Title: Re: Developers: Some observations about the codebase.
Post by: suwoder on September 02, 2014, 09:24:43 am
 +5% +5%
Title: Re: Developers: Some observations about the codebase.
Post by: bytemaster on September 02, 2014, 01:04:07 pm
We have a set of regression tests in the "tests" directory, but you are correct that the number of tests need to be greatly increased. 

Right now our single biggest testing challenge is enumerating all of the possible inputs which I do not think is possible. 
Title: Re: Developers: Some observations about the codebase.
Post by: liondani on September 02, 2014, 01:34:03 pm
  I also noticed that several of the classes are very large with dozens of methods each, and frequently the methods themselves are quite long - this makes testing them very difficult.

the good news is, it will be hard for NSA also...  :P