Sunday, February 24, 2008

STRUTS Vs ASP.NET

I found a good white paper on MSDN related to Struts and ASP.Net architecture comparison.

http://msdn2.microsoft.com/en-us/library/aa478961.aspx

After reading, it looks like ASP.NET is better than STRUTS. But as white paper is published on MSDN, I am not sure every feature of STRUTS is covered.

Now check this out., how Java guys are fuming over this...nice fun

Currently Listening - Pyaar Ka Musafir-LUCKY ALI

Saturday, February 23, 2008

Google search - Rank 1

Go to Google.com and search for,

GAURAV SHARMA C#
My blog ranks first in Google result. Amazing (at least for me) !!!

If currently its not ranked no. 1 check this out as proof :)



Thursday, February 7, 2008

C# 3.5 - Properties Shorthand

I must tell you if today your C# knowledge is not up to date then you might face tough time with future versions of the language. Microsoft developers will keep on adding new things ranging from entirely new features like LINQ to something like Implicit types or Object initializations. Last two features that I've mentioned are due to LINQ and secondly they provide some kind of syntactical sugar for developers. In future, VB.NET and C# will take entirely different paths. C# will become more performance oriented and VB.NET more developer friendly. VB.NET will target UI where as C# will mostly be used as class libraries. I am not sure when will this happen but it will happen soon [trust my Microsoft contacts :) ]

Let me show you how property shorthand feature of C# works from inside. We will start of with a simple console application and add code as needed.

Adding property shorthand to your code
Type prop in code window and let intellisense jump in. Then select "prop" and press Tab 2 times. A property shorthand will appear
.

Complete your class definition
Add 3 shorthand properties and one normal property. Your final class definition will look like this



















Create a class that will use Customer object.
Main() method in Program.cs would be enough for us
,













And the output is as expected,




Let us examine the IL that is generated for this managed assembly. Below are two images one with IL showing members of Customer class and next one with one method expanded.


For the properties that we created with shorthand, C# compiler added a backing field for each shorthand property in this format,
k_BackingField: private TypeOfShrtHandProperty

get_FirstName method expanded
Image shown below looks at the IL generated for get_FirstName method. Second IL instruction 'ldflf' i.e. Load Field, works with backing field created by the compiler. set_FirstName() also uses this backing field.

Don't expect that these shorthands will support validations etc. These are simple properties and just adds thread safety over using class variables directly. If we don't want any thread safely and no validations, then we should not provide properties. I guess this is a cool new feature but unless you understand how it works inside you will not able to fully utilize it.

Next I'll add a small post related to introduction of partial methods in C#. I am down with Viral from last few days but today I am feeling quite well. I hope! to get well soon.

~ILdasm rOcKs~

Tuesday, February 5, 2008

Atlast a new Header

Just worked around for 20 minutes and WoW my blog now have a new header. Cool isn't it? We should have free online blog theme creators or else we have to dig into CSS. I think if someone works upon it we can have a good UI to edit CSS and create a blog theme creator.

Currently Listening To - Ajeemo shan - JODHA AKBAR

Monday, February 4, 2008

The Great Debaters

Just finished watching "The Great Debaters," and man! what a movie. Denzel Washington both directed and acted in the movie. He is simply great. I saw a number of his earlier movies but this time he is rocking. Movie is about racial bias around 1930's time frame. It is a real life story of few men that stood against majority.

All actors, specially the team members that participates in debates are awesome. Scenes where negro team competes with white students is overwhelming. I am sure this movie will be voted for Oscars. This movie is a must watch for everyone out there. Gandhi's non co-operation movement is also mentioned in the debate that occurs in Harvard. In simple words:

Amazing Movie

Saturday, February 2, 2008

Bill Gates speaks on Creative Capitalism

Today evening I was browsing news related to Microsoft bidding for Yahoo when I saw this nice speach made by Bill Gates as World Economic Forum.

Views expressed by Gates are quite noble. His idea of large companies contributing a fraction of their great minds on innovations focusing on developing nations is great. As an economics novice, I think the steps Bill is putting forward under the umbrella of 'Creative Capitalism' are quite effective. I am also proud of the fact that India, being a developing country, is contributing so much for this. Bill mentions India more than 2 times in his 25 minutes speech. Isn't that great?

Currently listening to - But it rained-PARIKRAMA