Friday, August 22, 2008

ORM Manager

ORM manager will populate the data stored in the persistent storage like a database in the form of an object graph. ORM manager will use different object mapping strategies like table per hierarchy [TPH], table per type [TPT] or table per concrete class [TPC], etc. in populating the object graph. LINQ to SQL is based on TPH. Hibernate supports TPC, TPH and table per subclass mapping strategy [1]. Following is an example of the TPH.



Table Per Hierarchy ORM implementation


Reference:
1. http://www.hibernate.org/hib_docs/reference/en/html/inheritance.html accessed on 08/21/2008

Monday, July 21, 2008

Meaningful Identifiers

Anthony, _anthony and anthony were good friends. Anthony is a grown up guy,_anthony is a boy and anthony is a dog. One day, Anthony invited _anthony and anthony to his place for the party. _anthony was not feeling well but decided to tag along anthony. _anthony is too young to drive so they decided to walk to the Anthony’s place. Unfortunately, anthony could not walk so they called a cab. _anthony…

Who cannot walk? A dog or a boy…

Let’s re-factor this story a little bit. Let’s rename Anthony to MAnthony, _anthony to BAnthony and anthony to DAnthony. M for men, B for boy and D for dog.

With these new identifiers this story will be much better [to read and understand]. As in any story or a novel, meaningful identifiers are really important. Identifiers in any source code provide a meaningful token for the underlying memory. Identifiers tell a lot about the program. Just looking at the identifiers like account, debit and credit one can figure out that the system is a financial system.

This is a good read for anyone interested in more details on the way we program

Monday, July 14, 2008

VS 2008 Debugger going crazy?

Look at the code below and put the breakpoint on line
if (_s == null)

observe the behavior when we do something like
s2 = Singleton.getSingletonInstance();


using System;

namespace Pattern
{
class Program
{
static void Main(string[] args)
{
Singleton s1, s2;

s1 = Singleton.getSingletonInstance();

s1.instanceCount = 100;

s2 = Singleton.getSingletonInstance();
}
}


sealed class Singleton
{
private static Singleton _s = null;
public int instanceCount;

private Singleton()
{
}

public static Singleton getSingletonInstance()
{
if (_s == null)
{
_s = new Singleton();
}

return _s;
}

}
}


When the breakpoint will hit, try watching the value of _s. The watch window will pop endlessly all over the screen when you click on the following + sign next to the static members icon.
Screenshot:

Friday, June 20, 2008

SoCal Code Camp 2008




I will be presenting at Next Code Camp June 28th and 29th at University California San Diego Extension [www.socalcodecamp.com]

Topic: Using LinqDataSource with ASP.NET data controls

When: 3:00 PM - Sessions Room 110 on 06/29/2008 - driving directions can be found here

Check out LinqDataSource Sample


We will work on this sample in session.

Thanks

Friday, June 6, 2008

LINQ to SQL model

Saturday, April 19, 2008

Type of Exceptions

Wednesday, April 16, 2008

Nullable Object Pattern