理论性问题,求助!

说好不能打脸
优质创作者: Java技术领域
领域专家: 后端开发技术领域
2006-03-24 02:22:06
最近小弟在阅读《J2EE核心模式》得时候,遇到两个这样的不佳实现的描述:
1、把表现层的数据结构暴露给业务层。
2、把表现层数据结构暴露给业务领域对象。

但是小弟百思不得其解,有没有哪位大侠能给小弟解释一下,可能的话举个例子,谢谢了
...全文
357 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ibiswang 2006-03-26
  • 打赏
  • 举报
回复
I can't use the chinese input method, I think my input files have been destroied. so I will description my option in English:

You should undstand the multi-layer programming pattern, that's mean there are many layers so that we can build a loose-coupled system.

A classic multi-layer system could be divided into three layers: presentation, business and persistence. From the presentation layer, we could gather the user input and cache them input a structed-data, often it is an ActionForm. After we have got the user input---the ActionForm, we should go into writing business code to implement the business logic, You can write all the business logic code in your action's execute method, but for building a loose-coupled system, you'd better abstract another layer---buiness layer, and you should invoked business logic method in your action's execute method, so a question will raise up: what's the parameter/object we should pass to business logic method: the ActionForm or Another object? Here should be another object, often we call it DTO, Data Transfer Object, by DTO pattern, we can divide the business layer and the presentation layer, if we adjust the presentaion layer, the business layer will be affacted very little. that's why we should not "把表现层的数据结构暴露给业务层".

In the business layer, we often write some business logic to implement our business rules or buinsess flows, in the business logic codes, we must do some curd(create, update, read and delete) opers on the target database, for good pattern to deal with the database operation, we should finish these tasks by the persistent layer, we often use the DAO pattern here. so a question will raise up, how can we pass our data in business layer--the DTO---into our DAO methods. some time , some body may want use the Domain Object as the DTO object, this may easy your coding, but if you Domain has been changed in the future, this will affact the both persistence and business layers, so the better way is you should not use the domain object as the DTO.

Ooh, my poor english!!!
说好不能打脸 2006-03-26
  • 打赏
  • 举报
回复
各位大哥,路过也帮顶一下啊,帮顶有分啊!
TinyJimmy 2006-03-26
  • 打赏
  • 举报
回复
不敢苟同。既然分了业务层和表现层,为什么还业务层还需要使用表现层的业务结构?

业务层管好你的业务就可以了,至于使用JSP还是XML输出,业务层不应关心,否则的话,业务层和具体的展现又相关了。
tomuno 2006-03-25
  • 打赏
  • 举报
回复
表现层数据结构修改时,还要修改其他层
这样修改的代码量比较大,相关的其他工作也很多,浪费时间和金钱
说好不能打脸 2006-03-25
  • 打赏
  • 举报
回复
再顶
aaa2003gf 2006-03-24
  • 打赏
  • 举报
回复
先理解MVC再来理解它吧
lydvqq 2006-03-24
  • 打赏
  • 举报
回复
UP.只用过MVC,但没有深入研究过.学习.
说好不能打脸 2006-03-24
  • 打赏
  • 举报
回复

谢谢楼上的

那么业务层和业务领域对象有什么区别呢?

现在的表现层一般采用的是HTML+服务标签(表现层助手)的方式加以实现的。
那么表现层的数据结构有具体是指什么呢??
upcmill 2006-03-24
  • 打赏
  • 举报
回复
jsp端的数据结构不要跟业务逻辑处理直接传递数据,通过PO来传递。
你可以看一下struts,他的设计思想MVC结构就是为了降低各个层之间的耦合度的。
wizardblue 2006-03-24
  • 打赏
  • 举报
回复

应该是分层,数据低藕合吧
内容概要:本文围绕“可再生能源发电与电动汽车的协同调度策略”展开硕士论文级别的研究与复现工作,基于Matlab平台构建了高比例可再生能源接入背景下电力系统与电动汽车(EV)之间的多时间尺度协同优化模型。研究重点在于应对风光发电不确定性,充分利用电动汽车作为移动储能单元的灵活充放电能力(含V2G技术),实现电网削峰填谷、提升新能源消纳效率与系统运行经济性。文中综合考虑了异质电动车集群特性、V2G过程中的损耗约束以及随机因素影响,采用如深度确定性策略梯度(DDPG)强化学习、混合整数线性规划(MILP)等先进优化算法进行求解,并通过基准模型对比验证了所提自适应调度策略在提升电网稳定性、降低运行成本方面的有效性。; 适合人群:具备一定电力系统基础知识、优化理论背景及Matlab编程能力的研究生、科研人员,以及从事新能源并网、智能电网调度、车网互动(V2G)等方向的工程技术人员。; 使用场景及目标:①学习并复现已发表高水平硕士论文中的协同调度建模方法与仿真流程;②掌握将深度强化学习(如DDPG)应用于虚拟电厂、电动汽车集群调度等复杂非线性决策问题的技术路径;③为开展新能源消纳、需求侧响应、微电网优化运行等相关课题的研究提供可复用的代码框架与创新思路参考。; 阅读建议:建议读者结合文中提供的完整Matlab代码与技术文档,深入理解模型构建逻辑、算法实现细节与参数设置依据,优先在Simulink/Matlab环境中运行并调试仿真案例,通过调整场景参数与算法超参,探究不同策略对调度效果的影响,从而深化对协同调度机制与智能优化方法应用的理解。

67,535

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧