to Banq 关于你的第八章的一些疑问

07-06-01 X.Underset

8.5.1 DAO模式

中提到:"不推荐在EJB的Session Bean中直接使用JDBC调用语句,而是通过DAO模式来间接地访问数据源。"






2007-06-02 20:05
I prefer to explain that in an engineering thought.

how to make IT project successful?

1. easy to test to make your application robust

so what does that mean easy?

you write a "main" and then you know if your piece of code is correct or not.

so EJB is definitely not making you easy to test business logic. because you must package them,deploy them,connect to DB etc. then make a simple test. is it easy?

conclusion: each fancy technology in java should used as a facade if that cannot bring a simple test.

2. do u know the layer theory?

one abstract layer more can trade off more generosity in application.

check JVM, why can windows, linux,unix can serve java application. because jvm is the layer between them. that is why java partially slow.

check ODBC and JDBC, why database can connect to different OS? same reason.

check google, why they bought mozilla firefox, because that creates one layer more between all server side applications created by google and the MS monopolied OS? that is to say, if MSSOFT tries to update windows, the google just needs to update their browser APIs and all the rest of the applications dont need a single touch.

3. OO design is not ur project purpose. it is one of the way to well solve some problems during ur project. but mainly it is client and business-oriented, more in the macro level. because the client requirement changes all the time, that is why application needs to be flexible and dynamic.

but it doesnt create sth new or some core technology.