Inline Code or Code behind
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes -
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesHorses for courses :-)
Regards, Nish
Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New) -
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesQuartz... wrote:
What is the prime advantage of that ?
i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesI have heard that the performance is suppose to be the same nowadays (not so a while back). That said though, I see the use of code behind much cleaner than combining your pesentation and code in the same pages. Personally, I think it is just lazy programming to combine them.
Rocky <>< Latest Code Blog Post: ASP.NET HttpException - Cannot use leading "..".. Latest Tech Blog Post: Microsoft Zune to be built by Toshiba
-
Quartz... wrote:
What is the prime advantage of that ?
i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.
-
Quartz... wrote:
What is the prime advantage of that ?
i just assume they're lazy: it's easier to post one file than two. code behind is better. anyone who disagrees is wrong.
Chris Losinger wrote:
code behind is better. anyone who disagrees is wrong.
Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes -
Chris Losinger wrote:
code behind is better. anyone who disagrees is wrong.
Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesQuartz... wrote:
Well i think, that would be a gross generalization
i would never make a gross generalization.
Quartz... wrote:
What do you think is advantage of using code behind rather than inline code other than number of files ?
the increased separation of logic and presentation is nice.
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesThe reason they use inline is because its easier to explain the tutorial. If they used code behind for an example they would have to explain what code behind is, why to use it, ect. for each example they use it in. Rather then going that route they simple use inline. Stick to the phrase KISS (keep it simple studpid) when it comes to tutorials. Their is no real performance difference is more of a preference, separating presentation from code.
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesMy whole criteria is if there is very minimal code place it inline otherwise use code behind. If the code grows refactor it to convert into a code behind model.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesFrom a declarative programming perspective, regardless of ASP.NET or not, I've decided I prefer code behind. The whole point is to keep a clean separation between the imperative and declarative code, and inline code, while a cute feature, I've found isn't useful. Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith -
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesI like code behind. It is as simple as that. Here's your well or not-so-well documented code... ;P
namespace Monster_Maker__alpha_ { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lbHeader = new System.Windows.Forms.Label(); this.clbPartyNumber = new System.Windows.Forms.CheckedListBox(); this.cbPartyLevel = new System.Windows.Forms.ComboBox(); this.lbPartyNumber = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lbHeader // this.lbHeader.Font = new System.Drawing.Font("Mistral", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbHeader.Location = new System.Drawing.Point(310, 0); this.lbHeader.Name = "lbHeader"; this.lbHeader.Size = new System.Drawing.Size(300, 50); this.lbHeader.TabIndex = 0; this.lbHeader.Text = "Monster Maker (alpha)"; // // clbPartyNumber // this.clbPartyNumber.FormattingEnabled = true; this.clbPartyNumber.Items.AddRange(new object[] { "0", "1 to 3", "4 to 6", "7 to 9", "10+"}); this.clbPartyNumber.Location = new System.Drawing.Point(0, 46); this.clbPartyNumber.Name = "clbPartyNumber"; this.clbPartyNumber.Size = new System.Drawing.Size(120, 94); this.clbPartyNumber.TabIndex = 1; // // cbPartyLevel // this.cbPartyLevel.FormattingEnabled = true;
-
My whole criteria is if there is very minimal code place it inline otherwise use code behind. If the code grows refactor it to convert into a code behind model.
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. -Brian Kernighan
thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes -
I like code behind. It is as simple as that. Here's your well or not-so-well documented code... ;P
namespace Monster_Maker__alpha_ { partial class Form1 { /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.lbHeader = new System.Windows.Forms.Label(); this.clbPartyNumber = new System.Windows.Forms.CheckedListBox(); this.cbPartyLevel = new System.Windows.Forms.ComboBox(); this.lbPartyNumber = new System.Windows.Forms.Label(); this.SuspendLayout(); // // lbHeader // this.lbHeader.Font = new System.Drawing.Font("Mistral", 26F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbHeader.Location = new System.Drawing.Point(310, 0); this.lbHeader.Name = "lbHeader"; this.lbHeader.Size = new System.Drawing.Size(300, 50); this.lbHeader.TabIndex = 0; this.lbHeader.Text = "Monster Maker (alpha)"; // // clbPartyNumber // this.clbPartyNumber.FormattingEnabled = true; this.clbPartyNumber.Items.AddRange(new object[] { "0", "1 to 3", "4 to 6", "7 to 9", "10+"}); this.clbPartyNumber.Location = new System.Drawing.Point(0, 46); this.clbPartyNumber.Name = "clbPartyNumber"; this.clbPartyNumber.Size = new System.Drawing.Size(120, 94); this.clbPartyNumber.TabIndex = 1; // // cbPartyLevel // this.cbPartyLevel.FormattingEnabled = true;
well that could be one reason :laugh:
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutes -
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesProgammers debate the difference while web designers curse the programmers who do inline code. Separating interface and implementation is still a great idea no matter how much contempt .NET has for it. Examples use inline because it's easier to explain that way.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesInline code if either there is no UI (eg a pass-through page) ot the UI is something like "<%@ Page inherits=...%> (and nothing else), or the only code is a very small snippet that, say, overrides OnLoad and sets a value or two. My rule of thumb: only separate the code and design if there's code and design that needs separating.
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesIn my experience the use of inline code is a combination of laziness, perceived performance improvement and power grabbing. It is easier and the more you use it, the more you force your view of the interface on the designers.
Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
thats great But it seems to me that there is some unique advantage of using inline code for a much bigger web applications. The whole .Net community are doing that in each and every samples, There has to be something very simple and explainable. just a feeling i have since last week.
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesQuartz... wrote:
The whole .Net community are doing that in each and every samples
Maybe they are being :baaaa!:? Use the tools as best it makes sense for your particular application, not because everyone else is cutting and pastingdoing it a particular way
cheers, Chris Maunder
CodeProject.com : C++ MVP
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesInline code is an abomination. Code behind is a major reason that ASP.NET is more readable and maintainable than 'classic' ASP.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Chris Losinger wrote:
code behind is better. anyone who disagrees is wrong.
Well i think, that would be a gross generalization, If you do think like that, What do you think is advantage of using code behind rather than inline code other than number of files ? or if we do assume there is some "advantage behind" using inline code , What could that be ?
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minutesQuartz... wrote:
Well i think, that would be a gross generalization,
Yep, but it's also true.
Quartz... wrote:
What do you think is advantage of using code behind rather than inline code other than number of files ?
How is having more files an advantage ? Seperating HTML from code is essential to being able to do any sort of layout and being able to maintain code.
Quartz... wrote:
or if we do assume there is some "advantage behind" using inline code , What could that be ?
Less confusing for people who don't get OO, perhaps ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog
-
Ok this might look like a programming question but its not, its more on the concept, you decide I am wondering is there any advantage for using "Inline Code" to "Code Behind" in ASP.NET. For last few years i have been doing code behind but recently an increasingly degree of online samples (community server/ asp.net starter kits etc) are using inline code ? What is the prime advantage of that ? Microsoft created code behind, but they themselves are not using it ??? :confused: Can you send me a well documented code as soon as possible, wait... don't vote me down , that was a joke
Omit Needless Words - Strunk, William, Jr.
Web based Project Management
Universal DBA | Ajax Rating | ExplorerTree | Globalization in 20 minuteswhen i'm using VS i use code-behinds - its cleaner and my source doesn't get published when i'm using Dreamweaver (yeah, i have to sometimes :)) i use inline - i hate using the commandline complier and inline doesn't have to be compiled. as someone else said above - horses for courses nicko