Friday, 3 February 2012

string is an alias for the String object which means they are equivalent.

String object is an Immutable Reference Type because it inherits directly from System.Object.

String object is not a Value Type because it doesn't inherit from System.ValueType (although the ValueType itself inherits from System.Object ultimately) but behaves like a Value Type.

A String object is internally stored as a Read-Only Collection of Char Objects.

What Does it Mean "String Object is Immutable"?
It simply means that once the object is defined, it can not be changed internally. If you change its value once initialized, then a new String Object will be created and the old one becomes ready for Garbage Collection.

In What Way a String Object Behaves Like a Value Type?

Equality Operators "==", compares the value within the 2 String Objects like Value Types and unlike other Reference Types.

How was it achieved?

Well, you can override any operator that you like in classes including the Equality and Inequality operators. This is how:

publicstaticbool operator ==(
string a,
string b
)

publicstaticbool operator !=(
string a,
string b
)

In What Way a String Object Behaves like a Reference Type?

It has a reference and an actual object.

Parameter Passing: When you pass a String object to a method as an input parameter, its reference is copied and passed while the object stays the same (in the String Intern Pool).

In assignments, It makes a copy of the pointer and points to the same object in the String Intern Pool. String.Clone() also just returns a reference to the same String Object.

Thursday, 2 February 2012

On Twitter, everyone knows that you can create User Accounts but not everyone knows that you can also create Applications!

Twitter Applications can be used to send automatic tweets or re-tweets to other user accounts that have authorized this application to post tweets on their wall!

Examples Where Can It Be Used?

For example, you have a page on your site and you'd like to allow the user, who has logged on to your system, to send the link to your page on his/her twitter account.

Assuming you have a system which publishes articles, posts, videos and other types of contents onto a different website or webservice. Using a Twitter Application, you can automatically post a message unto your Company Twitter Account that such contents have been released.

Imagine Burger King publishes Promotional Offers on their website, using a Twitter Application, they can publish such offers to their Company Twitter Account automatically when such offers become available.

Imagine BBC has a Twitter Account e.g. BBC_Business and every news that they publish unto their website, they'd like to be published automatically to this Twitter Account. Using Twitter that would be possible.

...

I think any Company which publishes news/articles/information could potentially benefit from this.

What are Consumer Tokens?
Once your Twitter Application is created, it generates 2 main keys called ConsumerKey and ConsumerSecretKey.

These 2 keys will be used later so that you can authorize this app to post to a user account.

What are the Access Tokens?
Access tokens are 2 tokens using which you allow a Twitter Application to have access or post tweets on another Twitter Account; therefore Each Access Token Pair belongs to only one Twitter User Account and one Twitter Application.

How to Create Access Tokens?
The below page, would generate the the access tokens for a given application.

How to Connect to the Twitter API and Get User Details or Tweet?
Ok, by now you have 4 keys; 2 Consumer Tokens and 2 Access Tokens.

Wednesday, 1 February 2012

System tests are structured differently than normal unit tests in the sense that we won't have specific Arrange/Act/Verify sections. System tests have to test whether the whole process works correctly and can contain many steps.