|
Prev: When not to use interfaces?
Next: Session Factory Error
From: mashrur.mia on 6 Nov 2006 15:31 Hello all, First of all, let me apologize for bringing this topic as it has been talked about many times. My problem is that I was not able to find satisfactory answers from the earlier discussion on this issue. What is the actual definition of Abstract Data Type? And I have found two different approach people use to answer this. 1. (from wikipedia) A specification of a set of data and the set of operations that can be performed on the data. Such a data type is abstract in the sense that it is independent of various concrete implementations. This and other definition like it, emphases that ADT is about separation between interface and implementation. The "Abstract" is basically used as "abstracting implementation from the interface", "abstracting operation from method" 2. ADT is about modeling. It is abstract cause it only cares about the essential properties of the "object" it is abstracting (or modeling) This kind of definition emphases ABSTRACTION as "selective examination of certain aspects of a problem" Here is a link that explains this sorts definition of ADT http://www.zib.de/Visual/people/mueller/Course/Tutorial/node4.html#SECTION00400000000000000000 Even deitel & deitel on their "C++: How to program" seem to define ADT it like this. Now which is it? Both seems logical but they seem different to me. Built in types fits both the definition. For definition 1. ints or floats or chars are ADT because, we don't need to care about the details how they are represented, only use them through their interface such as addition, subtraction, multiplication etc. For definition 2, ints or floats and chars are ADT because they only represent certain aspect of the real life int, float or char. Real life ints are not just 32-bit So now help me!!!! Sa'ad
From: Dmitry A. Kazakov on 7 Nov 2006 03:41 On 6 Nov 2006 12:31:03 -0800, mashrur.mia(a)gmail.com wrote: > First of all, let me apologize for bringing this topic as it has been > talked about many times. My problem is that I was not able to find > satisfactory answers from the earlier discussion on this issue. > > What is the actual definition of Abstract Data Type? > > And I have found two different approach people use to answer this. > > 1. (from wikipedia) A specification of a set of data and the set of > operations that can be performed on the data. Such a data type is > abstract in the sense that it is independent of various concrete > implementations. > > This and other definition like it, emphases that ADT is about > separation between interface and implementation. The "Abstract" is > basically used as "abstracting implementation from the interface", > "abstracting operation from method" > > 2. ADT is about modeling. It is abstract cause it only cares about the > essential properties of the "object" it is abstracting (or modeling) > > This kind of definition emphases ABSTRACTION as "selective examination > of certain aspects of a problem" > > Here is a link that explains this sorts definition of ADT > http://www.zib.de/Visual/people/mueller/Course/Tutorial/node4.html#SECTION00400000000000000000 > > Even deitel & deitel on their "C++: How to program" seem to define ADT > it like this. > > Now which is it? Both seems logical but they seem different to me. > > Built in types fits both the definition. For definition 1. ints or > floats or chars are ADT because, we don't need to care about the > details how they are represented, only use them through their interface > such as addition, subtraction, multiplication etc. > > For definition 2, ints or floats and chars are ADT because they only > represent certain aspect of the real life int, float or char. Real life > ints are not just 32-bit The definition 2 is narrower and to some extent infeasible. Type definition (all types are ADTs) obviously cannot depend on what is the purpose of its use in a particular program. According to 2 "unsigned" is an ADT when used to count things and not when models a mod-32 ring. That's rubbish. In other words, inadequateness of a type as a model has nothing to do with its "abstractness." It is abstract just because it is a programming language entity. So I vote for 1. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de
From: Manuel Collado on 7 Nov 2006 05:58 mashrur.mia(a)gmail.com escribi?: > Hello all, > > First of all, let me apologize for bringing this topic as it has been > talked about many times. My problem is that I was not able to find > satisfactory answers from the earlier discussion on this issue. > > What is the actual definition of Abstract Data Type? > > And I have found two different approach people use to answer this. > > 1. (from wikipedia) A specification of a set of data and the set of > operations that can be performed on the data. Such a data type is > abstract in the sense that it is independent of various concrete > implementations. > > This and other definition like it, emphases that ADT is about > separation between interface and implementation. The "Abstract" is > basically used as "abstracting implementation from the interface", > "abstracting operation from method" > > 2. ADT is about modeling. It is abstract cause it only cares about the > essential properties of the "object" it is abstracting (or modeling) > > This kind of definition emphases ABSTRACTION as "selective examination > of certain aspects of a problem" > > Here is a link that explains this sorts definition of ADT > http://www.zib.de/Visual/people/mueller/Course/Tutorial/node4.html#SECTION00400000000000000000 > > Even deitel & deitel on their "C++: How to program" seem to define ADT > it like this. > > Now which is it? Both seems logical but they seem different to me. Sorry, I don't see two different definitions. Looking at the link given for definition 2: "Definition (Abstract Data Type) An abstract data type (ADT) is characterized by the following properties: 1. It exports a type. 2. It exports a set of operations. This set is called interface. 3. Operations of the interface are the one and only access mechanism to the type's data structure. 4. Axioms and preconditions define the application domain of the type." Isn't it equivalent to definition 1? Description 2 (ADT about modelling) is not really a definition. It just says that because ADT is an abstraction mechanism, it can be used to model things. > > Built in types fits both the definition. For definition 1. ints or > floats or chars are ADT because, we don't need to care about the > details how they are represented, only use them through their interface > such as addition, subtraction, multiplication etc. Yes. > > For definition 2, ints or floats and chars are ADT because they only > represent certain aspect of the real life int, float or char. Real life > ints are not just 32-bit Yes. No contradiction. Primitive types are abstract anyway. > > So now help me!!!! Hope this helps. -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado
From: Ed on 7 Nov 2006 06:51 mashrur.mia(a)gmail.com skrev: > Hello all, > > First of all, let me apologize for bringing this topic as it has been > talked about many times. My problem is that I was not able to find > satisfactory answers from the earlier discussion on this issue. > > What is the actual definition of Abstract Data Type? > (Apologies if this posts twice; my client blew up on first delivery.) Well, straight off: I don't know. But I certainly feel that your first definition (abstract vs. concrete implementation) is closer to the mark. After all, and ADT is still a data type, which is a computer artifact; and there's no sense in which a data type can be anything other than abstract for that which it represents (unless it represents another data type). In other words, using your first definition gives you a useful distinction (abstract data type vs. concrete data type within a computing framework); but your second defintion gives you no useful distinction (an abstract data type that represents a tiger has no equivalent within a computing framework of a non-abstract data type (which is the tiger itself) within that framework). In other words, there are no tigers in microprocessors; but there are abstract representations of tigers and there are concrete representations of tigers in microprocessors, and they are clearly distinguishable. ..ed -- www.EdmundKirwan.com - Home of The Fractal Class Composition. Download Fractality, free Java code analyzer: www.EdmundKirwan.com/servlet/fractal/frac-page130.html
From: Laurent Deniau on 7 Nov 2006 07:41
mashrur.mia(a)gmail.com wrote: > Hello all, > > First of all, let me apologize for bringing this topic as it has been > talked about many times. My problem is that I was not able to find > satisfactory answers from the earlier discussion on this issue. > > What is the actual definition of Abstract Data Type? > > And I have found two different approach people use to answer this. > > 1. (from wikipedia) A specification of a set of data and the set of > operations that can be performed on the data. Such a data type is > abstract in the sense that it is independent of various concrete > implementations. > > This and other definition like it, emphases that ADT is about > separation between interface and implementation. The "Abstract" is > basically used as "abstracting implementation from the interface", > "abstracting operation from method" > > 2. ADT is about modeling. It is abstract cause it only cares about the > essential properties of the "object" it is abstracting (or modeling) > > This kind of definition emphases ABSTRACTION as "selective examination > of certain aspects of a problem" > > Here is a link that explains this sorts definition of ADT > http://www.zib.de/Visual/people/mueller/Course/Tutorial/node4.html#SECTION00400000000000000000 > > Even deitel & deitel on their "C++: How to program" seem to define ADT > it like this. The meaning of ADT may depend on the context. But in C and C++, an ADT is an incomplete type, that is a type which is only declared and not defined. For example (C and C++): struct A; is an incomplete type. Therefore you cannot intanciate it, nor access an instance of it. You can only take a reference to an instance which remains an Abstract Thing. This is why an ADT comes nearly always with an associated set of services called its interface (point 1.). struct A *a = A_new(); A_process(a); A_delete(a); But ADT is also important to avoid coupling between the interface side (users) and the implementation side (developpers), which simplify a lot modeling (point 2.). Developpers are free to change the implementation without breaking the users code as far as the interface does not change. a+, ld. |