代码背后而不是 [英] Code Behind vs not

查看:60
本文介绍了代码背后而不是的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想决定是否拆分我的代码并使用代码。我用我的一个页面做了b $ b,发现它有点麻烦。


我知道大多数人(以及书籍和文章)都喜欢因为你可以从设计中拆分代码。这是合乎逻辑的。但是,如果你是唯一一个处理代码的人,那么它似乎有点矫枉过正。


我使用Dreamweaver进行设计并找到它当我正在处理它们时,为我的每个页面打开多个文件的麻烦。我

通常一次打开3或4页我正在处理的页面

翻译成6-8个文件打开。


如果我在设计页面中添加一个对象,我需要将代码隐藏页面转到

在那里定义它。如果我在一个页面上与多个人一起工作,我会将
需要运行到代码隐藏的人身上并告诉他将新对象添加到他的b
页面。


在.aspx页面上假设的内容不在代码隐藏中承担

并且必须明确定义。


当提到代码隐藏时,这些都没有真正被讨论过。通常,

你被告知它更好。这种情况在所有情况下都是如此吗?


只是试图得到其他意见,因为我已经设计了大约30页b $ b页面并且我正在努力决定我是否应该拆分文件。


谢谢,


Tom

I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.

I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.

I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open for each of my pages as I am working on them. I
typically have 3 or 4 pages open at one time that I am working on which
translates into 6-8 files open.

If I add an object to my design page I need to go the codebehind page to
define it there. If I was working with multiple people on a page, I would
need to run over to the person working on the codebehind and tell him to add
the new object to his page.

Things that are assumed on the .aspx page are not assumed on the codebehind
and have to be explicitly defined.

None of this is really talked about when codebehind is mentioned. Normally,
you are told that it is better. Is this the case in all situations?

Just trying to get other opinions on this, as I have already have about 30
pages designed and am trying to decide if I should split the files or not.

Thanks,

Tom

推荐答案

Tom,

我认为你有一些针对代码隐藏的有效点。如果您100%确定

,那么您将是唯一一个开发该网站的人,并且您100%确定

不会改变或者赢得的东西不会变得更复杂(比如当我在做爸爸的网站的时候),那么我同意代码隐藏的好处并不是什么。

重大。话虽如此,使用Vs.Net,你可以在
代码隐藏中得到很好的智能感知,这几乎让它变得有价值。个人

我建议你使用它,因为我是一个OO偏执和喜欢分层

架构;)但是如果没有它可以为你工作,那么一切都意味着你好b / b
似乎对你为什么要使用

代码隐藏有相当好的理解......所以你似乎很有可能决定它是否''对你有好处。


Karl


-

我的ASP.Net教程
< a rel =nofollowhref =http://www.openmymind.net/target =_ blank> http://www.openmymind.net/

" tshad" < TS ********** @ ftsolutions.com>在消息中写道

news:em ************** @ TK2MSFTNGP11.phx.gbl ...
Tom,
I think you have some valid points against codebehind. If you are 100% sure
that you''ll be the only one developing the site and you are 100% sure that
won''t change or that things won''t get a lot more complicated (say like when
I do my dad''s website), then I agree the benefits of codebehind aren''t as
significant. having said that, using Vs.Net you get great intellisense in
codebehind which pretty much makes it worthwhile just for that. Personally
I''d recommend you use it because I''m an OO bigot and love tiered
architecture ;) but if it works for you without it, then by all means. You
seem to have a fairly good understanding of why you''d want to use
codebehind...so you seem in a good position to decide if it''s good for you.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"tshad" <ts**********@ftsolutions.com> wrote in message
news:em**************@TK2MSFTNGP11.phx.gbl...
我只是想决定是否拆分我的代码并使用代码。
我用我的一个页面做过,发现它有点麻烦。

我知道大多数人(以及书籍和文章)喜欢它,因为你可以
从设计中分离出代码。这是合乎逻辑的。但如果你是唯一一个处理代码的人,那似乎有点矫枉过正。

我使用Dreamweaver来完成我的设计并发现它有点麻烦
当我正在处理它们时,为我的每个页面打开多个文件。我通常一次打开3到4页,我正在处理它打开6-8个文件。

如果我在设计页面添加一个对象我需要去代码隐藏页面来定义它。如果我在一个页面上与多个人一起工作,我将需要转到代码隐藏工作的人并告诉他
将新对象添加到他的页面。

.aspx页面上假定的内容不会在
代码隐藏中假设,并且必须明确定义。

当提到代码隐藏时,这些都不是真正被讨论过的。
通常情况下,你被告知它更好。这种情况在所有情况下都是如此吗?

只是想对此提出其他意见,因为我已经设计了大约30页,我正在尝试决定是否应拆分文件或没有。

谢谢,

Tom
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble.

I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.

I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open for each of my pages as I am working on them. I
typically have 3 or 4 pages open at one time that I am working on which
translates into 6-8 files open.

If I add an object to my design page I need to go the codebehind page to
define it there. If I was working with multiple people on a page, I would
need to run over to the person working on the codebehind and tell him to add the new object to his page.

Things that are assumed on the .aspx page are not assumed on the codebehind and have to be explicitly defined.

None of this is really talked about when codebehind is mentioned. Normally, you are told that it is better. Is this the case in all situations?

Just trying to get other opinions on this, as I have already have about 30
pages designed and am trying to decide if I should split the files or not.

Thanks,

Tom



将它们分开来看看你的代码更容易,特别是当你有大量文件的b $ b时。 Visual Studio.NET对后面的代码有很好的支持,所以当你修改UI时,其中一些也反映在代码隐藏文件中。


" tshad"写道:
Separate them will make looking at your code easier, especially when you have
large file. Visual Studio.NET has good support for code behind so that when
you modify the UI, some of it is reflected in the code-behind file as well.

"tshad" wrote:
我只是想决定是否拆分我的代码并使用代码。我用我的一个页面做了这件事并发现它有点麻烦。

我知道大多数人(以及书籍和文章)喜欢它因为你可以
从设计中分离出代码。这是合乎逻辑的。但如果你是唯一一个处理代码的人,那似乎有点矫枉过正。

我使用Dreamweaver来完成我的设计并发现它有点麻烦
当我正在处理它们时,为我的每个页面打开多个文件。我通常一次打开3到4页,我正在处理它打开6-8个文件。

如果我在设计页面添加一个对象我需要去代码隐藏页面来定义它。如果我在一个页面上与多个人一起工作,我将需要转到代码隐藏工作的人并告诉他将新对象添加到他的页面。

.aspx页面上假定的内容不在代码隐藏中假定
并且必须明确定义。

当提到代码隐藏时,这些都不是真正被讨论过的。通常,
你被告知它更好。这种情况在所有情况下都是如此吗?

只是想对此提出其他意见,因为我已经设计了大约30页,我正在尝试决定是否应拆分文件或没有。

谢谢,

Tom
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.

I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.

I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open for each of my pages as I am working on them. I
typically have 3 or 4 pages open at one time that I am working on which
translates into 6-8 files open.

If I add an object to my design page I need to go the codebehind page to
define it there. If I was working with multiple people on a page, I would
need to run over to the person working on the codebehind and tell him to add
the new object to his page.

Things that are assumed on the .aspx page are not assumed on the codebehind
and have to be explicitly defined.

None of this is really talked about when codebehind is mentioned. Normally,
you are told that it is better. Is this the case in all situations?

Just trying to get other opinions on this, as I have already have about 30
pages designed and am trying to decide if I should split the files or not.

Thanks,

Tom



请阅读主题主题:


有什么区别/优点

代码背后和代码里面?


Juan T. Llibre

ASP.NET MVP

===========

" tshad" < TS ********** @ ftsolutions.com>在消息中写道

news:em ************** @ TK2MSFTNGP11.phx.gbl ...
Please read the thread with subject :

"What''s the difference/advantages
between code behind and code inside?

Juan T. Llibre
ASP.NET MVP
===========
"tshad" <ts**********@ftsolutions.com> wrote in message
news:em**************@TK2MSFTNGP11.phx.gbl...
我只是想决定是否拆分我的代码并使用背后的代码。
我用我的一个页面做了它并发现它有点麻烦。

我知道大多数人(以及书籍和喜欢它,因为你可以将代码从设计中分离出来。这是合乎逻辑的。但如果你是唯一一个处理代码的人,那似乎有点矫枉过正。

我使用Dreamweaver来完成我的设计并发现它有点麻烦
当我正在处理它们时,为我的每个页面打开多个文件。我通常一次打开3到4页,我正在处理它打开6-8个文件。

如果我在设计页面添加一个对象我需要去代码隐藏页面来定义它。如果我在一个页面上与多个人一起工作,我会需要转到代码隐藏工作的人并告诉他
将新对象添加到他的页面。

.aspx页面上假定的内容不会在
代码隐藏中假设,并且必须明确定义。

当提到代码隐藏时,这些都不是真正被讨论过的。 />通常情况下,你被告知它更好。在所有情况下都是这种情况吗?

只是想对此提出其他意见,因为我已经设计了大约30页,我正在努力决定是否应该是否拆分文件。

谢谢,

Tom
I am just trying to decide whether to split my code and uses code behind.
I did it with one of my pages and found it was quite a bit of trouble.

I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little overkill.

I use Dreamweaver to do my design and find it a bit of a hassle to have
multiple files open for each of my pages as I am working on them. I
typically have 3 or 4 pages open at one time that I am working on which
translates into 6-8 files open.

If I add an object to my design page I need to go the codebehind page to
define it there. If I was working with multiple people on a page, I would
need to run over to the person working on the codebehind and tell him to
add the new object to his page.

Things that are assumed on the .aspx page are not assumed on the
codebehind and have to be explicitly defined.

None of this is really talked about when codebehind is mentioned.
Normally, you are told that it is better. Is this the case in all
situations?

Just trying to get other opinions on this, as I have already have about 30
pages designed and am trying to decide if I should split the files or not.

Thanks,

Tom



这篇关于代码背后而不是的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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