Title: Idea of Final Project for ICS4M in Java
1Idea of Final Project for ICS4M in Java
2Application for Small Businessthat includes
- GUI (Java Swing classes) as a front end
- Collections Framework as a back end
3Advantage of Using Java and NetBeans
- You can download for free Java 2 SDK, Standard
Edition, and NetBeans IDE software bundle from
www.sun.com/download as well as documentation for
a library of classes - Students can download and install this IDE on
their home computers so they can do their
assignments at home - Java is the most popular language used in
industry - A lot of resources on Sun site and Internet
4Team Work
- Project was implemented by teams of 2-3 students,
each responsible for their part of the
application - Students implemented all the stages of the
programming life cycle
5Knowledge Base Required to Implement This Project
- For Front End (GUI)
- Knowledge of Swing classes
- Creation of frames, panels, windows, menus
- Layout Managers
- Changing borders, fonts, colours, sizes of
components - Use of Java GIU Forms
6Knowledge Base Required to Implement This Project
- For Back End
- Knowledge of Collections Framework
- Handling Events
- Exceptions
- Input/Output Streams
7Phases of Typical Development Cycle
- Proposal Specification
- contains the basic system functionality and forms
the bounds of the application - Design
- involves defining the desired data, features, and
the screen layouts of the application - Prototype
- contains the basic screens, any data structure,
but none of the functionality coding to provide
with the system look and feel, navigation (menus,
etc), and the basic system functionality.
8Phases of Typical Development Cycle
- Pilot System
- includes coding of the system and developer
testing - User Testing / Acceptance
- a period of user testing to ensure the system
meets the specification and the client's needs - User Training / System Documentation
- documentation including manual may be required
9Collection
- A collection ( sometimes called a container )
represents an object that groups multiple
elements into a single unit. - Collections are used to store, retrieve,
manipulate, and communicate aggregate data. - Collection implementations in earlier versions of
the Java platform included Vector, Hashtable, and
array
10Collections Framework
- The collections framework is a unified
architecture for representing and manipulating
collections, allowing them to be manipulated
independently of the details of their
representation .
11Collections Framework Consists Of
- Collection Interfaces - Represent different types
of collections, such as sets, lists and maps.
These interfaces form the basis of the framework.
- General-purpose Implementations - Primary
implementations of the collection interfaces. - Legacy Implementations - The collection classes
from earlier releases, Vector and Hashtable, have
been retrofitted to implement the collection
interfaces. - Wrapper Implementations - Add functionality, such
as synchronization, to other implementations.
12Interfaces
- Interfaces contain only abstract methods
(signatures without implementation) - Interfaces allow collections to be manipulated
independently of the details of their
representation.
13Interface Used in Final Project
- public interface DataInterface
- public boolean addRecord(MyRecord data,String
key) - public boolean deleteRecord(String key)
- public MyRecord findRecord(String key)
- public boolean editRecord(String key,
MyRecord_2 newData) - public int numberOfRecords()
14Advantages Of A Collections Framework
- Reduces programming effort by providing useful
data structures and algorithms so you don't have
to write them yourself. - Increases performance by providing
high-performance implementations of useful data
structures and algorithms. - Provides interoperability between unrelated APIs
by establishing a common language to pass
collections back and forth.
15Core Collection Interfaces
16Six Collection Interfaces.
- The most basic interface is Collection. Three
interfaces extend Collection Set, List, and
SortedSet. - The other two collection interfaces, Map and
SortedMap, do not extend Collection, as they
represent mappings rather than true collections.
These interfaces contain collection-view
operations, which allow them to be manipulated as
collections.
17Collection
- The root of the collection hierarchy. A
collection represents a group of objects, known
as its elements.
18Set
- A collection that cannot contain duplicate
elements. - This interface models the mathematical set
abstraction and is used to represent sets, such
as the cards comprising a poker hand, the courses
making up a student's schedule, or the processes
running on a machine.
19List
- An ordered collection (sometimes called a
sequence). Lists can contain duplicate elements. - The user of a List generally has precise control
over where in the List each element is inserted,
and can access elements by their integer index
(position).
20Queue
- A collection used to hold multiple elements prior
to processing. Besides basic Collection
operations, queues provide additional insertion,
extraction, and inspection operations. - Queues typically, but do not necessarily, order
elements in a FIFO (first-in-first-out) manner.
21Map
- An object that maps keys to values.
- Maps cannot contain duplicate keys.
- Each key can map to at most one value.
Hashtable is an implementation of Map.
22Last two core collection interfaces are merely
sorted versions of Set and Map
- SortedSet
- A Set that maintains its elements in ascending
order. - Sorted sets are used for naturally ordered sets,
such as word lists and membership rolls. - SortedMap
- A Map that maintains its mappings in ascending
key order, Map analog of SortedSet. - Sorted maps are used for naturally ordered
collections of key/value pairs, such as
dictionaries and telephone directories
23Restrictions on Elements Stored
- Some implementations may restrict what elements
(or in the case of Maps, keys and values) may be
stored. Possible restrictions include requiring
elements to - Be of a particular type.
- Be non-null.
- Obey some arbitrary predicate
24Collection Implementations
25Traversing Collections
- with the for-each construct
- for (Object o collection) System.out.println(o)
- using iterators
- public interface Iterator boolean hasNext()
E next() void remove() // Optional
26The bulk operations perform an operation on an
entire Collection
- containsAll Returns true if the target
Collection contains all of the elements in the
specified Collection. - addAll Adds all the elements in the specified
Collection to the target Collection. - removeAll Removes from the target Collection all
its elements that are also contained in the
specified Collection. - retainAll Removes from the target Collection all
its elements that are not also contained in the
specified Collection. That is, it retains in the
target Collection only those elements that are
also contained in the specified Collection. - clear Removes all elements from the Collection.
27toArray methods
- The array operations allow the contents of a
Collection to be translated into an array. - Object a c.toArray()