Friday, March 22, 2013

Expression Tree and WPF

DependencyProperty in WPF represents a property that can be set through methods such as styling, data binding, animation and inheritance. It also reports information such as whether changing a property value can be coerced. Further, it can be edited in the Visual Studio designer just like other properties.
QueryControls can make use of dependencyproperty when representing the expression tree on the group canvas. This is very helpful as the clauses are added, deleted, modified or grouped/ungrouped. Expressions are linear textual representations. They are adapted with ExpressionAdapters to form query trees. LINQ provides the functionalities for expression evaluation.

UI automation continued

There are several diagnostics that can help with UI automation. . For example, WPF has a method called DrawHighlight() that can be called on its controls which makes it appear highlighted on the site. Another way is to use the default spy tool that comes with visual studio template for coded UI project that lets you identify the properties with which to search a control. Controls can be searched by first explicitly setting the property to search for such as a className, name or display text and then calling the FindMatchingControls method that recursively searches the document model. Logging can also be turned on for WPF which helps further with the asynchronous calls made through the UI.

Thursday, March 21, 2013

User Interface automation

When automating UI test cases, there are several challenges that cost time and effort. First of these is that the controls on the winforms may not be named. To find the contol, one may have to walk the document model. Second the controls may not be at the level in the tree as they visually appear on the UI. One may have to use a tool to detect the level and the location of the tree node. Sometimes the tools also don't give the correct information. Further, the properties or attributes used for identifying the control may require a recursive search over the controll hierarchy in the document. Third the contols may not all be consistent across UI panes and their access and usage varies even though they are the same controls. These cause additional code to be written for each such case. Fourth, there are many different ways to implement the same functionality involving different controls or generally different workflow. Code for automation has to deal with all these cases. Fifth, the contols may not always be out of box. They may provide advanced features or they may have additional test cases required. Custom controls have their own test requirements. All these add to the code variations. Fortunately, they can be organized and handled as much as possible.

Wednesday, March 20, 2013

Test harness and drivers

Frequently, we develop modules for automted test execution but don't integrate all of them. We do this mostly because we are short on time or resource. A test framework that's useful for manual tests can also be useful for automated tests. Just the road-map of the integration needs to be worked out. This is where a technical specification and planning tools help. Because it lists all the dependencies, the layers, the object model and mappings, the translations and operations, the stages of development, the costs for development and test and the trade-offs and the deliverables from sprint planning. With a knowledge of the means and methods to integrate test tools and framework captured in written format, resources can pick them up or execute independent of each other. The benefits of integration is mutual to the individual software products being integrated and adds overall value to existing products. I want to be able to do this.

Tuesday, March 19, 2013

automated cars

Why are automated cars better than manual ?
There are several reasons why automated cars are better than manual.
First, the driver has less things to remember and practice for the ride. There are fewer chances for driver manoeuvre errors and hence more safe to drive. Driver weariness and machine faults are a significant contributor to accidents. If the transmission is automated, it reduces a factor in the cause for accidents and improves safety when driving.
Second, the bulk of city driving is in stop and go traffic and these are better done with automatic transmission. The stop and go traffic requires the gears to be shifted by reaching neutral before going to higher gears and this adds to constant wear and tear.  Besides, the driving is smoother when the gear shifts are not noticeable.
Third, with the gear shifting is smoother in automated cars as opposed to manual. There are less chances of improper use or damage. Even in the case of emergency responses, the driver may occassionally wear out the transmission since it takes more time to respond. Experimental studies have shown that the first 1.8 seconds of an impending collision detection and response are crucial in avoiding a fatal accident.
Fourth, the car has less associated costs in terms of insurance and maintenance.  Insurance companies love the norm and automated transmission has become popular in sales. Car prices are affected when the transmission is automatic and so is the resale value of the car.
Fifth, the control over the torque that comes with different gear shift is not necessary in most city driving  in the United States. This control is great for say racing or driving on rugged terrains but usually can be avoided for city driving.

Monday, March 18, 2013

.net source for standard query operators

The standard query operators implementation is available for download from .Net. For a collection of query clauses, a grouping can be made. These are treated as subtrees in an expression tree. Each item of the result is run through the decision tree to be included in the result.  The choice to include an item depends on the success of a predicate and the logical operation with the current evaluation. 

expression tree

An expression tree is an efficient data representation of a query  lambda expression. In terms of LINQ to SQL, the expression tree gets converted to SQL to ensure the filtering and ordering are performed on the server. For lambda expressions, IL code or an expression tree can be generated. If an operator accepts an expression for a method delegate, IL code is emitted.If an operator accepts an expression of a method delegate, the expression tree is returned. LINQ to SQL objects generate IL code because it takes in a generic delegate, whereas LINQ to SQL implementation takes an expression tree that gets converted to SQL to be executed by SQL Server.