业务实体/对象是关于组织还是性能优化?

发布于 2024-10-27 23:12:45 字数 374 浏览 1 评论 0原文

我不知道业务实体和业务对象之间的区别

,但我拥有的是一个具有一些属性的类,稍后我将添加一个 IsValid 方法。

这就是应用程序架构教程教给我的内容

,但我突然意识到,使用这种方法与仅通过层发送/接收数据而不将数据存储在对象中之间有什么区别有什么区别。当我将一个项目添加到数据库时,我不会创建该项目类型的对象然后存储它并将其发送到 BLL 或 DAL,而是将我刚刚收集的信息作为参数发送给 .我的 BLL 方法!

如果我的问题有点令人困惑,我很抱歉。但我希望你能原谅我,因为这个问题和应用程序架构只是一个非常大的海洋..我迷失了! =S

P.S:我添加了我正在使用的技术,希望它能帮助您了解我的环境

I don't know the difference between Business Entities and Business Objects

But what I have is a class that has some properties and I'll add an IsValid method later.

That's what Application Architecture Tutorials taught me

But it just hit me, what's the difference between using this approach and just sending/receiving my data through my layers without storing them in objects .. and when I add an item to the database, instead of creating an object of the item's type then store it and send it to the BLL or the DAL, I would just send the information I just collected as it is, as an argument to my BLL methods!

I'm sorry if my question is a bit confusing. But I hope that you'll excuse me as this question and the application architecture is a just a very big ocean ..And I'm LOST! =S

P.S: I added the technologies I'm using, Hoping it will help you understand my environment

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亚希 2024-11-03 23:12:45

最重要的是,无论哪种方式都可以工作——可以将数据作为一系列参数传递并使其工作。甚至在某些情况下,这样做可能更可取(例如非常简单的应用程序)。

也就是说,人们普遍认为,与通过应用程序的每个方法调用和层传递多个(可能很多)参数相比,编码和维护表示数据的一个或一组对象更容易。

这个概念称为封装,是面向对象编程的核心原则之一。快速谷歌可能会更完整地回答你的问题。

The bottom line is that either way can work--it's possible to pass your data around as a series of parameters and make it work. There are even situations where it might be more derirable to do it that way (e.g. a really simple application).

That said, it's generally accepted that it's easier to code and maintain an object or set of objects that represent your data than it is to pass multiple (possibly many) parameters through every method call and layer of your application.

This concept is called encapsulation, and is one of the core principles of Object Oriented Programming. A quick google will probably answer your question more completely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文