Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java SE 综合讨论区 » 实战错误讨论  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:偶想定义一个接口,请问这么写对吗? [Re:lxymerry]
ftang



版主


发贴: 214
积分: 38
于 2005-11-10 04:26 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
This is the worst Database interface design I ever seen, forget about the syntax problem, this interface design is totally disaster:

1. expose the connection --> getConn(), the major idea of DAO object is make the database connection transparent to the users. if expose the getConection to user, what connection u gonna use when client call execSQL method?

2. int execSQL() usually we don't primitive type on interface, because Object is more "coarse" granuality

3.ResultSet getQueryResult, when you expose the result set to client, have you thought how to recycle it? common sense, when using resultset, the db connection must be open.

4 String getXmlByResultSet why the return type is "String" not "DOM" object? the return type of a interface should be accurate.

5. throw SQLException, you design the DB wrapper, so this database related exception should be handled internally, what u expect user to do when user got "SQLException"? if user can't "recover" from the exception(because you should handle the it) they should not see these exception on interface.

general speaking: Syntax error is easy to fix...design error cost much more than you can image to fix...


ftang edited on 2005-11-10 05:02


搞笑QQ图片

话题树型展开
人气 标题 作者 字数 发贴时间
9850 偶想定义一个接口,请问这么写对吗? lxymerry 368 2005-10-09 12:56
9138 Re:偶想定义一个接口,请问这么写对吗? ftang 1186 2005-11-10 04:26
7992 Re:偶想定义一个接口,请问这么写对吗? why 125 2005-10-09 21:57
8146 Re:偶想定义一个接口,请问这么写对吗? bluecrystal 11 2005-10-09 23:47
8183 Re:偶想定义一个接口,请问这么写对吗? lizhihua 104 2005-10-10 12:45
8218 Re:偶想定义一个接口,请问这么写对吗? lxymerry 42 2005-10-10 17:23
7954 Re:偶想定义一个接口,请问这么写对吗? 2352439 69 2005-10-11 13:46
8681 Re:偶想定义一个接口,请问这么写对吗? wallacer 394 2005-11-09 17:10

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923