How business object be used in such worst situation?

What I get from front end (thick client) is a large value object with undefined data type (data in vector or hashtable), it 's difficult to extract the data from the object in business logic layer. Eg. in gui, data managed in table, and I need to extract the data in the business tier, such that the business layer need to know the structure of front end data. It 's not make scense any more.

The worst case is I cannot control the data construction from front end.

So, I would like a data model to convert the data into business data (simple data).

But it seems not a best case.

So, any suggestion?

[634 byte] By [96472834a] at [2007-9-29 16:16:28]
# 1
Hi, Could you be more clearer in your question.Yetish
yetisha at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

Perhaps the use of corba to share objects between the client and server

the client creates and populates the object the server sees the result

as a typed object.

A second and perhaps simpler method is to serialise the data objects

then deserialise them on the server to create the objects you will use.

With either approach there is no ambiguity about the data being

transfered, if you do it correctly. If however you serailise a Vector

then you have the same problem.

Try a combination of data specific classes, such that there is a class

to represent every type of data you will pass, and the decorator pattern

to allow flexibility in building the data objects. The decorator pattern

may significantly reduce the number of data classes that you need to

develop.

However it all depends on exactly what you want to do.

matfud

duftama at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> What I get from front end (thick client) is a large

> value object with undefined data type (data in vector

> or hashtable), it 's difficult to extract the data

> from the object in business logic layer. Eg. in gui,

> data managed in table, and I need to extract the data

> in the business tier, such that the business layer

> need to know the structure of front end data. It 's

> not make scense any more.

> The worst case is I cannot control the data

> construction from front end.

> So, I would like a data model to convert the data into

> business data (simple data).

> But it seems not a best case.

> So, any suggestion?

The data should be encapsulated in such a way that the data itself makes sense, not so it makes sense for the GUI (or database, etc.)

If you have a customer it is a Value Object. If it is a list of customers then it is the same Value Object but in an ArrayList.

If each customer has a list of telephone numbers (and it makes sense to always have that list with the customer) then each customer Value Object would have a list (ArrayList) of telephone Value Objects.

Each layer, GUI, business, database, must manipulate the data model in a way that makes sense to the layer, but still must maintain the data layer.

jschella at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 4

Thanks all,

actually, the problem is the incoming data has no regular type.

The value object contains different data in different situation.

One may be a hastable, one may be a vector and so on.

What the server (business tier ) need to do, is to define a generic approach to obtain those data and manage them into a systematic data without following the front end component structure...

I have tried to use a web service idea to apply on it. Such that using a xml as a function descriptor. The xml describe the server function(s) and the data needed.

But I want to find a best way to solve it.

So, does anyone has experience on such work?

Let say swing application calling a server program via rmi. The swing is a thick client with a lot of functions and components. The server side handles business function only.

96472834a at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

InfoBus was one such method of regularising communication formats.

Its far easier if you can get the client to define the information in

a manner that the server can easily interpret. If this is beyond your

control then it is a difficult problem to solve.

InfoBus defined a number of data types that could be transfered.

These were generic types such as tables. The infrastructure was desinged

to allow easy communication between office components, os it had types

defined for tables (similar to rowsets), documents, and a variety

of other generic types for transfering data.

For your interest InfoBus was developed by Sun and Lotus (Corel?) to allow

lotus' esuite software to work. This API provided office software

(spredsheet,wordproessor, etc.) in a web browser. It required that

multiple components in the same browser window could communicate and

insert themsleves into each other. Alot of it was, however, related to

the components being able to find each other. The rest was to enable

the components to understand each other. As I said earlier they defined

many generic "types" of data transfer. These data transfer types could

describe themselves, to a certain degree, to thier partner.

That was quite a while ago and there must be some similar framework in current usage.

matfud

duftama at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 6

If I got it right, you get the data in some format that you can't change, because the gui is not under your control.

The format is based on the specific needs of the gui, which does not make sense from a business perspectiv.

You want to find a clean way to translate between the gui-format and the business-format.

Is this correct?

If so you could try the Algorithm pattern (can somebody check the name and details? I'm writing this from memory right now)

Have a interface that has two methods, or two interfaces with one method each, for data translation: convertGui2Bus and convertBus2Gui

Now you can have a bunch of classes implementing this interface to convert the various kinds of data.

Instead of creating the dataobjects completely from scratch you

could consider Adapter classes. The class looks like a busines object, but internally uses the gui-dataformat. So setting up such an object becomes extremly easy. Writing getters and setters might become difficult though.

HTH

Spieler

spielera at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...
# 7

> Thanks all,

> actually, the problem is the incoming data has no

> regular type.

> The value object contains different data in different

> situation.

That still means it is ordered in some way.

> One may be a hastable, one may be a vector and so on.

> What the server (business tier ) need to do, is to

> define a generic approach to obtain those data and

> manage them into a systematic data without following

> the front end component structure...

That isn't possible. You must have some notion of the type of data. You can't decide to apply the business rules for a social security number to a zip code. Both have 9 digits so with out some other information about the context you can't tell them apart.

In the same way you don't want to save a vendor information in the customer table just because both look like address information.

> I have tried to use a web service idea to apply on it.

> Such that using a xml as a function descriptor. The

> xml describe the server function(s) and the data

> needed.

> But I want to find a best way to solve it.

>

> So, does anyone has experience on such work?

> Let say swing application calling a server program via

> rmi. The swing is a thick client with a lot of

> functions and components. The server side handles

> business function only.

Do you control the GUI or not? If you do then you dictate how the GUI gives the data to you. If not then you produce a translation layer that converts the GUI format into a form that is usable by all of the other layers.

jschella at 2007-7-15 14:30:51 > top of Java-index,Other Topics,Patterns & OO Design...