Click here to Skip to main content
13,199,852 members (61,642 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 12 Feb 2013

What I believe is the 'best framework' for website development, or maybe MVC 5?

, 12 Feb 2013
Rate this:
Please Sign up or sign in to vote.
I want to propose a new method which drops out JavaScript, CoffeScript, and all other pesky non-C# code you have to write.

What I believe is the 'best framework' for website development, or maybe MVC 5 ?

Recently, I've started to be more interested in web development. I've played around with PHP, quickly shifted to ASP.NET MVC. I like the "out of the box" defaults there, so there are minimal settings required to create a "nice" website. I like the automatic parameter mapper too.

I also started playing with Entity Framework, using its LINQ to SQL feature. I like that you don't have to "leave" C# when doing database queries.

What I don't like is the usage of JavaScript. I believe it is a redundant, old, bad language we should use "only if we have to". When you write an ASP.NET MVC app, you still have to use jQuery callbacks for AJAX, parsing the JSON and writing too much boring code.

I want to propose a new method which drops out JavaScript, CoffeScript, and all other pesky non-C# code you have to write.

We all know you have to write both client-side and server-side code. But why make the code different? Lets say I want to manipulate the DOM. In WebForms, you could do it like in a method similar to WinForms - sending out a new page with the manipulated DOM. I'm also pretty sure you could do it with Ajax instead, which is even nicer. But if you want to manipulate it in client side, you have to write JavaScript, which might break the WebForms structure. I don't like that.

Currently, we have technologies which converts .NET (or C#) to JavaScript, which also implements the whole JavaScript "browser" library, including jQuery, hard-coded. So now, you write C# which gets JSON from a handler, parses that JSON in C#, and manipulates the DOM accordingly. You have to manually write C# code which is equivalent to $(id).html(...) or such. Basically, you didn't do much.

Let's try making a standard library for the DOM, which will include all features, like WebForms has, which will work both server side and client side. It's basically taking both positive sides from WebForms AND MVC. You will write regular HTML websites, using the Razor syntax. If you, for example, write a Single Page App, and you want some code to run locally, you mark it with [ClientSide], and if you want some code to access the database and such, you mark it with [ServerSide]. Then, if you add an event listener to an OnClick event, it will automatically know whether to simply execute the client side JavaScript (converted from C#) or, using AJAX, call the server (asynchronously of course), and do what its response tells you to do (the server might return JavaScript to be eval'd). This way, both server side and client side manipulate the DOM using the same codebase, but in different methods completely.

<input id="SearchButton" type="button" value="Hey!" />
<input id="SearchTB" type="text" />
<table id="Results"></table>

The code:

public void DoSomething()
 var button = Buttons.SearchButton;
 button.Style.Left += 10;
 button.Value = "Search";
 button.OnClick += new EventHandler(Search);

public void Search()
 var text = TextBoxes.SearchTB.Value;
 var results = from entry in DB.Entries
      where entry.Name.Contains(text)
      select entry;
 //an "entry" has: Name, Date, Location ....
 //automatically converted to the columns & rows in the table


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

QuestionThought provoking Pin
Paul Tait13-Feb-13 15:57
memberPaul Tait13-Feb-13 15:57 
QuestionTypescript!!!! Pin
JohnGalt1712-Feb-13 9:09
memberJohnGalt1712-Feb-13 9:09 
Solves the entire javascript issue and looks very much like C# and is strongly typed (if you want it to be)

But seriously if you're building anything more than SEO required public facing websites, you shouldn't be using much more than static HTML files with a little security on the server side, and then using typescript + knockout + jquery to get and post data.

If you're doing anything more, you're way behind and not using the HTML 5 web.
AnswerRe: Typescript!!!! Pin
KL43112-Feb-13 19:53
memberKL43112-Feb-13 19:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171020.1 | Last Updated 12 Feb 2013
Article Copyright 2013 by KL431
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid