• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Singleton Pattern

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
what is singleton pattern & Vaue Object Pattern?

Thanks
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Lakshmi,

I can answer your question about Singleton Design pattern.
A Singleton Design pattern is meant to instantiate a class only once. In many cases it is absolutely essential to have a unique instance of a class.

Here's one of the ways to implement the Singleton pattern:

class SingletonPattern
{
// Constructor
protected SingletonPattern()
{
// Add your code here
}

private static SingletonPattern instance = null;

public static SingletonPattern getInstance()
{
if (instance == null)
return new SingletonPattern();
else
return instance;
}

This design allows access to the getInstance method, but at the same time does not allow access to the SingletonPattern object.
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Value Object (VO) or Data Transfer Object (DTO) are patterns related on how your data should be transmitted among your application layers.
Bascially, put anything you need into a objetc, wich we'll call the transfer object.
See
http://java.sun.com/blueprints/corej2eepatterns/Patterns/TransferObject.html
 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Value Object pattern is used to reduce the network traffic. Consider that you are requesting to get a customer detail from an Entity Bean Via a Session Bean. Instead of calling getCustomerName(), getCustomerAddress(), getCustomerCity() methods separately will increase the network traffic, Instead you can call getCustomerDetails() which inturn will return CustomerVO object which contains all the customer data.

Regards,
M.S.Raman
 
Does this tiny ad smell okay to you?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic