Just for joke..Developers August 29, 2007
Posted by addisu in Uncategorized.1 comment so far
Five cannibals (Man eaters) get appointed as programmers in an IT company. During the welcoming ceremony the boss says: “You’re all part of our team now. You can earn good money here, and you can go to the company canteen for something to eat. So don’t trouble the other employees”. The cannibals promise not to trouble the other employees.
Four weeks later the boss returns and says: “You’re all working very hard, and I’m very satisfied with all of you. One of our developers has disappeared however. Do any of you know what happened to her?” The cannibals disown all knowledge of the missing developer. After the boss has left, the leader of the cannibals says to the others: “Which of you idiots ate the developer?”
One of the cannibals raises his hand hesitantly, to which the leader of the cannibals says: “You FOOL! For four weeks we’ve been eating team leaders, managers, and project managers and no-one has noticed anything, and now YOU ate one developer and it got noticed. So hereafter please don’t eat a person who is working.”
.NET 2.0 Generics, … i am in love with it…. August 24, 2007
Posted by addisu in Software - .NET 2.0, Software - .NET General, Software - C#.add a comment
I had a number of collection classes with similar functionalities like this…
public class PermissionCollectionEntity : IEntity
{
List<PermissionEntity> list;public PermissionCollectionEntity()
{
this.list = new List<PermissionEntity>();
}public List<PermissionEntity> Items
{
get
{
return this.list;
}
}public void Add(PermissionEntity entity)
{
if (entity != null)
{
this.list.Add(entity);
}
}public Boolean Remove(PermissionEntity entity)
{
if (entity != null && this.list.Contains(entity))
{
return this.list.Remove(entity);
}
else
{
return false;
}
}public void RemoveAt(int index)
{
if (this.list.Count > index && index >= 0)
{
this.list.RemoveAt(index);
}
}public void Clear()
{
if (this.list.Count > 0)
{
this.list.Clear();
}
}public int Count
{
get
{
return this.list.Count;
}
}
}
Now i am replacing those Collection classes with one Generics class like this…
public class TCollectionEntity<T> : IEntity
where T : IEntity
{
List<T> list;public TCollectionEntity()
{
this.list = new List<T>();
}public List<T> Items
{
get
{
return this.list;
}
}public void Add(T entity)
{
if (entity != null)
{
this.list.Add(entity);
}
}public Boolean Remove(T entity)
{
if (entity != null && this.list.Contains(entity))
{
return this.list.Remove(entity);
}
else
{
return false;
}
}public void RemoveAt(int index)
{
if (this.list.Count > index && index >= 0)
{
this.list.RemoveAt(index);
}
}public void Clear()
{
if (this.list.Count > 0)
{
this.list.Clear();
}
}public int Count
{
get
{
return this.list.Count;
}
}
}
I can re-use this collection for all my Entity classes…I can also enforce the Entity Classes shouldimpliment certain Interfaces…
Cool stuff…

