DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Java (http://www.daniweb.com/forums/forum9.html)
-   -   best way to code 3 tier application (http://www.daniweb.com/forums/thread84379.html)

agrothe Jul 24th, 2007 11:24 am
best way to code 3 tier application
 
I'm wondering what thoughts people have on the best way to implement a 3 tier application.

I'm playing with the idea of multiple clients <---> server <----> database server <----> mysql database.

I'm not sure if the database server is a necessary step though.

My previous foray into java network progamming just used sockets, but I've read that RMI(?) is a better approach? What think ye? Does anyone know of a basic 3 tier code sample I can get my feet wet with?

iamthwee Jul 24th, 2007 5:19 pm
Re: best way to code 3 tier application
 
RMI is the way to go. Definitely.

Ezzaral Jul 24th, 2007 5:33 pm
Re: best way to code 3 tier application
 
J2EE is also designed for such things, but it can be a pretty heavy architecture for a simple client-server app.

jwenting Jul 24th, 2007 11:53 pm
Re: best way to code 3 tier application
 
why reinvent the wheel when there are perfectly good solutions like Hibernate and Spring already out there?

agrothe Jul 25th, 2007 1:08 am
Re: best way to code 3 tier application
 
Thanks for the suggestions! Isn't Hibernate an implementation of RMI?? anyway....

Hypothetically speaking, if an application need to scale from 50 to 500,000 users(disregarding hardware issues) would all three tiers really be necessary? Could we just go with:

many clients <----> Server <----> Database ???

Although I guess the 3rd Tier allows for better control of say, connecting to different types of databases though...

And although yes, Hibernate/RMI seams like the way to go, I think all would agree setting up a simple client server from scratch or playing with a code sample is probably better starting out to learn the bare bones first. At least I find that jumping into something more complex without first seeing the different parts in action just complicates the matter.

jwenting Jul 25th, 2007 12:48 pm
Re: best way to code 3 tier application
 
No, Hibernate abstracts away all that nitty gritty JDBC code to access the database.
http://www.hibernate.org

You shouldn't care whether you're talking through RMI or whatever, use an existing system to worry about that.

Spring makes for a lot of very nice capabilities. http://www.springframework.org/

thekashyap Jul 26th, 2007 7:24 am
Re: best way to code 3 tier application
 
Depending on your application one of the 2 approaches can be chosen.. If you have enough complexity in DB parts OR more than one servers connecting to DB layer, you might want to have database server separately..
In anycase as Ezzarel pointed out J2EE is designed EXACTLY for this purpose.. See this architecture diagram.. it's not mandatory to have 2 physically different machines for J2EE and DB server, both can be on one machine..

tonakai Jul 26th, 2007 7:30 am
Re: best way to code 3 tier application
 
i suggest:
hibernate for data layer
spring for MVC
freemarker view layer
dwr for ajax


All times are GMT -4. The time now is 1:43 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC