Presentation is loading. Please wait.

Presentation is loading. Please wait.

ADT ITEC 320 Lecture 22. ADT Review Generic lists –Ada compilation workout Recursive algorithms –What would a recursive copy look like? Project 4 is up.

Similar presentations


Presentation on theme: "ADT ITEC 320 Lecture 22. ADT Review Generic lists –Ada compilation workout Recursive algorithms –What would a recursive copy look like? Project 4 is up."— Presentation transcript:

1 ADT ITEC 320 Lecture 22

2 ADT Review Generic lists –Ada compilation workout Recursive algorithms –What would a recursive copy look like? Project 4 is up (Dr. Okie’s site) –Due next Tuesday at 10PM

3 ADT Outline ADTs –What are they ? –Why should we study them? –What are they good for?

4 ADT Definition A type in which –What the operations of the type are is public –How it is implemented is private Abstract because irrelevant details are ignored –i.e. how it is implemented is ignored –Benefits / dangers of how something is implemented

5 ADT Place Top down software design –Decompose into smaller problems Bottom up software design –Have tool, use tool –Design new tool if not in toolbelt

6 ADT Examples package BigNumPkg is type BigNum is private; Zero : constant BigNum; One : constant BigNum; BigNumOverFlow : exception; function toString(X: BigNum) return String; function "<" (X, Y : BigNum) return Boolean; function ">" (X, Y : BigNum) return Boolean; function "<=" (X, Y : BigNum) return Boolean; function ">=" (X, Y : BigNum) return Boolean; function "+" (X, Y : BigNum) return BigNum; function "*" (X, Y : BigNum) return BigNum; procedure Get (Item : out BigNum); procedure Put (Item : BigNum; Width : Natural := 1); private Size : constant Positive := 50; type BigNum is array(0..Size-1) of Integer; end BigNumPkg;

7 ADT Design a Stack Queue How would you take a doubly linked list and use it to make a stack / queue?

8 ADT Support Ada –Package Java / C++ –Classes (Java packages != Ada packages) C –What do you think? Others –modules

9 ADT Defining Values it holds Set of operations it performs Declaration Allocation Modification –Querying, Modifying, Combination, conversion, input/output Iteration

10 ADT Iterators What does the term mean to you? Traversal versus access + printing Tree t = new Tree(); // Add some elements here Iterator i = t.getIterator(); while i.hasNext() S.o.p(i.next());

11 ADT Why? Simplicity High level operational thinking Abstractions on top of abstractions Reliability Flexibility Independence

12 ADT Design principle Parnas Principle –Maximize cohesion –Minimize Coupling Why?

13 ADT Question What should make up a standard library of ADT’s?

14 ADT Summary ADTs


Download ppt "ADT ITEC 320 Lecture 22. ADT Review Generic lists –Ada compilation workout Recursive algorithms –What would a recursive copy look like? Project 4 is up."

Similar presentations


Ads by Google