Free Essay

Object Oriented Programming -Java

In:

Submitted By sanshanthan
Words 4819
Pages 20
Table of Contents
TASK A ....................................................................................................................................................... 4
Provide the UML diagrams for the given problem with clear explanations on the design decisions.
Derive detailed Use Case diagram, Class diagram & a sequence diagram. Whenever necessary document the relevant assumptions you made. ...................................................................................... 4
TASK B ....................................................................................................................................................... 7
Provide an alternative OO design for the same problem ......................................................................... 7
Object Oriented Known as Methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance. ......................................................................... 7
TASK C ....................................................................................................................................................... 9
There are many system design patterns available in system development. Critically evaluate singleton, factory and abstract factory design patterns and apply the most suitable design pattern for your system development................................................................................................................................. 9
TASK D ..................................................................................................................................................... 13
Develop an interactive set of interfaces to get the necessary user inputs. Make sure to implement proper validation mechanisms in order to restrict invalid entries to the system. Come up with suitable set of reports, which you will think add more value to your system ..................................................... 13
TASK E ..................................................................................................................................................... 28
Document the test plan and explain how you used test driven development in this scenario. This includes test rationale, test plan, test data and proper application of the test plan ............................. 28
TEST PLAN DOCUMENT ............................................................................................................................... 29
BACKGROUND ............................................................................................................................................. 29
INTRODUCTION ........................................................................................................................................... 29
PLAN FOR TEST ............................................................................................................................................ 29
GUI test ................................................................................................................................................... 29
Database test ........................................................................................................................................... 29
Basic function test ................................................................................................................................... 29
Add Users............................................................................................................................................ 29
Update/delete drugs ............................................................................................................................ 29
Add a drug........................................................................................................................................... 29
Update/delete drug .............................................................................................................................. 30
Search for drug .................................................................................................................................... 30
Check-in drug...................................................................................................................................... 30
Check-out drug.................................................................................................................................... 30

View drug detail .................................................................................................................................. 31
View drug name, expire date, stock availability, Item id .................................................................... 31
Network test ............................................................................................................................................ 31
TASK F...................................................................................................................................................... 37
Create user and technical documentation for the developed solution.................................................. 37
TASK F...................................................................................................................................................... 49
Critically evaluate the work undertaken by yourself, in relation to the solution you developed. You can emphasize on the design you selected in implementing your solution. Provide justifications why you think one design is better than the other, among the two designs (task a, task b) you proposed for the above scenario. You can use your knowledge on OOP concepts, design patterns & business domain specific knowledge to support your answer. .......................................................................................... 49
REFERENCE .............................................................................................................................................. 52

Scenario
"Crystal" is a pharmaceutical company which has multiple pharmacy branches throughout the country. Currently they have simple POS (point of sale) system to issues bills and calculate the sales. The management has decided to implement a new automated computer system which should track all the sale transactions, purchasing transaction and manage stocks of each branch.

System should be able to operate in individual branch and management should be able to view reports of all the branches. Pharmacy outlet will do sales on both drug items and grocery items as well. Since pharmacy branches directly sell drugs to customers no need to maintain customer details but should be able to scan and attach prescriptions of customer if required.

On the other suppliers and stocks has to be maintained with threshold levels and notify operator when stocks meet threshold level. Expiry dates are very important in drugs, so system should be able to track expiry dates of the stocks and notify operator beforehand. Especially when it comes to drug items the generic names has to be managed along with the brand name, and also search options should be possible for both brand name and generic names. System should be able to print receipts for billings if required. You have freedom to add more creative functionalities to have a better solution, for an instance a bar code reader and bar code generation can be done for receipts. TASK A
Provide the UML diagrams for the given problem with clear explanations on the design decisions. Derive detailed Use Case diagram, Class diagram & a sequence diagram.
Whenever necessary document the relevant assumptions you made.
Use Case diagram

Class diagram

Sequence diagram

TASK B
Provide an alternative OO design for the same problem
Object Oriented Known as Methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance.
I identified object oriented concepts which is used in crystal point on sale system such as


Object



Class



Inheritance



Polymorphism



Abstraction



Encapsulation

Some of the examples are given below which was taken from the system.
In AddDrug Class I have used Inheritance to extends a class

In CrystalViewStock Class Polymorphism I have used to define one method to multiple implementations TASK C
There are many system design patterns available in system development. Critically evaluate singleton, factory and abstract factory design patterns and apply the most suitable design pattern for your system development.
Advantages of design patterns
Design patterns address the design problems that are repeated and in particular situations design, to propose solutions. Therefore, design patterns are successful solutions to common problems. I identified design patterns divided into three categories such as Creational Patterns,
Structural Patterns, and Behavioral Patterns in java, likewise


Structural Design Patterns
i.
ii.

Composite Pattern

iii.

Proxy Pattern

iv.

Flyweight Pattern

v.

Facade Pattern

vi.


Adapter Pattern

Bridge Pattern

Creational Design Patterns
i.
ii.

Factory Pattern

iii.

Abstract Factory Pattern

iv.

Builder Pattern

v.

Prototype Pattern

vi.


Singleton Pattern

Decorator Pattern

Behavioral Design Patterns
i.

Template Method Pattern

ii.

Mediator Pattern

iii.

Chain of Responsibility Pattern

iv.

Observer Pattern

v.

Strategy Pattern

vi.

Command Pattern

vii.

State Pattern

viii.

Visitor Pattern

ix.

Interpreter Pattern

x.

Iterator Pattern

xi.

Memento Pattern

Advantages and Useable of singleton, factory and abstract factory design patterns and Critical evaluate of the design patterns
With a singleton class, i have more control in terms of how you manage the object that is created. First, a singleton is an object. The static method returns an instance of the object and allows to create only a single instance, or more if it so choose. Singletons are also indolent loaded, meaning that they are not instantiated until the first time they are called.
A singleton doesn't use static methods, so you won't have trouble using it in a non-static context. Singletons can be extended/sub classed.

The factory method pattern is a way to encapsulate object creation. The constructors are marked private in factory, so they cannot be called except from inside the class, and the factory method is marked as static so that it can be called without first having an object.
There are a few advantages to this pattern. One is that the factory can choose from many subclasses (or implementers of an interface) and return that. This way the caller can specify the behavior desired via parameters, without having to know or understand a potentially complex class hierarchy. Another advantage is reusable objects - instead of building, using, and tearing down an object, if the construction and destruction are expensive processes it might make more sense to build them once and recycle them. The factory method can return an existing, unused instantiated object if it has one, or construct one if the object count is below some lower threshold, or throw an exception or return null if it's above the upper threshold.

As per the article on Wikipedia, multiple factory methods also allow different interpretations of similar argument types. Normally the constructor has the same name as

the class, which means that you can only have one constructor with a given signature.
Factories are not so constrained, which means you can have two different methods that accept the same argument types

Here I mentioned few other design patens usability.


Creational patterns deal with ways to create instances of objects. The aim of these patterns is to abstract the process of instantiation and hide the details of how objects are created and initialized.



The Factory Pattern is used to choose and return an instance of a class from a number of similar classes based on data you provide to the Factory.



The Abstract Factory Pattern is used to return one of several groups of Classes. In some cases it actually returns group of Classes.



The Builder Pattern assembles a number of objects to make a new Object, based on the data with which it is presented.



The Prototype Pattern copies or clones an existing class rather than creating a new instance when creating new instances is more expensive.



The Singleton Pattern is a pattern that insures there is one and only one instance of an object, and that it is possible to obtain global access to that one instance.



Structural patterns describe how classes and objects can be combined to form larger structures and provide new functionality. These objects can be added even simple objects or compound objects.



The Adapter pattern, used to change the interface of one class to that of another one. 

The Bridge pattern, intended to keep the interface to your client program constant while allowing you to change the actual kind of class you Display or use. You can then change the interface and the underlying class separately.



The Composite pattern, a collection of objects, any one of which may be either itself a Composite, or just a primitive object.



The Decorator pattern, a class that surrounds a given class, adds new capabilities to it, and passes all the unchanged methods to the underlying Class.



The Facade pattern, which groups a complex object hierarchy and provides a new, simpler interface to access those data.



The Flyweight pattern, which provides a way to limit the proliferation of small, similar class instances by moving some of the class data outside the class and passing it in during various execution methods.



The behavior patterns help us define communication and iteration between objects in a system. The purpose of this pattern is to reduce the coupling between objects.

The most suitable design pattern for Crystal point on sales project

I Chose singleton pattern for Crystal Point of sale system because I have more control in terms of how you manage the object that is created, the singleton pattern can be used for anything that you don't want to repeat. And I need to have one and only one instance of a given class during the period of an application session. This may be due to necessity or, more often, due to the fact that only a single instance of the class is sufficient. For example,
I need a single database connection object in the crystal point on sale application. The
Singleton pattern is useful in such cases because it ensures that there exists one and only one instance of a particular object ever.

TASK D
Develop an interactive set of interfaces to get the necessary user inputs. Make sure to implement proper validation mechanisms in order to restrict invalid entries to the system. Come up with suitable set of reports, which you will think add more value to your system

Three-tiered architecture
The three-tiered architecture useful to develop a software to better understand, organize its development, encourage reuse and evolve the system. As in crystal point on sale system I put all user interface/Swing code in client, business logic in the middle-tier server where the client talks to the business logic using a remote protocol, and all data access code is in the server.

Presentation layer with user interfaces

Business Logic Layer with components, DB connectivity

Complex functionality
I identified Complex functionality as capture image and save it in database through
Open CV library

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package RUBANpackage; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import javax.imageio.ImageIO; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfByte; import org.opencv.highgui.Highgui; import org.opencv.highgui.VideoCapture;

/**
*
* @author shanthan
*/
public class CrystalCapture extends javax.swing.JFrame { private DaemonThread myThread = null; int count = 0;
VideoCapture webSource = null;
Mat frame = new Mat();
MatOfByte mem = new MatOfByte();

////////////////////////////////////////////////////////////// class DaemonThread implements Runnable
{

protected volatile boolean runnable = false;

@Override public void run()
{
synchronized(this)
{
while(runnable)
{
if(webSource.grab())
{
try
{
webSource.retrieve(frame);
Highgui.imencode(".bmp", frame, mem);
Image
ByteArrayInputStream(mem.toArray()));

im

=

ImageIO.read(new

BufferedImage buff = (BufferedImage) im;
Graphics g=jPanel1.getGraphics(); if (g.drawImage(buff, 0, 0, getWidth(), getHeight() -150 , 0, 0, buff.getWidth(), buff.getHeight(), null)) if(runnable == false)
{
System.out.println("Going to wait()"); this.wait(); }} catch(Exception ex)

{

System.out.println("Error");
} } }}}
}

/**
* Creates new form CrystalCapture
*/
public CrystalCapture() { initComponents(); }
/**
* This method is called from within the constructor to initialize the form.

* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() { jPanel1 = new javax.swing.JPanel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); javax.swing.GroupLayout javax.swing.GroupLayout(jPanel1); jPanel1Layout

=

new

jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 335, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 198, Short.MAX_VALUE)
);
jButton1.setText("START"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); }
});
jButton2.setText("STOP"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); }
});
javax.swing.GroupLayout layout javax.swing.GroupLayout(getContentPane());

=

new

getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)
.addComponent(jButton1)
.addGap(58, 58, 58)
.addComponent(jButton2))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(26, Short.MAX_VALUE))
);
layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup()
.addGap(31, 31, 31)
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELI
NE)
.addComponent(jButton1)
.addComponent(jButton2))
.addContainerGap(40, Short.MAX_VALUE))
);

pack();
}//

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
/// start button webSource =new VideoCapture(0); myThread = new DaemonThread();
Thread t = new Thread(myThread);
t.setDaemon(true);
myThread.runnable = true;
t.start();
jButton1.setEnabled(false); //start button

jButton2.setEnabled(true); // stop button
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here: myThread.runnable = false; jButton2.setEnabled(false); jButton1.setEnabled(true); webSource.release(); }

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME); // load native library of opencv /* Set the Nimbus look and feel */ try { for (javax.swing.UIManager.LookAndFeelInfo javax.swing.UIManager.getInstalledLookAndFeels()) {

info

if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break;
}
}
} catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(CrystalCapture.class.getName()).log(java.util.l ogging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) { java.util.logging.Logger.getLogger(CrystalCapture.class.getName()).log(java.util.l ogging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(CrystalCapture.class.getName()).log(java.util.l ogging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(CrystalCapture.class.getName()).log(java.util.l ogging.Level.SEVERE, null, ex);
}
//

:

/* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() {
@Override
public void run() { new CrystalCapture().setVisible(true);
}});
}
// Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JPanel jPanel1;
// End of variables declaration
}

Image capture in application to capture medical prescription

Proper Database to store information

CREATE TABLE `bill` (
`billno`

INTEGER,

`batch`

VARCHAR,

`name`VARCHAR,
`qty` INTEGER,
`mrp` DOUBLE,
`rate` DOUBLE,

`amount`

DOUBLE,

`exp` VARCHAR,
`slno` INTEGER,
`date` VARCHAR,
`user` VARCHAR,
`totalamt`

DOUBLE,

`disc` DOUBLE,
`amtbeforedisc`

DOUBLE

);

CREATE TABLE `items` (
`batch`

VARCHAR,

`qty` INTEGER,
`name`VARCHAR NOT NULL UNIQUE,
`mrp` DOUBLE,
`rate` DOUBLE,
`exp` VARCHAR
);

CREATE TABLE `login` (
`id`

VARCHAR NOT NULL UNIQUE,

`password`

VARCHAR NOT NULL

);
CREATE TABLE `user` (
`username`
);

VARCHAR

TASK E
Document the test plan and explain how you used test driven development in this scenario. This includes test rationale, test plan, test data and proper application of the test plan
Test rationale
White Box Testing
White-box testing, also known as structural testing or logical drive test. It is to know the inner workings of the process of the product. the product can be detected by testing whether the action in accordance with the provisions of the internal specifications of normal, according to the internal structure of the program testing procedures, inspection procedures of each are there pathways to work properly according to predetermined requirements, regardless of its function, the main method of white-box testing logical drive, based road tests, mainly for software verification.
Black Box Testing
Black box testing, also known as functional testing or data-driven testing, which is known product should have the function, through testing to detect whether each feature can be used normally, in the test, the program cannot be opened as a black basin, in the case without considering the internal structure and internal characteristics tester for testing the program interface, it only checks whether the program functions in accordance with the requirements specification of normal use, the program is able to receive input and generates the appropriate number of saws correct output information, and to maintain the external information (such as databases or files) integrity. Black box testing methods are mainly divided into equivalence classes, boundary value analysis, because - if the map, error guessing, mainly for software validation testing. "Black box" approach focuses on the external structure of the program, without regard to the internal logic structure, a test for the software interface and software functions. "Black box" approach is exhaustive input testing, only to have all possible inputs to use as a test case, this method can detect all the errors the program. In fact there are an infinite number of test cases, people not only want to test all the legitimate input, but also for those who are not legal but possible inputs for testing. TEST PLAN DOCUMENT
BACKGROUND
Crystal PO System is a Java application for manage transaction in medical store. The system would provide basic set of features such as to add/update users, add/update drugs, search for stocks, and manage check-in / checkout processes. Our test group tested the system based on the requirement specification.
INTRODUCTION
This test report is the result for testing in the Crystal PO System. It mainly focuses problems to make sure whether Transactions should be secured (encrypted data using https protocol), automatically session out if idle for long time, Transaction details should log, Calculate tax on a ticket
PLAN FOR TEST
GUI test
Pass criteria: managers and salesman could use this GUI to interface with the backend library database without any difficulties
Database test
Pass criteria: Results of all basic and advanced operations are normal
Basic function test
Add Users
Pass criteria:


Managers should have access to DB for manage details.



The retrieved salesman information by viewing detail.

Update/delete drugs
Pass criteria:
 The record would be selected using the drug name, expire date, stock availability,
Item id


Updates can be made on drug name, expire date, stock availability, Item id



The updated values would be reflected if the same ID is called for.



If drugs were deleted, it would not appear in further search queries.

Add a drug
Pass criteria:
 Each drug shall have following attributes: drug name, expire date, stock availability, and Item id.



The retrieved drug information should contain the attributes.

Update/delete drug
Pass criteria:


The item can be retrieved using the drug ID

 The data items which can be updated are: drug name, expire date, stock availability, Item id


If drugs were deleted, it would not appear in further search queries.

Search for drug
Pass criteria:


The product shall let salesman query drug detail information by their name, Item id

 The search results would produce a list of drugs, which match the search parameters with following Details: drug name, expire date, stock availability, Item id


The display would also provide the number of stocks which is available for sale



The display shall provide a means to select one or more rows to a user-list



A detailed view of each drug should provide information about check-in/ checkout status, with the buyer’s description.



The search display will be restricted to 20 results per page and there would be means to navigate from sets of search results.



The user can perform multiple searches before finally selecting a set drug for check in or checkout. These should be stored across searches.



The buyers prescription should store in the data of POS

Check-in drug
Pass criteria:



salesman can check in using its drug name, expire date, stock availability, Item id The check-in can be initiated from a previous search operation where user has selected a set of drugs.

Check-out drug
Pass criteria:


Salesman can check out drugs using its call number




drug name, expire date, stock availability, Item id would be entered

The sales date would automatically reflect the current system date.

View drug detail
Pass criteria:


This view would display details about a selected drug from search operation





The details to be displayed are: drug name, expire date, stock availability, and
Item id. drug checked in should not display user summary

Drug checked out should display correct user details.

View drug name, expire date, stock availability, Item id
Pass criteria:


salesman can select a record for detailed view



The detail view should show:
a. drug name, ID, expire date



The display should match existing user profile



The drug checked out should have their statuses marked



The drug search query should show the user id correctly.

Network test
Pass criteria: Results of operations (ODBC connectivity check) are normal.

Test Case Id

Description Test Steps

Expected Results

CRYSTAL/
RUBAN/001

Login Page

1. Login function correctly working or not.

1. The user should be able to view the customer page.

CRYSTAL/
RUBAN/002

Login Page

2. Login page error message correctly working or not.

2. The user should be able to view the confirmation message if username or password wrong.

CRYSTAL/
RUBAN/003

Home page

3. Add Items button click

3.Add Items page popups without error

CRYSTAL/
RUBAN/004

Home page

4. Delete Items button click

4. Delete Items page popups without error

CRYSTAL/
RUBAN/005

Home page

5. View Stock button click

5. View Stock page popups without error

CRYSTAL/
RUBAN/006

Home page

6. View Expiry Date page popups without error

CRYSTAL/
RUBAN/007

Home page

6. View Expiry
Date button click 7. View bill button click

CRYSTAL/
RUBAN/008

Home page

8. refresh button 8.be refresh without error click CRYSTAL/
RUBAN/009

Add Item
Page

9.save and add button click

9.save and add without error CRYSTAL/
RUBAN/010

Add Item
Page

10.save and exit button click

10.save and exit without error 7. View bill button page popups without error

Re Defect mar Id ks CRYSTAL/
RUBAN/011

Home page

11.save or exit button click

11.save or exit without error CRYSTAL/
RUBAN/012

Home page

12. add button click 12. add to without error

CRYSTAL/
RUBAN/013

Home page

13. remove item 13. remove from checkout button click without error

CRYSTAL/
RUBAN/014

Home page

14. add image button click

14. add image without error CRYSTAL/
RUBAN/015

Home page

15. calculate total button click 15. calculate total without error Automation unit test

checkout

Automation CPU Sampling

TASK F
Create user and technical documentation for the developed solution.
Login page

Home Page

Add Drug Page

TASK F
Critically evaluate the work undertaken by yourself, in relation to the solution you developed. You can emphasize on the design you selected in implementing your solution. Provide justifications why you think one design is better than the other, among the two designs (task a, task b) you proposed for the above scenario. You can use your knowledge on OOP concepts, design patterns & business domain specific knowledge to support your answer.
I have developed point on sale system which has SQL lite as backend. Through this system managers or sales person can manage stocks, prescriptions, and drugs easily.
Here I critically evaluate the suitability of each software design for crystal POS.
FACTORY METHOD
In overall, all subclasses in a class hierarchy inherit the methods implemented by the parent class. A subclass may override the parent class implementation to offer a different type of functionality for the same method. When an application object is aware of the exact functionality it needs, it can directly instantiate the class from the class hierarchy that offers the required functionality. At times, an application object may only know that it needs to access a class from within the class hierarchy, but does not know exactly which class from among the set of subclasses of the parent class is to be selected.
SINGLETON
The Singleton pattern is an easy to understand design pattern. Sometimes, there may be a need to have one and only one instance of a given class during the lifetime of an application. This may be due to necessity or, more often, due to the fact that only a single instance of the class is sufficient. For example, i need a single database connection object in the crystal point on sale application. The Singleton pattern is useful in such cases because it ensures that there exists one and only one instance of a particular object ever.
Further, it suggests that client objects should be able to access the single instance in a consistent manner.
ABSTRACT FACTORY
During the discussion of the Factory Method pattern I saw that context of a factory method, there exists a class hierarchy composed of a set of subclasses with a common parent class.
A factory method is used when a client object knows when to create an instance of the parent class type, but does not know (or should not know) exactly which class from among the set of subclasses (and possibly the parent class) should be instantiated. Besides the class selection criteria, a factory method also hides any special mechanism required to instantiate the selected class.

Develop a proper comparison between designed solutions
While develop crystal POS I have used singleton pattern and object oriented concepts such as inheritance and polymorphism. I identified A singleton allows access to a single created instance - that instance can be passed as a parameter to other methods, and treated as a normal object. While a static class allows only static methods.

Name of design Patten
Abstract factory
Builder
Factory methods
Proto type
Singleton
adapter bridge composite decorator facade flyweight proxy
Chain of responsibility command iterator interpreter mediator memento Creational Design Patten’s
Description
Design Patten’s
GUI interface create Group of
Yes
object concrete Classes
Separate the Object a exaggerate
Yes
feelings create the same process
Create single object sub class
Yes
decide for Class
Kind of Object to using create
Yes
new object
Class has only for One instance
Yes
Structural design Patters
Change the interface of a class
Yes
into another interface
Decouple an abstraction
Yes
Composite object and the tree
Yes
object
Object dynamically using for
Yes
interface
Set of interface in sub class
Yes
Use sharing to Support large
Yes
number
Another object to control access
Yes
Behavior design patterns
The group of sender request and
Yes
receiver object
Encapsulation request an object
Yes
Access element arrange Objects
Yes
Representation for grammar some Yes think Object that encapsulations set of
Yes
object interact
Without encapsulation allow the
Yes
object

Development
Code Complete yes no yes no yes Yes yes Yes yes yes no no no no yes no no no

Why I selected the singleton design patterns for Crystal POS System by software Design.

Singleton pattern I have select because of


More control in terms of how you manage the object that is created, the singleton pattern can be used for anything that you don't want to repeat.



I need to have one and only one instance of a given class during the period of an application session. This may be due to necessity or, more often, due to the fact that only a single instance of the class is sufficient. For example, I need a single database connection object in the crystal point on sale application. The Singleton pattern is useful in such cases because it ensures that there exists one and only one instance of a particular object ever.



REFERENCE
The Art of Software Testing", Myers, G.J. Wiley & Sons,1979. (Accessed on25/10/2012)
Software Testing in the Real World", Kit, E. Addison-Wesley 1995. (Accessed on26/10/2012)
UML", Warmer, J. & Kleppe, A. Addison-Wesley, 1998. (Accessed on27/10/2012)
IEEE Standard for Software Test Documentation, 1991 (IEEE/ANSI Std 829-1983) (Accessed on27/10/2012) The Complete Guide to Testing", Hetzel, B. QED Information Sciences Inc, 1988. (Accessed on29/10/2012) The Object Constraint Language: precise modeling with
IEEE Standard for Software Veri_cation and Validation Plans, 1992 (IEEE/ANSI Std
(Accessed on29/10/2012)

Similar Documents

Free Essay

Object Oriented Programming in Java ‐ Exercises

...OBJECT ORIENTED PROGRAMMING IN JAVA ‐ EXERCISES    CHAPTER 1    1. Write Text‐Based Application using Object‐Oriented Approach to display your name.    // filename: Name.java // Class containing display() method, notice the class doesnt have a main() method public class Name { public void display() { System.out.println("Mohamed Faisal"); } } // filename: DisplayName.java // place in same folder as the Name.java file // Class containing the main() method public class DisplayName { public static void main(String[] args) { Name myname = new Name(); // creating a new object of Name class myname.display(); // executing the display() method in the Name class } }   2. Write a java Applet to display your age.  // filename: DisplayNameApplet.java import java.applet.Applet; // import necessary libraries for an applet import java.awt.Graphics; public class DisplayNameApplet extends Applet { public void paint(Graphics g) { g.drawString("Mohamed Faisal", 50, 25); } } // filename: DisplayNameApplet.htm // place in same folder as the compiled DisplayNameApplet.class file Displaying my Name CHAPTER 2    3.  Write a program that calculates and prints the product of three integers.    // filename: Q1.java import java.util.Scanner; // import Scanner libraries for input public class Q1 { public static void main(String[] args) { Scanner input = new Scanner (System.in); int number1; int number2; int number3; System.out.println("Enter the First Number"); www.oumstudents...

Words: 3130 - Pages: 13

Premium Essay

Organization of Programing Languages

...ORGANIZATION OF PROGRAMMING LANGUAGES | | ANZOTSA JOHN ALAKU | BHU/12/04/05/0042 COMPUTER SCIENCE 400 LEVEL | | | ABRSTRACT My objective for these research was to find out about different programming languages and paradigm in which they belong, the most important use in this research are text and journal by other researchers. After all studies where carried out, I came to a conclusion that one programing language can belong to more than one paradigm C++ C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. Some people say that C++ is a middle language because it has the features of high level and low-level language. As one of the most popular programming languages in the world, C++ is widely used in the software industry. C++ is also used for hardware design to analyze structure. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. AspectJ AspectJ is a general-purpose Aspect-Oriented extension to java programming language. It was created at Palo Alto Research Center Incorporated (PARC), now it is an open source project and part of the Eclipse Foundation. AspectJ has everything that Java has and more which means every valid Java program...

Words: 3773 - Pages: 16

Premium Essay

Bout This

...Pasig campus pangilinan DSITI-AI Oct 27 15 Java Programming java programming Introduction in java programming Objectives * Object-Oriented Programming Language * Object-Oriented Programming Principle * Benefits Of Object-Oriented Programming * Introduction To Java Programming * Resources Used To Create a Java Programming *Structures Of a Java Programming * Result Of Executing The Java Programing Object Oriented Programming Language (OOPL) OOPL Is An Extension Of Procedural Language. Involves Creating Program Components as Object Related To The Real Word. Writing Object-Oriented Programs Involves Creating Object And Application That Uses Those Objects. An Object Contains Both Data Procedures Can be packaged Into a Single Unit. Based On Three Concepts Encapsulation Ability To Bind Data And Procedures Into an Object. Inheritance Ability Of Objects To Acquire The Attributes Or Behavior Of Other Objects Or Classes. Polymorphism Ability of An Object To Take Many Forms Or Identities. Benefits Of Object-Oriented Programming *Reusability -Able To Reuse The Defined Objects. *Adaptability –Able to fit in different environment. *maintainability –Able to change easily. *reliability –Able to operate...

Words: 1445 - Pages: 6

Free Essay

Pt1420 Programming Unit 1 Research Assignment

...1970’s CLU is a programming language created at MIT by Barbara Liskov and her students between 1974 and 1975. It was notable for its use of constructors for abstract data types that included the code that operated on them, a key step in the direction of object-oriented programming (OOP). Euclid is an imperative programming language for writing verifiable programs. It was designed by Butler Lampson and associates at the Xerox PARC lab in the mid-1970s. The implementation was led by Ric Holt at the University of Toronto and James Cordy was the principal programmer for the first implementation of the compiler. It was originally designed for the Motorola 6809 microprocessor. Forth is an imperative stack-based computer programming language and programming environment. Language features include structured programming, reflection (the ability to modify the program structure during program execution), concatenative programming (functions are composed with juxtaposition) and extensibility (the programmer can create new commands). Although not an acronym, the language's name is sometimes spelled with all capital letters as FORTH, following the customary usage during its earlier years. Forth was designed by Charles H. Moore and appeared in the 1970’s. GRASS is the original version of GRASS was developed by Tom DeFanti for his 1974 Ohio State University Ph.D. thesis. It was developed on a PDP-11/45 driving a Vector General 3DR display, and as the name implies, this was a purely vector...

Words: 1885 - Pages: 8

Premium Essay

Thesis

...FACULTY OF MATHEMATICS AND NATURAL SCIENCE. 4. PROPOSED DEGREE: M. Sc. (INFORMATIC SCIENCE) 5. TITLE: Object-Oriented Systems Analysis and Design: a case of District Health Information System, Mozambique. TABLE OF CONTENTS ABSTRACT i INTRODUCTION 1 RELEVANT FINDINGS (LITERATURE REVIEW) 2 OBJECT-ORIENTED SYSTEMS ANALYSIS AND DESIGN 2 THE RESEARCH PROBLEM AND WHY THIS PROBLEM AREA 5 THE RESEARCH QUESTIONS 5 RESEARCH OBJECTIVES 6 TARGET GROUP 7 PERSONAL MOTIVATION 7 METHODOLOGY 7 BIBLIOGRAPHY: 13 ABSTRACT Many organisations are relying on software systems. Thus these organisations spend a lot of money on software systems and, to get a return on that investment, the software must be usable for a number of years. For many organisations, introducing new software implementation from scratch is a risk. This is because their requirements are not well defined or they don’t have enough expertise to understand and identifies software that can fit their problems. So, many organisations adopt software. That means they take analogy software (software developed for another organisation with the some similarities) and adopt it to fit their needs. In my research, I want to address the problems of adopting systems developed in the functional-oriented methodology and propose object-oriented systems analysis and design methodology. Mainly I would like to assess the flexibility of the structure of software and...

Words: 3840 - Pages: 16

Premium Essay

Research

...1970’s: Smalltalk is an object-oriented, dynamically typed, reflective programming language. Smalltalk was created as the language to underpin the "new world" of computing exemplified by "human–computer symbiosis."[1] It was designed and created in part for educational use, more so for constructionist learning, at the Learning Research Group (LRG) of Xerox PARC by Alan Kay, Dan Ingalls, Adele Goldberg, Ted Kaehler, Scott Wallace, and others during the 1970s. The language was first generally released as Smalltalk-80. Smalltalk-like languages are in continuing active development, and have gathered loyal communities of users around them. ANSI Smalltalk was ratified in 1998 and represents the standard version of Smalltalk. Compiler Description Language, or CDL, is a programming language based on affix grammars. It was designed for the development of compilers. It is very limited in its capabilities and control flow; and intentionally so. The benefits of these limitations are twofold. On the one hand they make possible the sophisticated data and control flow analysis used by the CDL2 optimizers resulting in extremely efficient code. The other benefit is that they foster a highly verbose naming convention. This in turn leads to programs that are to a great extent self-documenting. The original version, designed by Cornelis H. A. Koster at the University of Nijmegen emerged in 1971. Pascal is a historically influential imperative and procedural programming language, designed in...

Words: 2326 - Pages: 10

Free Essay

Macoii

...1.1 Introduction Object-Oriented Strategies Object-oriented programming embodies in software structures a number of powerful design strategies that are based on practical and proven software engineering techniques. By incorporating support for these strategies in software structures, object-oriented programming enables the manageable construction of more complex systems of software than was previously possible. The nature of these software structures has been shaped by decades of software engineering experience. The basic design strategies that are embodied in object-oriented programming are presented in the Table 1.1. The design strategies evolved as techniques for dealing with complex natural and man-made system. Because these strategies are so fundamental, they are encountered in other contexts and in other programming language forms. What is stressed here is the relationship of these strategies to the design and construction of object-oriented software. These strategies are widely supported by existing object-oriented languages though different languages may present them in different ways and some languages may support other variations of each one. For example, some object-oriented languages have additional ways of supporting generalization. The design strategies in object-oriented programming are effective for constructing software models of entities in the problem domain. In fact, some have argued that software design is largely about constructing a software model of the...

Words: 16718 - Pages: 67

Premium Essay

Prog Research Paper Unit 1

...but for teaching computer science. It is best described as a simplified version of Algol. It was simplified both to make it easier to learn and to make it easier to compile (i-programmer.info, 2010). C- Was created by Ken Thompson iin the form of B and tweaked by Dennis Ritchie and renamed C in the 1970’s. It was the original code Unix was written in. Its function was for ease of use (i-programmer.info, 2010). Forth- was created by Charles H Moore in the 1970’s. The motivation behind this language was for both interactive execution of commands and the ability to compile sequences of commands for later execution (i-programmer.info, 2010). PLEX (Programming Language for EXchanges)- was created by Goran Hemdahl at Ericsson in the 1970’s. It is a special-purpose, pseudo-parallel and event-driven real-time programming language dedicated for AXE telephone exchanges, It is a propriatary language (i-programmer.info, 2010). 1980’s Atari ST BASIC – Atari commissioned MetaComCo to write a version of BASIC that would take advantage of the GEM environment on the Atari ST. This was based on a version already written for Digital Research called DR-Basic, which was bundled with DR's CP/M-86 operating system. The result was called ST BASIC. At the time the ST was launched, ST BASIC was bundled with all new STs. A further port of the same Basic called ABasiC ended up being supplied for a time with the...

Words: 1761 - Pages: 8

Premium Essay

Management

...Object-Oriented Analysis and Design Method MAO BO 2015 SPRING Course Category and Objects • Category • Core course for undergraduate students in major of Information Management and Information Systems • Objects • Understanding the elementary programming with Java(?) • Understanding methodologies and technologies of object-oriented analysis and design • Be more prepared for future software-related jobs MAO Bo, School of Economics and Management, Tsinghua University Spring, 2015 2 You will learn about • How to programming with Java  • How to gather software requirements • How to analysis software using object-oriented theory • How to design software using object-oriented theory • How to communicate the software analysis and design using UML (unified modeling language) diagrams • How to divide a software project into phases with objectoriented thinking MAO Bo, School of Economics and Management, Tsinghua University Spring, 2015 3 Contents of Course in Java 1. 2. 3. 4. 5. 6. Elementary Programming with Java Selections and Loops Method and Arrays in Java Objects and Classes Inheritance and Polymorphism Event-Driven Programming and Exception Handling MAO Bo, School of Economics and Management, Tsinghua University Spring, 2015 4 Contents of Course in OOA&D 7. What is great software and how can get it? 8. How to gather software requirement? 9. How to deal with software requirements change? 10. Object-oriented software analysis approaches 11. Object-oriented software...

Words: 385 - Pages: 2

Premium Essay

Unit 1 Research 1

...Programming Languages Throughout the decades 1970’s C – It was developed by Dennis Ritchie between 1969 and 1973 at AT&T Bell labs. The development of this language is closely tied to the development of Unix, which was originally implemented by Ritchie and Ken Thompson in assembly language on PDP-7. They decided to port the operating system to a PDP-11. They considered rewriting the operating system using B language. However, B’s inability to take advantage of some of the PDP-11’s features led to the development of C. Pascal – Published in 1970 and designed by Niklaus Wirth, it was intended as a tool to teach structured programming. Smalltalk – Smalltalk was the product of research led by Alan Kay and implemented by Dan Ingalls. Ingalls created the first version in a few mornings when he was bet that a programming language based on message passing inspired by Simula could be implemented in a page of code. Prolog – A general purpose logic programming language designed by Alain Colmerauer and published in 1972. SQL – A special purpose programming language designed for managing data held in a relational database management system. It was designed by Donald D. Chamberlin and Raymond F. Boyce in 1974. One of the first and most widely used commercial languages for Edgar F. Codd’s relational model. 1980’s C++ - An intermediate general purpose language, designed by Bjarne Stroustrup in 1983. It was Stroustup’s idea to enhance C language with Simula-like features...

Words: 804 - Pages: 4

Premium Essay

Unit 1 Reasearch

...programing languages Fortran, AWK One of the oldest programming languages, the FORTRAN was developed by a team of programmers at IBM led by John Backus, and was first published in 1957. The name FORTRAN is an acronym for FORmula TRANslation, because it was designed to allow easy translation of math formulas into code. Despite this standardization, a few years later, various new dialects began to surface again, requiring the Standards Association review the language again. This version is known as FORTRAN '77. This version was released in 1978. As with a number of languages, it was born from the necessity to meet a need. As a researcher at Bell Labs in the early 1970s, I found myself keeping track of budgets, and keeping track of editorial correspondence. I was also teaching at a nearby university at the time, so I had to keep track of student grades as well. I wanted to have a simple little language in which I could write one- or two-line programs to do these tasks. Brian Kernighan, a researcher next door to me at the Labs, also wanted to create a similar language. We had daily conversations which culminated in a desire to create a pattern-matching language suitable for simple data-processing tasks. 1990s programing languages Visual Basic, Ruby Visual Basic is a third-generation developed by Microsoft is a event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Microsoft intended Visual...

Words: 683 - Pages: 3

Free Essay

Java Basics

...1 Learn Java/J2EE core concepts and key areas With Java/J2EE Job Interview Companion By K.Arulkumaran & A.Sivayini Technical Reviewers Craig Malone Stuart Watson Arulazi Dhesiaseelan Lara D’Albreo Cover Design, Layout, & Editing A.Sivayini Acknowledgements A. Sivayini Mr. & Mrs. R. Kumaraswamipillai 2 Java/J2EE Job Interview Companion Copy Right 2005-2007 ISBN 978-1-4116-6824-9 The author has made every effort in the preparation of this book to ensure the accuracy of the information. However, information in this book is sold without warranty either expressed or implied. The author will not be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Please e-mail feedback & corrections (technical, grammatical and/or spelling) to java-interview@hotmail.com First Edition (220+ Q&A): Dec 2005 Second Edition (400+ Q&A): March 2007 3 Outline SECTION DESCRIPTION What this book will do for you? Motivation for this book Key Areas index SECTION 1 Interview questions and answers on: Java Fundamentals Swing Applet Performance and Memory issues Personal and Behavioral/Situational Behaving right in an interview Key Points SECTION 2 Interview questions and answers on: Enterprise Java J2EE Overview Servlet JSP JDBC / JTA JNDI / LDAP RMI EJB JMS XML SQL, Database, and O/R mapping RUP & UML Struts Web and Application servers. Best practices and performance considerations. Testing and deployment. Personal and...

Words: 23255 - Pages: 94

Premium Essay

Java

...Matthew Robert English 103 13 April 2013 Java the Programming Language Computer is very important in our live, we use computer in everywhere on our live. The doctor uses the computer to see file or pictures of his patients. Also, each engineer uses it in many ways of his work. The teacher in the classroom, employees in the offices and student in their study all of them use computer in them daily live. They are not using the mouse, the keyboard or the scream. They are using the applications by them these applications in the computer are like the soul in the body. The only way to build these applications is programming. To program we need to know one of the programming languages which are very similar each other. If you are professional in one of these languages you can be professional in the other language in a short period of time. It is acceptable if you have the same application written with Java once and with C++ or C sharp at the same time. So for this reason you cannot say that a programming language is better than others. There are three types of programming languages procedural, functional and object-oriented languages. The most uses of these languages are object-oriented and one of these languages is Java you can write any application you need using it. Also you can translate any application to its word. The message of the High-Level programming languages such as Algol and Pascal in first programming revolution was Control abstraction. In the...

Words: 2352 - Pages: 10

Free Essay

This Is a Syllabus

...Meet Karel the Robot Wednesday 25 Programming with Karel Control structures in Karel 27 Friday Problem-solving in Karel Program decomposition The idea of an algorithm 30 Read: Karel, Chapters 1-3 Read: Karel, Chapters 4-6 October 2 4 Control statements Boolean expressions Introduction to Java Variables, values, and types Classes and objects Arithmetic expressions The Program class hierarchy Read: Java, Chapters 1-2 7 Methods Using parameters Read: Chapter 3 9 More parameters Pseudorandom numbers The RandomGenerator class Read: Chapter 4 Due: Assignment #1 11 Creating classes Stylistic expectations Using javadoc Read: Chapter 5 14 Read: Chapter 6 16 18 Character data The Java String class The acm.graphics package More graphics The collage graphics model Event driven programming Read: Chapter 9.1-9.3 Due: Assignment #2 21 Read: Chapter 9.4 Read: Chapter 10.1–10.4 23 Read: Chapter 8.1-8.4 25 File processing Exception handling String manipulation Objects and memory Problem-solving with strings More on parameter passing Read: Chapter 8.5 Read: Chapter 7 Due: Assignment #3 Read: Chapter 12.4 –2– Monday 28 Arrays and ArrayList 30 Arrays and ArrayList (continued) Wednesday Friday November 1 Belated midterm recovery day (No class) Read: Chapter 11.1-11.8 Tuesday, October 29th 7:00-9:00pm: Midterm 4 6 Debugging strategies Java collections framework The HashMap class Iterators Object-oriented design Read: Chapter 13 13 Component...

Words: 409 - Pages: 2

Premium Essay

Exploring Programing Languages

...FORTRAN - added structured statements borrowed from Algol to produce Fortran 77. COBOL- more static and only submitted to slight revision in 74. 1980's C++ - a general purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low level memory manipulation. Perl - a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl 5 and Perl 6. Ada - originally designed by a team led by Jean Ichbiah of CII Honeywell Bull under contract to the United States Department of Defense (DoD) from 1977 to 1983 to supersede the hundreds of programming languages then used by the DoD. Objective-C - a general-purpose, object-oriented programming language originally developed in the early 1980s. It is the main programming language used by Apple. Caml ( Categorical Abstract Machine Language) is a dialect of the ML programming language family. 1990's Python - started in December 1989[26] by Guido van Rossum at CWI in the Netherlands as a successor to the ABC language Visual Basic - a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Java - a computer programming language that is concurrent,...

Words: 561 - Pages: 3