1 / 20

COP 3331 Object Oriented Analysis and Design Chapter 8 – Object-Oriented Application Framework

COP 3331 Object Oriented Analysis and Design Chapter 8 – Object-Oriented Application Framework. Jean Muhammad. Overview. Application Frameworks Collections Frameworks AWT and SWING Input/Output Framework. Applications Frameworks.

Download Presentation

COP 3331 Object Oriented Analysis and Design Chapter 8 – Object-Oriented Application Framework

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COP 3331 Object Oriented Analysis and DesignChapter 8 – Object-Oriented Application Framework Jean Muhammad Reference – Object Oriented Software Development Using Java - Jia

  2. Overview • Application Frameworks • Collections Frameworks • AWT and SWING • Input/Output Framework Reference – Object Oriented Software Development Using Java - Jia

  3. Applications Frameworks A framework is defined as a set of collaborating classes that represent usable designs of software systems that have some application for a particular domain. The main goal of an application framework is to support the reuse of designs. Reference – Object Oriented Software Development Using Java - Jia

  4. Applications Frameworks • Characteristics • Extensibility: A framework consists of a set of abstract classes and interfaces to be extended and specialized. • Inversion Control: Frameworks represent a higher level of abstraction then we normally think of. Instead of the application controlling the flow of execution, it will be the framework. • Design Patterns as Building Blocks: Design patterns are a schematic description of reusable components while frameworks are executable programs. Reference – Object Oriented Software Development Using Java - Jia

  5. Applications Frameworks • Design Requirements • Completeness: A framework must provide a family of classes. • Adaptability: All platform-specific aspects of the framework must be clearly identified and isolated. • Efficiency: Components must be easily identified and documented. • Safety: Each abstraction must bye type-safe to avoid behavior problems. • Simplicity: Must have clear and consistent organization. • Extensibility: Must be able to add new classes Reference – Object Oriented Software Development Using Java - Jia

  6. Applications Frameworks • The Collections Frameworks: An object that contains other objects. • Bags: A collection of unordered elements. May be duplicates. Least restrictive. • Sets: An unordered collection of elements. No duplicates are allowed: {e1, e2, e3, e4,.. en} • Lists: An ordered collection of elements. Duplicates are allowed. • Maps: A collection of unordered collection of key-value pairs denoted by key->. They are also known as functions, dictionaries, or associated arrays. Keys must be unique {k1->v1, k 2->v2, k3->v3, k4->v4, .. kn->vn} • Sort Maps: Elements are sorted by keys. Reference – Object Oriented Software Development Using Java - Jia

  7. Applications Frameworks • Interface Collections • Common aspects of a class should be handled in a uniform manner. Collection Map Set List Sortedmap SortedSet Reference – Object Oriented Software Development Using Java - Jia

  8. Methods of Interface Collection • add(o) • addAll(c) • clear() • contains(o) • containsAll(c) • isEmpty) • iterator() • remove(o) • removeAll(c) • retainall(c) • size() o – is an object , c – is a type collection Reference – Object Oriented Software Development Using Java - Jia

  9. Methods of Interace set • This extends the Collection interface • add(o) adds the elements, checks to make sure there are no duplicates. • addAll(c) Adds elements if they are not already present. Reference – Object Oriented Software Development Using Java - Jia

  10. Methods of Interface List • List interface also extends Collection interface • add(i,o) - remove(i) • add(o) - remove(o) • addAll(c) - set (i,o) • addAll(i,c) - subList(i,j) • get(i) • indexOf(o) • lastIndexOf(o) Reference – Object Oriented Software Development Using Java - Jia

  11. Methods of Interface Map • Does not extend Collection or Set interface • clear() • containsKey(k) • containsValue(v) • entrySet() • get(k) • isEmpty() • keySet() • put(k,v) • putAll(m) • remove(k) • size() • values() Reference – Object Oriented Software Development Using Java - Jia

  12. Concrete Collections - Discussion • HashSet IdentifyHashMap • LinkedHashSet LinkedHashMap • TreeSet TreeMap • ArrayList HashTable • LinkedList • Vector • HashMap Reference – Object Oriented Software Development Using Java - Jia

  13. Methods of Interface Iterator • hasNext() • next() • remove() Reference – Object Oriented Software Development Using Java - Jia

  14. Methods of Interface ListIterator • add(o) • hasNext() • hasPrevious() • next() • nextIndex() • previous() • previousIndex() • remove() • set(o) Reference – Object Oriented Software Development Using Java - Jia

  15. AWT and SWING • GUI components: Known as widgets. Examples include button, label, checkbox, scrollbar, frame, dialog • Layout Managers: Define strategies for laying out GUI components. Commonly used layout managers include FlowLayout and BorderLayout • Events and event listeners: Represent user input or actions. KeyEvent, MouseEvent are examples. • Graphics and Imaging classes: Allows components to be drawn. Graphics(Color, Font, Graphics, etc). Geomentry (Point, Rectangle, Dimension, etc), Imaging( Image, Icon, etc). Reference – Object Oriented Software Development Using Java - Jia

  16. GUI Component Classes in AWT Component * Button Container Canvas Panel Window CheckBox Choice Frame Dialog Label FileDialog List Scrollbar Java.applet.Applet TextComponent TextArea TextField Reference – Object Oriented Software Development Using Java - Jia

  17. Swing Components Component Container * JComponent JButton JPanel Window JLabel JCombBox JApplet Frame Dialog JCheckBox JList JFrame JDialog JScrollBar JWindow JTextComponent JTextField JTextArea Reference – Object Oriented Software Development Using Java - Jia

  18. Input/Output Framework • Stream I/O: Sequence of bytes. A stream may be opened for reading and writing but not both. • Random Access I/O: Random access I/O supports reading and writing data at any position in the file. A random access file may be opened for both reading and writing. Reference – Object Oriented Software Development Using Java - Jia

  19. Byte Streams Input Method Output Method Description read() write(b) Reads/Writes single byte read(ba) write(ba) Reads/Writes byte array read(ba,off,leng) write(ba,off,leng) Reads/Writes segment of byte array skip(n) Skips over n bytes close () close() Closes the stream Reference – Object Oriented Software Development Using Java - Jia

  20. Random Access Files • Constructor RandomAccessFile(filename,mode) Creates a random-access file that reads from, and optionally writes to, the file name filename. The mode argument is a strng whose value must be either “r”, for ready only, or “rw”, for read-write. seek(L) Move the read/write position to the L-th byte. skipBytes(i) Moves the read/write position I bytes relative to the current position. Moves forward or backward. Reference – Object Oriented Software Development Using Java - Jia

More Related