This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers:05_abstract [2021/11/05 00:51] nick |
dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers:05_abstract [2022/05/27 19:31] (current) nick |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== 3. Abstract/Virtual Methods ====== | + | ====== 2.3.4.8.4.4 Abstract/Virtual Methods ====== |
- | [[dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers | Return to Operation Data]] | + | [[dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers:start| Return to Operation Data]] |
===== Overview ===== | ===== Overview ===== | ||
[[dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers:05_abstract | Return to Top]] | [[dido:public:ra:1.2_views:3_taxonomic:4_data_tax:08_objects:07_opers:05_abstract | Return to Top]] | ||
- | An **Abstract Method**, or **Virtual Method**, are methods that are declared but have no underlying implementation (i.e., no body). The primary purpose of these methods is to form a base, template or guide for subsequent Data Objects derived from this **Data Object**. The derived Data Objects all have the same behavior defined by Abstract Methods of the base object. The original base **Data Object** is considered as Abstract or Virtual since without an implementation for these methods, the **Data Object** remains a "concept". | + | An **Abstract Method**, or **Virtual Method**, are methods that are declared but has no underlying implementation (i.e., no body). The primary purpose of these methods is to form a base, template, or guide for subsequent Data Objects derived from this **Data Object**. The derived Data Objects all have the same behavior defined by the Abstract Methods of the base object. The original base **Data Object** is considered as Abstract or Virtual since, without implementation for these methods, the **Data Object** remains a "concept". |
Almost all [[dido:public:ra:xapend:xapend.a_glossary:o:oop]] languages provide for the concept of **Abstract** or **Virtual** methods. In recent years, the concept of **Virtual** or **Abstract** **Data Objects** have lost favor to the use of **Generics** or **Templates** which can be instantiated for a particular type. For example, a double-linked-lst template, or a name-value pair template. | Almost all [[dido:public:ra:xapend:xapend.a_glossary:o:oop]] languages provide for the concept of **Abstract** or **Virtual** methods. In recent years, the concept of **Virtual** or **Abstract** **Data Objects** have lost favor to the use of **Generics** or **Templates** which can be instantiated for a particular type. For example, a double-linked-lst template, or a name-value pair template. | ||
Line 19: | Line 19: | ||
| Loose Coupling | Data abstraction in **Data Object** enables loose coupling, by reducing the dependencies at an exponential level. See [[dido:public:ra:1.4_req:2_nonfunc:28_manageability:06_system]] | | | Loose Coupling | Data abstraction in **Data Object** enables loose coupling, by reducing the dependencies at an exponential level. See [[dido:public:ra:1.4_req:2_nonfunc:28_manageability:06_system]] | | ||
| Code Reusability | Using an abstract **Data Object** in the code saves time. Abstract Data Objects avoid the process of writing the same code again.| | | Code Reusability | Using an abstract **Data Object** in the code saves time. Abstract Data Objects avoid the process of writing the same code again.| | ||
- | | Abstraction | Data abstraction in **Data Objects** helps systems hide code complications and implementation details from **Derived Classes** (i.e., subclasses) aiding developers of **Base Object** and **Derived Object** to focus their attention to appropriate level. | | + | | Abstraction | Data abstraction in **Data Objects** helps systems hide code complications and implementation details from **Derived Classes** (i.e., subclasses) aiding developers of **Base Object** and **Derived Object** to focus their attention on an appropriate level. | |
<figure> | <figure> | ||
Line 33: | Line 33: | ||
Doug Crescenzi, | Doug Crescenzi, | ||
13 June 2018, | 13 June 2018, | ||
- | Accessed 3 Novemebr 2021, | + | Accessed 3 November 2021, |
[[https://medium.com/upstate-interactive/solidity-how-to-know-when-to-use-abstract-contracts-vs-interfaces-874cab860c56]] | [[https://medium.com/upstate-interactive/solidity-how-to-know-when-to-use-abstract-contracts-vs-interfaces-874cab860c56]] | ||
- | )) does an excellent job in summarizing the use of Abstract [[dido:public:ra:xapend:xapend.a_glossary:s:smart_contracts]] and Interfaces. | + | )) does an excellent job in summarizing the use of Abstract [[dido:public:ra:xapend:xapend.a_glossary:s:smart_contract]] and Interfaces. |
[[dido:public:ra:xapend:xapend.a_glossary:e:ethereum]] allows for both Interfaces and for Abstract Contracts (i.e., Data Objects). An **Abstract Smart Contract** is any Smart Contract that has at least one method specified that does not have a corresponding body (implementation). This means that the **Abstract Data Object** acts like a **Base Class**, then the **Derived Class** MUST provide an implementation for the abstract method(s). | [[dido:public:ra:xapend:xapend.a_glossary:e:ethereum]] allows for both Interfaces and for Abstract Contracts (i.e., Data Objects). An **Abstract Smart Contract** is any Smart Contract that has at least one method specified that does not have a corresponding body (implementation). This means that the **Abstract Data Object** acts like a **Base Class**, then the **Derived Class** MUST provide an implementation for the abstract method(s). | ||
- | <code solidity> | + | <Code solidity> |
pragma solidity ^0.4.24; | pragma solidity ^0.4.24; | ||
Line 50: | Line 50: | ||
{ return "female"; } | { return "female"; } | ||
} | } | ||
- | </code> | + | </Code> |
+ | <color blue><todo @char>Review </todo></color> | ||
/**=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | /**=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- |