Two Laptop Bag
The moose likes Web Services and the fly likes Good idea to reuse the object? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Good idea to reuse the object?" Watch "Good idea to reuse the object?" New topic

Good idea to reuse the object?

susmitha singh

Joined: Feb 02, 2011
Posts: 1
Hi ,

I am new to Web service and trying to develop one service. I have a basic question like we have an Object Address and inside it we have 4 attribute out of it only 2 are useful
can I reuse Address object or should i create a new object that holds only the attribute that are needed for the service.


1. firstName
2. lastName
3. PhoneNumber
4. e-mail

We don't need phone number and e-mail so is it a good idea to use this same Address object or create a new one.


William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13018
I would certainly create a class to hold only the variables you need.

I agree. Here's the link:
subject: Good idea to reuse the object?
jQuery in Action, 3rd edition