Visual Studio Aims Independent Eclipse Community

VsxWith the upcoming release of Visual Studio 2008 comes with new software development ecosystem named Visual Studio Shell. Infact it’s not new at all. Visual Studio only exposes it’s shell enviroment freely to various software development vendors and individual software developers. Here the word ‘new’ points that suprisingly Microsoft’s revolution strategy speeded up for breaking the idea of anti-Microsoft approach that disperses from OPEN SOURCE sympathizers to the whole world.

In brief Visual Studio Shell let software vendors add new features (plug-ins) to Visual Studio or use it as an enviroment in their individual projects. This means that will not suprise us coding pure JAVA (not J#) in Visual Studio enviroment. It should be a dream!

The shell comes with integrated and a new isolated mode. Integrated mode provides visual studio enviroment to extend existing instance of developer’s Visual Studio 2008 installation. There is better news that isolated mode exactly works as a seperate instance and interface uses Visual Studio Shell without the requirement of visual studio installation. I can hear you… Yes it is an Eclipse core feature. If you are not familiar to famous open source Eclipse IDE platform mostly used by JAVA developers, it entirely exposes it’s shell enviroment (workbenchs, views etc…) to plug-ins or for other standalone softwares. For example Adobe provides Flex development enviroment as either a standalone Eclipse based IDE (using Eclipse RPC) or plug-ins (Eclipse PDE) that can be added to an existing Eclipse installation. This shows us Microsoft’s idea is certainly inspired from Eclipse and it aims to gain whoever Eclipse’s commercial and non-commercial ISV’s anyway.

Finally i want to share a quote from an interview with Anders Hejlsberg who is chief architect of the Visual C# language and has been a key developer of the company’s .Net application development technology. His answers followed like below against the questions from InfoWorld.

InfoWorld: What is your take on Eclipse and the Eclipse Foundation and Eclipse IDE? At this point Eclipse has Sun and Microsoft not participating and everybody else pretty much is. What does that mean?

Hejlsberg: Eclipse is an open source project built around the Java platform, so I don’t think it’s so surprising that we’re not partaking there. I would say we’re competing there, and I think we’re competing quite well with Visual Studio. A lot of the features you see in Visual Studio 2005 bring us not just neck to neck, but ahead of Eclipse, and I think it’s healthy to have competition. As always, it’s going to keep us on our toes and it’s going to keep them on their toes.

InfoWorld: But you have to spend money for Visual Studio and you can download Eclipse for nothing.

Hejlsberg: That all depends on how you look at it. You can download the Visual Studio 2005 Express Editions for nothing, and I would argue that in many ways they are better, more deeply integrated tools than some of the stuff you can do with Eclipse. And conversely, with Eclipse you typically end up paying money anyway because you buy a particular distribution of it and you buy it as part of [IBM] WebSphere or whatever and you actually do pay money. So it’s not that clear, it’s a bit of a fallacy that everything is free in that space and everything costs money with our platform.

Is the word Open Source itself a shell? Is used for marketing goals by some profit-units in software industry? Is Microsoft really a capitalism idol? How do you gonna live without any salary or profit while writing code only for world wide human beings? Are this these topics too heavy for us to lift? :)

What do you think?

Microsoft CRM 3.0 Web Service Calls With Generic Methods

While working in my cms project, my dirty code pushed me some refactoring for Microsoft Crm 3.0 web service calls. So i decided to write one wrapper class for accessing crm. If you worked with crm web services i guess that you’d probably tired of writing queries with QueryExpression and QueryByAttribute classes.

Since, when an idea of using generic methods blinked above by head, i began to code against BusinessEntity based classes of crm api. It was flowed like this:

    public T[] FindEntities(string[] attributes, object[] values, ConditionOperator[] operators, string[] columns) where T : BusinessEntity
    {
        QueryExpression query = new QueryExpression();
        ConditionExpression[] conditionExpressions = null;

        if (attributes != null && values != null)
        {
            conditionExpressions = new ConditionExpression[attributes.Length];

            for (int i = 0; i < conditionExpressions.Length; i++)
            {
                ConditionExpression conditionExpression = new ConditionExpression();
                conditionExpression.AttributeName = attributes[i];
                conditionExpression.Operator = operators == null ? ConditionOperator.Equal : operators[i];
                conditionExpression.Values = new object[] { values[i] };

                conditionExpressions[i] = conditionExpression;
            }
        }

        FilterExpression filterExpression = new FilterExpression();
        filterExpression.FilterOperator = LogicalOperator.And;
        filterExpression.Conditions = conditionExpressions;
        query.Criteria = filterExpression;

        ColumnSetBase columnSet = null;

        if (columns == null)
        {
            columnSet = new AllColumns();
        }
        else
        {
            columnSet = new ColumnSet();
            ((ColumnSet)columnSet).Attributes = columns;
        }

        query.ColumnSet = columnSet;
        query.EntityName = typeof(T).Name;

        BusinessEntityCollection result = _crmService.RetrieveMultiple(query);

        T[] entities = new T[result.BusinessEntities.Length];
        Array.Copy(result.BusinessEntities, entities, entities.Length);
        return entities;
    }

When finished base method, take it more easy by overriding it, below there are some more helper methods using base method

    public T[] FindEntities<T>(string attribute, object value) where T : BusinessEntity
    {
        return FindEntities<T>(new string[] { attribute }, new object[] { value });
    }

    public T[] FindEntities<T>(string attribute, object value, ConditionOperator op) where T : BusinessEntity
    {
        return FindEntities<T>(new string[] { attribute }, new object[] { value }, new ConditionOperator[] { op });
    }

    public T[] FindEntities<T>(string attribute, object value, string[] columns) where T : BusinessEntity
    {
        return FindEntities<T>(new string[] { attribute }, new object[] { value }, columns);
    }

    public T[] FindEntities<T>(string attribute, object value, ConditionOperator op, string[] columns) where T : BusinessEntity
    {
        return FindEntities<T>(new string[] { attribute }, new object[] { value }, new ConditionOperator[] { op }, columns);
    }

    public T[] FindEntities<T>(string[] attributes, object[] values) where T : BusinessEntity
    {
        return FindEntities<T>(attributes, values, null, null);
    }

    public T[] FindEntities<T>(string[] attributes, object[] values, string[] columns) where T : BusinessEntity
    {
        return FindEntities<T>(attributes, values, null, columns);
    }

    public T[] FindEntities<T>(string[] attributes, object[] values, ConditionOperator[] operators) where T : BusinessEntity
    {
        return FindEntities<T>(attributes, values, operators, null);
    }

And that’s it, don’t give up work and write some more helper overridings and improvements. For example it’s a good idea to write FindAll, FindEntity, FindEntityById and any CRUD methods. In my project my method calls looked like this instead of lines of code caused by QueryBase implementations.

    public static account FindAccountOfUser(Guid contactId)
    {

        return Crm.Instance().FindEntity<account>("primarycontactid", contactId);
    }

Finally my project code looks like more&more simplistic and clean. Please give me feedback for any improvements.

kick it on DotNetKicks.com

  
Valid XHTML 1.0 Strict Valid CSS!