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:
[ClientSide]
public void DoSomething()
{
var button = Buttons.SearchButton;
button.Style.Left += 10;
button.Value = "Search";
button.OnClick += new EventHandler(Search);
}
[ServerSide]
public void Search()
{
var text = TextBoxes.SearchTB.Value;
var results = from entry in DB.Entries
where entry.Name.Contains(text)
select entry;
Tables.Results.AddRange(results);
}
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.