入门3层架构 [英] Getting started on 3 layers architecture

查看:99
本文介绍了入门3层架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我一直在考虑开始一个更复杂的项目来学习如何使用MVC编程,但我真的不明白它是如何工作的,到目前为止我的研究还不是很幸运。

如果有人能在那里放一些灯就会非常有用



我做了一个简单的项目,用这种架构构建一个计算器,但我仍然无法将其抽象为其他场景。



在我的模型层中,我有我的计算器类,只有'calc'方法可以添加或者除了operands / op setter和result getter之外,减去了两个操作数。它也是它的构建器。



控制器只有一个方法可以创建一个计算器实例并设置操作数和操作的值并返回结果。 />


一旦你点击+/-并将它们发送到控制器,View就会获取文本框的值。



我不知道我做了什么是好的,也不知道如何创建一个在数据库中注册人的应用程序。 sql句子在哪里?



我知道我真的迷失在这里,谢谢你的时间!

Hello there, I've been thinking to start a more complex project to learn how to work with MVC programming, but I don't really understand how it works, and haven't been very lucky so far on my research.
It would be really useful if someone could put some light in there

I've made a simple project building a calculator with this architecture, but I still can't abstract it to other scenarios.

In my model layer I had my calculator class, with just the 'calc' method which either added or substracted both operands, besides operands/op setters and result getter. Also it's builder.

The controller just had a method which would create an instance of a calculator and set the values of the operands and operation and return the result.

The View picked up the values of the textboxes once you either clicked +/- and sent them to the controller.

I don't know if what I did it's ok, nor how to, for instance, create an application to register people on a database. Where would the sql sentences be?

I know I'm really lost here, thanks for your time!

推荐答案

你好,

对于吼叫



我不知道我做的是什么,也不知道怎么做例如,创建一个在数据库中注册人的应用程序.sql句子在哪里?



您的UI或界面必须在视图中

模型将包含与Detabase相关的查询,现在控制器将在它们之间桥接





这里有一些链接你希望这个将帮助:)



在7天 - 第4天逐步学习MVC(模型视图控制器) [ ^ ]


这篇关于入门3层架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆