Alt.NET November 21, 2007
Posted by addisu in Software - .NET 2.0.4 comments
I was attending a .NET User Group yesterday about the buzz word “Alt.NET” at Metro Toronto User Group.
They said it is an alternative tools and approaches to the mainstream .NET. My question was, haven’t we tried different approaches, tools, for the past couple of years. In my J2EE experience I was appreciating the .NET environment that there is one huge tool that is ease to learn, configure, and use. Everything is integrated and I believed that that way is more productive. In Java world there are a number of frameworks, tools, that not only difficult to learn but also difficult to configure and make it work.
Anyway, most of the alterative tools that are presented are tools that were in use in the J2EE framework. For instance, NHibernate, Spring frame work, NUnit, NAnt and so on. Saying all these, I really like the fact that these tools are real implementations of some of the really useful patterns and practices that Microsoft misses in its development environment.
I believe the presenter participated in the big Alt Dot Net conference (http://altnetconf.com/participants ), i.e. Donald Belcham (http://www.igloocoder.com/ ).
Links that I found useful
Refactoring tool of Visual Studio 2005 September 7, 2007
Posted by addisu in Software - .NET 2.0, Software - .NET General, Software - ASP .NET 2.0, Software - C#.1 comment so far
How much do u use refactoring tool of Visual Studio 2005?
- Rename: i probably use this tool more often. Once you declare a class or a variable and used it everywhere, “rename” tool is the best if you are not happy with the name. Naming is one of best practice and the name of a class or a variable should be descriptive. You might not come up with the best name at the beginning.
- Extract Method: This is another tool i use. Every time there is a reusable portion of code that exist in my method, i used “Extract Method” to have another smaller method. … for two purposes sometimes,..one to reuse the code and two, to make smaller size and readable method
- Generate Method Stub: even though it is not part of the Refactoring tool part, i like to use this tool. I write a method call to an object that doesn’t exist. I use this tool to generate the method stub. The best part of this tool is, it knows if private or internal or public should be used. … the name and type of parameter, return value…
‘ref’ and ‘out’ in C# is Bizarre and confusing… September 4, 2007
Posted by addisu in Software - .NET 2.0, Software - .NET General, Software - C#.add a comment
i tried to really see the difference of these key words in C# and i still get it weired.
http://msdn2.microsoft.com/en-us/vcsharp/aa336814.aspx
- for ‘out’, we can pass the variable unassigned but we have to make sure we assign it before use in the callee method
- for ‘ref’, we have to assign the variable before we pass it…
i still see both as pass by reference kind of thing…
any suggestions….?
.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…
Using keyword “using” in code block March 3, 2007
Posted by addisu in Software - .NET 2.0, Software - .NET General, Software - ASP .NET 2.0, Software - C#.2 comments
Recently, I have been asked about the alternative way to Dispose objects as we often do in the “finally” block in “Try .. Catch .. Finally” block for connection object. I have seen “using” keyword in some sample codes but I never aware of it does dispose the objects declared as “using“
Example:
using (IDataReader dataReader = _db.ExecuteReader(“GetCategories”))
{
// Processing code
while (dataReader.Read())
{
Category item = new Category(
dataReader.GetInt32(0),
dataReader.GetString(1),
dataReader.GetString(2));
this.cmbCategory.Items.Add(item);
}
}
- One thing to note is the objects inside the “using” block should implement “IDisposable” interface.
- Still if we want to cache Exception, we need to inside and for me it seems a little bit redundant if we do the dispose inside the “finally” block as we often do for the connection object

