what design pattern to use in this simple problem?

Hi there,

help is very needed here as I don't know what pattern to use? (newbie)

here's the deal: I have an empl that have the following information:

1. account (id, first, name,...)

2. projects (id, name of project, duration...)

3. account_info (login_name, lastloged...)

etc

when the empl logs in, I need to get all of those information, what design pattern should I use?

Facade, Command or Factory (there are diff empl)?

in the facade I can do this:

facadeEmpl()

{

//get account

//get projects

//get info

}

but isnt that like the command design pattern? Not sure.

can anyone help here.

thanks

[861 byte] By [xianwinwina] at [2007-10-3 10:28:47]
# 1

> Hi there,

>

> help is very needed here as I don't know what pattern

> to use? (newbie)

>

> here's the deal: I have an empl that have the

> following information:

> 1. account (id, first, name,...)

> 2. projects (id, name of project, duration...)

> 3. account_info (login_name, lastloged...)

> etc

>

> when the empl logs in, I need to get all of those

> information, what design pattern should I use?

Who says you need a design pattern?

>

> Facade, Command or Factory (there are diff empl)?

None of the above. Sounds like you need an SQL or LDAP query.

The Data Access Object comes to mind.

You sound like you've got "small boy with a pattern" disease.

%

duffymoa at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 2

"small boy with a pattern" I like it :-)

SQL is mandatory, no question! there's a DAO for that BUT, and maybe i didn't state my question correctly, I need a BEAN! so all info will be transfered to the business layer. Now, since I need (1) account info (2) project info (3)...(4) doesn't that require me to have a facade? command?

xianwinwina at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 3

> "small boy with a pattern" I like it :-)

>

> SQL is mandatory, no question! there's a DAO for that

> BUT, and maybe i didn't state my question correctly,

> I need a BEAN! so all info will be transfered to the

> business layer. Now, since I need (1) account info

> (2) project info (3)...(4) doesn't that require me to

> have a facade? command?

Maybe you can create one bean that has an account, project, and user reference all packed inside it. what would the abstraction be? Credentials, perhaps?

Don't care what pattern you call it. I'd say it's just designing with objects. Everything need not be a GoF pattern.

%

duffymoa at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
> "small boy with a pattern" I like it :-)heh heh good to see you didn't take it as the insult it isn't! somebody actually wrote to Erich Gamma - one of the GoF - and asked for advice as he was unable to incorporate all 23 patterns into his project! talk about missing the
georgemca at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 5

> > "small boy with a pattern" I like it :-)

>

> heh heh good to see you didn't take it as the insult

> it isn't! somebody actually wrote to Erich Gamma -

> one of the GoF - and asked for advice as he was

> unable to incorporate all 23 patterns into his

> project! talk about missing the point!

Indeed. I've had a bout or two of the disease myself. I'm better now. 8)

%

duffymoa at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 6
> Everything need not be a GoF pattern.Heresy! ;o)yawmark (<-- Observer)
yawmarka at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 7

> heh heh good to see you didn't take it as the insult

> it isn't! somebody actually wrote to Erich Gamma -

> one of the GoF - and asked for advice as he was

> unable to incorporate all 23 patterns into his

> project! talk about missing the point!

This is pretty funny, because some people treat the GoF book as such canon that they think there ARE only 23 patterns.

Lots of other great stuff out there, including:

http://www.amazon.com/gp/product/0471958697/ref=wl_it_dp/102-0577819-2536135?ie=UTF8&coliid=IQR2KUSL6MO38&colid=D2F70PJMWJYC

http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420/sr=1-1/qid=1164213061/ref=pd_bbs_sr_1/102-0577819-2536135?ie=UTF8&s=books

http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Addison-Wesley/dp/0321200683/sr=1-2/qid=1164213061/ref=pd_bbs_2/102-0577819-2536135?ie=UTF8&s=books

%

duffymoa at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 8
> > Everything need not be a GoF pattern.> > Heresy! ;o)> > > yawmark (<-- Observer)That's a Flyweight argument.%
duffymoa at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 9

> > Everything need not be a GoF pattern.

>

> Heresy! ;o)

>

>

> yawmark (<-- Observer)

I'm an atheist, so heresy means little to me. I'd prefer to say it goes against all reason

george (<-- Adapter)

any other Visitors ( a two-fer :-)) want to add anything?

georgemca at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 10
> I'd prefer to say it goes against all reasonIf you're not writing HelloWorld with GoF patterns, you're wrong. ;o)Can somebody call a Moderator?~
yawmarka at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 11
> That's a Flyweight argument.Indeed. Right up there with "Java is slow", and "Java is pass-by-reference for objects". :o)~
yawmarka at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 12

> > I'd prefer to say it goes against all

> reason

>

> If you're not writing HelloWorld with GoF patterns,

> you're wrong.

>

> ;o)

>

> Can somebody call a Moderator?

>

> ~

alright, alright, compose yourself! don't get in such a state, you're misinterpreting me

georgemca at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 13
> alright, alright, compose yourself! Is that a request, or a Command?> don't get in such a state, you're misinterpreting meBut my Strategy is paying off already...~
yawmarka at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 14

> > alright, alright, compose yourself!

>

> Is that a request, or a Command?

>

> > don't get in such a state, you're

> misinterpreting me

>

> But my Strategy is paying off already...

>

> ~

10 duke dollars to the most creative pun on "singleton" or "proxy". I'll mediate

georgemca at 2007-7-15 5:51:19 > top of Java-index,Other Topics,Patterns & OO Design...
# 15
> 10 duke dollars to the most creative pun on> "singleton" or "proxy". I'll mediateI'm sorry, George, I don't recall your being added to the Chain of Responsibility here.%
duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 16

> > 10 duke dollars to the most creative pun on

> > "singleton" or "proxy". I'll mediate

>

> I'm sorry, George, I don't recall your being added to

> the Chain of Responsibility here.

>

> %

I was. definately. I left you a memento, didn't you get it?

georgemca at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 17
> I was. definately. I left you a memento, didn't you get it?Obviously my Proxy failed to forward it. I'll be speaking to her...%
duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 18
I'll have to ask her about a new Decorator, too. I need to add something new to this place.%
duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 19
> > I was. definately. I left you a memento, didn't you> get it?> > Obviously my Proxy failed to forward it. I'll be> speaking to her...> > %her? is she pretty? is she a singleton? what's her number?
georgemca at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 20

> > > I was. definately. I left you a memento, didn't

> you

> > get it?

> >

> > Obviously my Proxy failed to forward it. I'll be

> > speaking to her...

> >

> > %

>

> her? is she pretty?

She's got quite a Wrapper, indeed.

%

duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 21

> > > > I was. definately. I left you a memento,

> didn't

> > you

> > > get it?

> > >

> > > Obviously my Proxy failed to forward it. I'll

> be

> > > speaking to her...

> > >

> > > %

> >

> > her? is she pretty?

>

> She's got quite a Wrapper, indeed.

>

> %

that's cheating. I thought we were punning on GoF

well, as long as she's not married to some burly builder, I'd love to iterate 'er (sorry)

georgemca at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 22

> that's cheating. I thought we were punning on GoF

Isn't Wrapper a synonym for Adapter? More evocative, especially when speaking about my lovely Proxy.

> well, as long as she's not married to some burly

> builder, I'd love to iterate 'er (sorry)

Is your Iterator bidirectional?

%

duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 23

> > that's cheating. I thought we were punning on GoF

>

> Isn't Wrapper a synonym for Adapter? More evocative,

> especially when speaking about my lovely Proxy.

is it? I'm not so sure. an adapter may be a wrapper, but then, don't decorators, and proxies also wrap objects?

> > well, as long as she's not married to some burly

> > builder, I'd love to iterate 'er (sorry)

>

> Is your Iterator bidirectional?

>

> %

insofar as it goes in and out. it doesn't go both ways, if that's what you mean.....

georgemca at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 24
LOL! Thanks for the clarification.Have a great holiday, George. It's been a pleasure to see you here.Sincerely, %
duffymoa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 25
GuysIt has been a pleasure reading your posts!enjoy your holiday
xianwinwina at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 26

> LOL! Thanks for the clarification.

>

> Have a great holiday, George. It's been a pleasure

> to see you here.

>

> Sincerely, %

holiday? of course, it's Thanksgiving, isn't it! I'm in ye olde UK, so that didn't click at first

thanks, both of you. enjoy your holidays!

georgemca at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...
# 27
> holiday? of course, it's Thanksgiving, isn't it! I'm> in ye olde UK, so that didn't click at first> > thanks, both of you. enjoy your holidays!What George says ...kind regards,Jos (< delegator, a bit slow but still ;-)
JosAHa at 2007-7-21 13:17:18 > top of Java-index,Other Topics,Patterns & OO Design...