By the way , we have to think out
of the frame and avoid using building block type .NET applications development with controls
, if we run towards high quality end product which matches current web standards.
Well, one of the main advantages I experience using php
(interpreted) over c# (compiled) is language flexibility. Earlier when I use
php I am confident enough to say, “This is possible “. If I use .NET for web
applications , I used to think several
times before say that . Reason is inflexibility.
In earlier days (.NET 2.0 ) we had web forms (aspx) .
Microsoft has introduced set of compatible tools / controls / plugins to
integrate with them .We drag/drop and develop. GOD knows what happens inside
the controls . When control gives some runtime error , developers spend hours
to fix it . Sometimes it is just asking for official support . Now everything has
become new . Luckily even after many years microsoft introduced MVC , integrated with
jquery .
And Razor is one of the view engine introduced later .
Earlier when u want to display a dataset .you use a gridview
. Now it is fairly simple and flexible with just plain html tables .No one can
hide anything from you . Everything is visible. Here is the simple sample notation.
@foreach (var dataitem in dataset){
<tr>
<td>@dataitem.property1 </td>
<td>>@dataitem.property2 </td>
</tr>
}
We can use @ symbol infront of serverside code block in html
page and then compiler identifies it .
Obviously razor views are slower since it iterate the code from
server side . Except that , we can also easily pass data to client and iterate through
javascript .
$.ajax ({
url:"Employee",
type :"get",
data:{id:123},
contenttype:"application/json"
}).done(function(data){
console.log(data.Name); // May be you can write code to display in div here
}) ;
Razor does not have viewstate and postback . Therefore it come up with ViewData dictionary and ViewBag ( Dynamic variables), to share information between controller and view.
Eg - ViewBag.Title ="Good Article "; // In Controller
Can display in view using @ViewBag.Title
Simply which is Performance vs cleancode as I mentioned in startup of the article .
$.ajax ({
url:"Employee",
type :"get",
data:{id:123},
contenttype:"application/json"
}).done(function(data){
console.log(data.Name); // May be you can write code to display in div here
}) ;
Razor does not have viewstate and postback . Therefore it come up with ViewData dictionary and ViewBag ( Dynamic variables), to share information between controller and view.
Eg - ViewBag.Title ="Good Article "; // In Controller
Can display in view using @ViewBag.Title
Simply which is Performance vs cleancode as I mentioned in startup of the article .
So in huge
applications where employees working as teams , we have to manage the code and use patterns to organize the code . So strongly typed razor views will helpfull to maintain proper architectural code .Then we can use more hardware
resources to achieve performance . Disk space + RAM etc .
That is a small
information about RAZOR .
Great work bro...keep it up
ReplyDeleteThanks Chithranga..
ReplyDeletegood work mate keep up
ReplyDeleteThanks Buddi ...!!!
ReplyDeleteNice start-up article machan, I just got to know what is exactly "Razor" :) , but when I was reading this one thing came to my mind , Is Razor for a large scale projects or small ones or for both ?. since u have mentioned the Hard-wares as well. but practicaly The project Management will have a concern over both the cost and blas( performance , archi, maintainability..etc) yep I agree the architecture should be maintained and partially or fully flexible and more clean where the devs can dig into it or rolling back to what they want to extend or maintain. problm is ? Even-tho its too clean or properly organized but the consumption of hardware's too high the cost will come over the rest.
ReplyDeletein the past it happened some times when we were ordered to use frameworks to produce small web sites hmm..
He he ... Yeah I mentioned the hardware cz algorithms cares the performance for certain extent . When application scales as holding / mannipulating millions of data (scalable public sites like digg / linkedin/ stackoverflow )
ReplyDelete, need to get hardware support as well ... Thanks.