5

I understand a contract being described as a top level abstraction, but what are some architectural and design advantages (and disadvantages) for developers in isolating their design classes into separate contracts? What are the general gas expense implications of separating functionality among contracts (for libraries, data/logic division) or spawning new contracts from existing contracts?

Personally I view contracts as an even higher level of abstraction than a class in a given oop (lower than a file, but higher than other general object types) What is the driving motivation to treat contracts as classes in Solidity?

  • @SilentCicero outlined some broad strokes in a post (second sub-heading) – Zach_is_my_name Mar 28 '16 at 18:41
  • What kind of answer do you expect? – Waqar Lim Mar 28 '16 at 19:49
  • Two types of answers to two separate questions. One is a matter of interpretation (ie. why are contracts treated as classes), one more concrete (ie. Do multi contract sols generally cost more to the user/caller than single contract sols, and if so by what ratio/formula). I believe Dodson's statements authoritatively validate the latter question. – Zach_is_my_name Mar 28 '16 at 20:15
1

One reason for breaking down the contract into multiple classes will be to enable upgrades and big fixes. The design of the contract will need to isolate data from the logic to allow for changes to both.

  • 1
    Yes, but is the complexity worth it? Not to mention the complex interactions between contracts regarding gas, EVM exceptions, type safety, trust... – Paul S Apr 1 '16 at 14:40
  • That is a question I am asking as well. But, bugs and enhancements always happen. I can't ignore them... – Walt D Apr 1 '16 at 17:43
  • I see that, what's really unclear is how classes in solidity map to abstract data types without ballooning the number of contracts. And if number does inflate, what are the consequences. Dapp design is the most critical and least talked about (never mind documented) aspect of the entire space – Zach_is_my_name Apr 1 '16 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.