Week 2 Discussion - ADTs and Encapsulation

CMIS 241 - Matt Faulkner

 

 


1. Discuss the importance of data abstraction and data encapsulation for software development.
     I think of data abstraction as the name implies.  Abstraction is the method of making complex things, processes, and ideas easier to manipulate.  It breaks the complex down to more manageable sizes and defines the key parts of the process, leaving open the implementation up to the user.  Similar to what an algorithm may do to a math problem.

     Data encapsulation is an important aspect of OOP in that it helps keep different parts of the program separate from each other.  By "hiding" information within classes, interfaces, and packages,  programmers are allowed greater opportunity to engage the current module more effectively.  Encapsulation keeps the parts of the program small.  Additional benefits are that large programs with tens or hundreds of programmers can all work autonomously without knowing what exactly the other is doing.  They just have to know how to implement the abstractions contained within classes and ADTs.


2. Consider a real world physical or abstract entity (such as digital camera, bank account, warehouse, etc.) and its associated ADT.
    a. Identify four operations of the chosen ADT. As an example, for the BankAccount ADT the following operations could be identified: credit, debit, getBalance and setInterestRate.


    b. Classify the identified operations into constructors, transformers and observers.


    c. Describe the identified operations. Use the descriptions of transformers and observers of the StringLog ADT (textbook, page 71) as a model.

 

         My ADT is an alarm clock.  Four abstractions within the clock are the moveSecondHand, moveMinuteHand, moveHourHand, soundAlarm.

        moveSecondHand, moveMinuteHand, moveHourHand are all transformers since they call for a change in what is displayed and what is going on inside the clock.  The gears moving on the inside make the hands move on the outside visible area of the clock.  The hands moving could be thought of as process coding while the hand movements are the outputs to the standard output.  In this case, the face of the clock.

         The alarm going of I think is an observer.  It merely reports via audible or visual signal that someone set the time and that the internal workings of the clock, its methods, output that signal.

 

Send me email

Visit my website

 


 

Home | Photos | Favorite Links | Matt's Bio

UMUC | Feedback | Guest book | E-mail me

 

FaulknerWeb.com is designed and managed by Matt Faulkner

Domain Name service provided by Namesecure

Web Service by eDataRack
Copyright © 1998 - 2009 [FaulknerWeb.com]. All rights reserved.
Updated: June 16, 2009 09:35 .