09-Building-an-Application-V1 (1).ppt

download 09-Building-an-Application-V1 (1).ppt

of 14

Transcript of 09-Building-an-Application-V1 (1).ppt

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    1/14

    1

    IS Software Foundations

    Building an Application

    Belief in oneself is one of the most importantbricks in building any successful venture.Lydia M Child

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    2/14

    2Object Oriented Application Development

    Overview

    Objective

    Apply concepts learnt so far to build a consoleapplication

    Content

    Encapsulation Class versus object

    Case Study

    After this module, you should be able to

    Write a console application with more than 3classes

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    3/14

    3Object Oriented Application Development

    Identifying Objects: Abstraction

    Determine the relevant properties and features while

    ignoring non-essential details

    Cat

    - bloodType- numberOfBones- lastVisitDate

    abstraction

    Cat

    - birthday- favouriteFood- favouriteToy

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    4/14

    4Object Oriented Application Development

    Classes

    Aclass is the blueprint from which individual

    objects are created. An object is an instance of a class.

    Object factory

    Cookie Cutter

    public class StudentTest {

    public static void main(String[] args) {Student s1 = new Student();Student s2 = new Student();

    }} - class -

    public class Student {private String name;

    // }

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    5/14

    5Object Oriented Application Development

    Case Study

    Uncle Kevin needs a rental system for his DVD

    rental shop. Standalone application

    Used by the cashier

    Features List all DVDs

    Add a DVD

    Rent a DVD

    List all Rentals

    Assumption

    1 copy per title

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    6/14

    6Object Oriented Application Development

    Step 1: Object-Model Components as a Guide

    Start off with the following groups of objects

    Problem domain Classes related to the business at hand

    Data Management (Not covered in IS200)

    Databases, files etc (to persist data over time)

    Human interaction

    Windows, reports etc

    System interaction (Not covered in IS200)

    Objects that provide an interface between problemdomain objects and other systems or devices

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    7/14

    7Object Oriented Application Development

    Application

    Step 1: Object-Model Components as a Guide

    DataManagement

    Problem domain

    SystemInteraction

    FilesDatabases

    ExternalSystems

    HumanInteraction

    Start off with the following groups of objects

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    8/14

    8Object Oriented Application Development

    Step 2: Identify Actors, places & things

    Actors and participants

    Actors are people and organizations that act as participantswithin the system under consideration

    You need a way to know each object and its attributes

    Example: Cashier, Clerk etc

    Places Look for places where things come to rest, places that contain

    other object

    Example: Airport, Warehouse, School

    Things

    Tangible objects used in the problem domain

    Example: CashBox, Product, Stock, Facility

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    9/14

    9Object Oriented Application Development

    Step 3: Transactions

    Recording or logging of any event of significance

    Look for events that the system must remember over time Loan

    Remember which book is borrowed by which Patron

    Receipt

    Remember which product(s) is bought by which Customer

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    10/14

    10Object Oriented Application Development

    DVD Rental System: Identifying Objects

    Actors and participants

    Clerk ?

    Places

    Shop ?

    Things Patron/Borrower

    DVD

    Transaction

    Rental

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    11/14

    11Object Oriented Application Development

    Exercise Write the DVD class

    Implement the DVD class.

    Has 2 attributes: id of type int

    1,2,3,

    Used to identify a DVD object

    title of type String

    Has a specific constructor:

    DVD(int id, String title)

    Implement the getter methods

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    12/14

    12Object Oriented Application Development

    Exercise: Write the DVDManager - 1

    DVDManager is responsible for managing the DVD

    objects Has one attribute

    dvdList of type ArrayList

    Has a default constructor that creates the followingobjects

    ID Title

    1 Bride Wars

    2 17 Again3 Knowing

    4 Seventh Moon

    5 Night Train

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    13/14

    13Object Oriented Application Development

    Exercise: Write the DVDManager - 2

    Has the following methods

    ArrayList retrieveAll() Returns all the DVDs

    DVD retrieve(int id)

    Returns the DVD which has the specific id

    Void add(String title)

    Add a DVD object with the specific title

  • 7/27/2019 09-Building-an-Application-V1 (1).ppt

    14/14

    14Obj t O i t d A li ti D l t

    Summary

    Abstraction

    Determine the relevantproperties and featureswhile ignoring non-essential details

    Aclass is the blueprintfrom which individualobjects are created.

    An object is an instance ofa class.

    Working on a Object-

    Oriented project Start off with the following

    groups of objects

    Problem domain

    Data Management

    Human interaction

    System interaction

    Identify actors andparticipants, places &

    things Identify transactions