Statistics
Visits: 105081
Page Visits: 139146
Active visitors (monthly): 5364
Feed Count: 45
Most visited page: Adding value as a technical analyst
Archive : Mar 2011

Some good technical skills

Over my career, I have seen numerous improvements in developer tools from Microsoft. When I started off, COM / COM+ were buzzwords. Then sometime in 2001, .Net became the development platform from Microsoft. Intellisense is a great productivity enhancement which earlier users of Visual Studio never had. Before, we had to go through MSDN documentation to know API details.

Over time, technologies change. But the behaviors that are required to be a good technical guy do not change much. There are few technical behaviours that I have listed out:

Prototyping: To validate any architecture, prototyping is essential. A good architecture is just one way of multiple possible ways of getting things done right. Without prototyping, there is no way an architect can find out if what he is proposing is the best alternative.

Using Frameworks: Frameworks are reusable components that offer good productivity as well as defacto design standards. eg. MVC framework, entity framework.

Adherence to Organization standards: There are multiple ways to do a simple thing like client-side validation. Eg, validator controls, jQuery validation, HTML helpers all do validation. The best one should be choosen based on other applications in the organization. Or based on organization standards. Organization standards are more important for things that depend on the organization infrastructure like implementing security.

Learnability: Learning new skills is very important. Lot of the products that are available in the market is continously evolving. Without learning, we will be preaching obsolete ideas to the younger generation who may be more upto date with the latest and the best.

Understanding why: Learning new skills with an attitude of why helps to understand why the improvement exists. If you are learning new skills with an intention to learn a lot, you may be missing a few points. Understanding why something exists helps to apply the technologies effectively.

Troubleshooting: Troubleshooting technical issues and getting things done is also important.

Permalink | No Comments | Leave your comment
 

LINQ to XML versus XMLDOM

I have been trying out LINQ to XML and I am impressed with the improvements made over XML DOM. In this post, I will illustrate a few nice features where LINQ scores over DOM.

Creation of elements

To create a new element in DOM, the following code should be written:


XmlElement elem = XmlDocument.CreateElement("Employee");
XmlAttribute attr = XmlDocument.CreateAttribute("EmpID");
attr.Value = "100";
elem.Attributes.Add(attr);


The code is simpler in the case of LINQ:


XElement elem = new XElement("Employee",
               new XAttribute("EmpID", 100)); 

Adding elements as first node

In DOM, this takes quite a few steps. In LINQ, it is simpler with the AddFirst method: parent.AddFirst(child);

Removing elements is elegant

Removing elements in DOM is something like this: parent.Remove(child); In LINQ, removing a child element is done on the child element itself: child.Remove();

Setting optional attributes

In DOM, this is quite complex:


XmlAttribute attr = elem.Attributes("EmpID");
if(attr!=null)
{
    attr = XmlDocument.CreateAttribute("EmpID");    
}
attr.Value = "100";

In LINQ, this is a one liner: elem.SetAttributeValue("EmpID", 100);

Querying and XPath

In XML DOM, XPath was very useful to select elements:


XmlNode emp = XmlDocument.SelectSingleNode("/Employees/Employee[@id=100]");

Using LINQ is slightly longer. But the code is readable and it does not require a new skillset (XPath).


var qry = from elem in root.Elements("Employee")
                where elem.Attribute("EmpID").Value == 100
                select elem;

XElement emp = qry.First<xelement>();</xelement>

Overall, LINQ 2 XML supersedes DOM in capability and readability. The only disadvantage is that LINQ 2 XML does not support entities.

Permalink | No Comments | Leave your comment