How to learn the bitshares_toolkit framework quickly for a newbie?

Started by XHC, March 31, 2014, 03:08:10 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Count of La Mancha

Quote from: CrazyBit on May 10, 2014, 03:48:19 AM
Obviously,FC is the fundamental library of bitshare toolkit.  i would like to have an in-depth study, but do not know how/where to start, is there any documentation i can refer to? attached below are some of my questions, appreciated if anyone help to clarify.

1) there is some following code under the data object,what is the purpose? how it work?and when such code will be executed?
FC_REFLECT(..)

2)there are many multiple thread program like below in bitshare toolkit, i  don't quit understand how it work.

my->....complete = fc::async( [=](){ my->process..(); } );

3)Serialization is also frequently used in the toolkit,what data format are the following functions convert to? and where are the data saved after the serialization?any difference of the data format between the following serialization functions

fc::raw::pack( ...); 

pub.serialize();


I am reviewing the code for the community and can shed some light on these questions based upon my observations.

Quote from: CrazyBit on May 10, 2014, 03:48:19 AM
Obviously,FC is the fundamental library of bitshare toolkit.  i would like to have an in-depth study, but do not know how/where to start, is there any documentation i can refer to? attached below are some of my questions, appreciated if anyone help to clarify.
1) there is some following code under the data object,what is the purpose? how it work?and when such code will be executed?
FC_REFLECT(..)


FC_REFLECT is a macro that expands into a template specialization that calls a method for each member.  It seems to enable the creation of different kinds of serialization techniques.   The two primary uses seems to be for what he calls 'raw' and 'json'.   raw appears to be just a binary representation and json is self explanatory.

Quote2)there are many multiple thread program like below in bitshare toolkit, i  don't quit understand how it work.

my->....complete = fc::async( [=](){ my->process..(); } );

This code is actually cooperative multi-tasking and the fc library provides a scheduler that will manage the execution of multiple fibers in a single thread.  This is a very useful construct because you do not have to worry about context switching at arbitrary points like you do with multi-threading.   On the other hand if a fiber blocks without yielding the other tasks in the same thread will not get executed.     fc::async() dispatches a task to be run on the current thread the next time it yields.



crazybit

Obviously,FC is the fundamental library of bitshare toolkit.  i would like to have an in-depth study, but do not know how/where to start, is there any documentation i can refer to? attached below are some of my questions, appreciated if anyone help to clarify.

1) there is some following code under the data object,what is the purpose? how it work?and when such code will be executed?
FC_REFLECT(..)

2)there are many multiple thread program like below in bitshare toolkit, i  don't quit understand how it work.

my->....complete = fc::async( [=](){ my->process..(); } );

3)Serialization is also frequently used in the toolkit,what data format are the following functions convert to? and where are the data saved after the serialization?any difference of the data format between the following serialization functions

fc::raw::pack( ...); 

pub.serialize();

toast

You *could* but that would be ignoring the philosophy we endorsed after the discussion about the role of TLDs we had in the DNS section. Even if there are multiple TLDs with the same rules vikram's question still has merit because we specifically want to have other blockchains with other rulesets.
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

bytemaster

Quote from: toast on April 22, 2014, 11:03:33 PM
But all non .p2p blockchains will have different rulesets (at least the ones we make)

Sent from my SCH-I535 using Tapatalk

Not true.   You could have many different namespaces each with the same rules.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

toast

But all non .p2p blockchains will have different rulesets (at least the ones we make)

Sent from my SCH-I535 using Tapatalk

Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

bytemaster

Quote from: unlimited_power on April 22, 2014, 10:30:28 PM
How do you envision the codebase being organized to enable easily developing and maintaining multiple DACs per family? Specifically, I am considering whether it is feasible and desirable to separate BTS/DNS/P2P specific code into a BTS::DNS::P2P namespace which overrides the relevant stubs in BTS::DNS (additional DNS family members would then follow the same pattern).

The difference between P2P and .dac etc should be config-file based and not code based. 

The only time I would derive from DNS is if I was going to change the rules from the base DNS system.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

vikram

How do you envision the codebase being organized to enable easily developing and maintaining multiple DACs per family? Specifically, I am considering whether it is feasible and desirable to separate BTS/DNS/P2P specific code into a BTS::DNS::P2P namespace which overrides the relevant stubs in BTS::DNS (additional DNS family members would then follow the same pattern).

bytemaster

Serialized to json and binary, works with exception and logging infrastructure.

Eventually scripting language hooks etc. 


Sent from my iPhone using Tapatalk
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

vikram

What do the FC_REFLECT* macros enable you to do in the rest of the fc library?

bytemaster

Asset is an amount plus unit. 

Precision problems have been resolved by changing verification algo.


Sent from my iPhone using Tapatalk
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

bytemaster

It accelerates compile times as well because it removes need to include headers in your headers that is only required for private data. 


Sent from my iPhone using Tapatalk
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

bytemaster


Quote from: John-S on April 18, 2014, 03:59:15 PM
The concept you mention that's used with wallet, is often referred to as the PIMPL pattern (private implementation). 

I first came to appreciate the power of the paradigm when first stumbled on to QT3, and to this day I still point to the QT code base as how to do it right.

Essentially, it allows you to define a class interface that can remain constant while the implementation can be changed without affecting either the binary or the logical interface (dependencies, etc).    Its a beautiful way to encapsulate dependencies and simplify the use of a class library.  And unlike the notion of "private" in a class definition, what you do in the implementation class can be considered truly private.

QT uses this to great effect such that each shared library that implements a class interface, never changes for the life span of a major version release, while the internals, the implementation details can be updated without requiring the users of the libraries to have to recompile and relink.

Even when not building a binary library, I still use this paradigm to provide true isolation between my implementation and the users of a class library.

So nice to see another developer that gets it!!!


Sent from my iPhone using Tapatalk
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

John-S

The concept you mention that's used with wallet, is often referred to as the PIMPL pattern (private implementation). 

I first came to appreciate the power of the paradigm when first stumbled on to QT3, and to this day I still point to the QT code base as how to do it right.

Essentially, it allows you to define a class interface that can remain constant while the implementation can be changed without affecting either the binary or the logical interface (dependencies, etc).    Its a beautiful way to encapsulate dependencies and simplify the use of a class library.  And unlike the notion of "private" in a class definition, what you do in the implementation class can be considered truly private.

QT uses this to great effect such that each shared library that implements a class interface, never changes for the life span of a major version release, while the internals, the implementation details can be updated without requiring the users of the libraries to have to recompile and relink.

Even when not building a binary library, I still use this paradigm to provide true isolation between my implementation and the users of a class library.

vikram

Quote from: bytemaster on April 18, 2014, 05:10:58 AM
Quote from: John-S on April 18, 2014, 02:36:27 AM
I'm a noob myself, but have learned a lot in the past couple of days.  Message me with your specific questions and I'll see what I can't do to help bootstrap you along.

- John "S"

Post questions here and I can double check understanding and future devs can see the questions/answers as well.


  • What is the purpose of separating some of the class functionality into the *_impl inner classes (e.g. bts::wallet::detail::wallet_impl)?
  • What exactly does the asset class now represent? Won't we run into precision issues now that it is 64 bits again (rather than 128)?

bytemaster

Quote from: John-S on April 18, 2014, 02:36:27 AM
I'm a noob myself, but have learned a lot in the past couple of days.  Message me with your specific questions and I'll see what I can't do to help bootstrap you along.

- John "S"

Post questions here and I can double check understanding and future devs can see the questions/answers as well.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

John-S

I'm a noob myself, but have learned a lot in the past couple of days.  Message me with your specific questions and I'll see what I can't do to help bootstrap you along.

- John "S"

XHC

Quote from: toast on April 01, 2014, 01:36:39 AM
I guess I'll just start putting things up as issue on github for anyone to do. There should be a lot more once we get people testing with an alpha client
Thanks. Hope that would be helpful.

toast

I guess I'll just start putting things up as issue on github for anyone to do. There should be a lot more once we get people testing with an alpha client
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

XHC

Quote from: toast on March 31, 2014, 04:34:40 PM
There are many "learning tasks" we could assign. If you are interested I will make github issues specifically for you
I am really interested. But I'm a little confused, you mean you will assign specific learning task to me or something else?

Talos

Quote from: oco101 on March 31, 2014, 07:48:21 PM
Quote from: toast on March 31, 2014, 04:34:40 PM
There are many "learning tasks" we could assign. If you are interested I will make github issues specifically for you

Or maybe make a section of  "learning  tasks" for everybody who want's to learn instead just for a specific user ?
Please count me in too. Interested and keen to learn more.

oco101

Quote from: toast on March 31, 2014, 04:34:40 PM
There are many "learning tasks" we could assign. If you are interested I will make github issues specifically for you

Or maybe make a section of  "learning  tasks" for everybody who want's to learn instead just for a specific user ?

toast

There are many "learning tasks" we could assign. If you are interested I will make github issues specifically for you
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

bytemaster

Quote from: bitsky on March 31, 2014, 03:32:49 PM
Quote from: bytemaster on March 31, 2014, 03:25:35 PM
Quote from: bitsky on March 31, 2014, 03:08:10 PM
If I want to develop a new DAC.
Is there any guide or suggest?
Thanks!

BitShares toolkit is under rapid development, we are putting together tutorials and examples.
It sounds good. How soon will the tutorials and examples be released?  I'm eager.

Aren't we all!   I have to prepare for two speaking events, take a week to speak, and launch BitShares XT prior to getting this done....  in the mean time Toast & HackFisher are both learning from the code and the forum is available to answer questions.

There are many examples in the toolkit (dns,lotto,me,btsx,etc) that all extend the basic tools.   
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

XHC

Quote from: bytemaster on March 31, 2014, 03:25:35 PM
Quote from: bitsky on March 31, 2014, 03:08:10 PM
If I want to develop a new DAC.
Is there any guide or suggest?
Thanks!

BitShares toolkit is under rapid development, we are putting together tutorials and examples.
It sounds good. How soon will the tutorials and examples be released?  I'm eager.

bytemaster

Quote from: bitsky on March 31, 2014, 03:08:10 PM
If I want to develop a new DAC.
Is there any guide or suggest?
Thanks!

BitShares toolkit is under rapid development, we are putting together tutorials and examples. 
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

XHC

If I want to develop a new DAC.
Is there any guide or suggest?
Thanks!