473,387 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Tags vs. code-behind

Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?

Thanks !

Feb 27 '07 #1
8 1126
On Feb 27, 10:36 am, "Zeba" <coolz...@gmail.comwrote:
Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?
Using code-behind you separate Business Logic and UI design

Using code-inline the script can be changed without re-deploying the
whole application.

http://www.eggheadcafe.com/articles/20030518.asp

Feb 27 '07 #2
Using code-inline the script can be changed without re-deploying the
whole application.
Something that should be totally avoided in "true MVC" applications.
It's a bad practice.

Looking into the article, which reads "There are certain situations where a
purely inline - code implementation is justified"... I tend to disagree.

Also, the author does not give any concrete examply to substantiate the
statement.

In my view, inline code can be and must be totally avoided. The reason is
obvious - seggregation of the UI from the logic.... the heart of MVC
pattern.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
Feb 27 '07 #3
"MasterGaurav (www.edujini-labs.com)" <ga*****************@nospam.gmail.com>
wrote in message news:es**************@TK2MSFTNGP05.phx.gbl...
>Using code-inline the script can be changed without re-deploying the
whole application.

Something that should be totally avoided in "true MVC" applications.
It's a bad practice.
I agree.
In my view, inline code can be and must be totally avoided. The reason is
obvious - seggregation of the UI from the logic.... the heart of MVC
pattern.
I would agree, apart from in one specific instance related to ASP.NET -
Global.asax, where there are sometimes justifications for in-line code...
Juan is a particular advocate of this, IIRC...
Feb 27 '07 #4
On Feb 27, 2:16 pm, "MasterGaurav \(www.edujini-labs.com\)"
<gaurav.vaish.nos...@nospam.gmail.comwrote:
It's a bad practice.
It depends on the need.

Feb 27 '07 #5
No disadvantage. MS is moving towards "code free" development.

You can expect to see a lot more of this in the future, so you may want to get into it now.
"Zeba" <co******@gmail.comwrote in message news:11**********************@a75g2000cwd.googlegr oups.com...
Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?

Thanks !

Feb 27 '07 #6

The base argument is really:

Rapid Code Development VS Good Code Development.

Unless I'm whipping up a demo that needs to be done by yesterday,
I would avoid tags 99.9% of the time.

Rapid <Good most of the time.

Good development means it is maintainable (among other things), and the
<tagsapproach is cumbersome in that regard.

"Zeba" <co******@gmail.comwrote in message
news:11**********************@a75g2000cwd.googlegr oups.com...
Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?

Thanks !

Mar 15 '07 #7
On Feb 27, 5:36 am, "Zeba" <coolz...@gmail.comwrote:
Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?

Thanks !
I agree with the other posters wholeheartedly. The UI should most
definitely be separated from the business logic. In my personal
experience, even for fast demos, there's no *compelling* reason to
embed the source code right in the Web page. That assumes, of course,
that you're using Visual Studio or a similar editor that's capable of
handling code-behind files. The plumbing is all handled for you, and
the development experience is virtually seamless.

However, that's my *personal* experience, and your mileage may vary.

Another consideration is whether or not you want people to see your
intellectual property. If the source code is embedded right in the
pages, it's a lot harder to protect your source code from casual
viewing. With code-behind, you can compile the business logic into one
or more DLLs and avoid deploying the .VB & .resx files altogether;
that, coupled with a decent obfuscator, helps to protect your
intellectual property.

Mike

Mar 15 '07 #8
On Feb 27, 5:36 am, "Zeba" <coolz...@gmail.comwrote:
Hi guys..

I just wanted to know whether its better to use the asp tags (or drag
n drop) or write the actual code-behind for things like login, data
accesses etc. I guess its easier to use the tags but does it have any
disadvantages ?

Thanks !
I would *especially* use a code-behind for data access. You'd be
divulging details about how you connect to your data source. Big no
no.

Same goes for user authentication and authorization.

Call me paranoid. These days, a determined hacker WILL penetrate your
system if he chooses to do so, and if your code is sitting there with
the instructions for connecting to your database right in the Web
pages, you WILL live to regret it.

Be safe. Move the code into a codebehind file. Obfuscate the code
during the build. Then, prior to deployment, remove any and all source
code files (except the global.asax file). Be sure not to include any
sensitive instructions in the global.asax file. Security is
everything.

Mike

Mar 15 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: varois83 | last post by:
Hi I am fairly new to PHP/mysql and was reading an online tutorial and learned that my short tags weren't enabled. At this time I have no need for them, my setup apache/mysql/php runs on my PC...
24
by: Day Bird Loft | last post by:
Web Authoring | Meta-Tags The first thing to understand in regard to Meta Tags is the three most important tags placed in the head of your html documents. They are the title, description, and...
1
by: Max Power | last post by:
HTML reprocessor: how do you get rid of the obese MS-Word (normal or filtered) HTML? I just want all the fancy MS tags removed and replaced with basic ones, or if applicable -- stripped entirely...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.