views:

124

answers:

2

What s the best design pattern or best practice for data access (database access or file system access) in Distributed J2EE, .Net Environment, rails or php ?

A: 

In the Java world, using DAOs, POJOs, a good ORM, and a 2nd level cache seems to be a very common approach (replace POJOs by Entities 3.x and ORM by JPA if you want).

Actually, I think it applies to .NET too.

With rails or PHP, I don't know the details so I'll let enlightened people answer.

Pascal Thivent
how about establishing connection in J2EE, would you recommend Service Locator ? Singleton (does it scale well)?
Use a connection pool. Any decent ORM will be able to lookup a DataSource and obtain connections from a connection pool. Service Locator can still be use but the trend is to use Dependency Injection (DI) and to inject things that you need (including a datasource). Singletons, just forget them.
Pascal Thivent
A: 

There is a your best friend for data access patterns ;) http://martinfowler.com/eaaCatalog/index.html

Andrei Taptunov
i already know that. question is which one to pick ?