Spl Assignment1

Only available on StudyMode
  • Download(s) : 148
  • Published : April 25, 2013
Open Document
Text Preview
Survey of Programming Languages – Assignment1

1. Abstraction is the process by which data and programs are defined with a representation similar to its meaning (semantics), while hiding away the implementation details. Abstraction tries to reduce and factor out details so that the programmer can focus on a few concepts at a time. i) Example of abstraction in OOPS. Consider a bank application in which there is a Customer Class. The necessary details to have are: Name, address, date of birth. We don't need how many houses he owns and what vehicles he owns so these are unnecessary details for customer object so we suppress these details in order to come up clearly with essential details i.e. Name, Address, date of birth.

ii) The process of abstraction in Java is used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface). For example, the Java Collections Framework defines the abstraction called java.util.Map. It is an abstract view of a software object that maps from one set of objects into another. The class java.util.TreeMap implements the Map abstraction.

2. Abstract Data Type (ADT) is the logical picture of the data and the operations to manipulate the component elements of the data. Data structure is the actual representation of the data during the implementation and the algorithms to manipulate the data elements. ADT is in the logical level and data structure is in the implementation level. i) ADT is implementation independent. For example, it only describes what a data type List consists (data) and what are the operations it can perform, but it has no information about how the List is actually implemented. Whereas data structure is implementation dependent, as in the same example, it is about how the List implemented ie., using array or linked list. Ultimately, data structure is how we implement the data in an abstract data type.

ii) Data Structures are...
tracking img