Fedyashov's Blog
Just another WordPress.com site
Monthly Archives: October 2010
blog expansion?
..well, I’m not feeling quite comfortable with wordpress so far.
I’ll most probably keep this blog for posts in English. Readers reading in Russian would probably prefer my newly created blog impulse9.blogspot.com.
Wow, I starting to behave like if I had readers :)
Positive trends around QTP
Just wanted to write a short note on the latest improvements in public visibility around HP QuickTest Professional product, which I used to work on as part of Functional Testing R&D team.
NOTE: Sorry – no facts, only my personal impression and private vision.
First simple point is that though price and licensing matters are not the most attractive sides of the product – HP has considerably simplified the process of getting a copy for evaluation. Now like with almost everything else on the Web – just download and try it! Sounds peculiar in 2010, but it wasn’t that easy before.
Secondly, it seems to me that functional architects Ayal Cohen and Roy Nuriel are becoming more proactive in gathering feedback from customers (even from those who don’t use traditional paid customer support services for some reason). At least I see HP presence and increased activity in functional testing and quality assurance forums, and also on pages of LinkedIn Professional network – and you know – information gathered from those sources (like e.g. Your chance to impact QTP future roadmap) is taken seriously. The same thing about other popular resources like AdvancedQTP and Tarum Lalwani’s blog. IMO, it is definitely a positive trend.
The third and final thing I’d like to mention here is “How QuickTest Professional Identifies Objects” post by Motti Lanzkron. For three years of my work there, I have seen no such precedents: typically QTP wisdom is collected by advanced users and is scattered throughout dark corners of the Web (sometimes it even ends in Google cache only). Though product documentation improves from version to version due to huge efforts of documentation team lead by Jackie Rosenzveig, business processes are getting even more complex and product becomes too variadic to be completely understood from the docs solely. So technical posts like Motti’s should come into play and help QTP users understand the product better – I would say it is a piece of wisdom coming right from the heart of the product R&D team.
I wish technical blogging became a part of QTP R&D usual process, there are still so many areas to uncover.
Elegant BOOST_SCOPE_EXIT replacement with auto and lambda from C++0x
The first thing I wanted to do when I saw BOOST_SCOPE / BOOST_SCOPE_EXIT - was to get rid of it. While Boost is good at what it does, implementing similar scoped RAII wrapper with C++0x would yield more elegant, more C++ style solution.
I’m sharing this thought not because of its scientific importance (which is definitely not far from negligible), but:
- to have one more post – as WordPress suggests to “post frequently” ;)
- to practice in presenting some formatted code on WordPress (which is not that easy!)
- more importantly – to get feedback from you in case you see a way to simplify this solution
So here it is:
#include <iostream>
template <typename Lambda>
class continuation
{
public:
explicit continuation(Lambda lambda): lambda_(lambda), active_(false)
{
}
void activate()
{
active_ = true;
}
~continuation()
{
if (active_)
lambda_();
}
private:
continuation(); // not default-constructible
Lambda& lambda_;
bool active_;
};
template<typename T>
continuation<T> create_continuation(T t)
{
return continuation<T>(t);
};
void main()
{
auto ScopeExit = create_continuation([] () { std::cout << "message from continuation ...\n"; });
ScopeExit.activate();
// exiting this scope would invoke the anonymous function...
}
There is some stuff that I would like to get rid of – namely the necessity to use the helper function create_continuation and the need to invoke activate() method against the resulting continuation object. The first problem is that the type of our anonymous function cannot be used directly to parametrize the continuation class. Instead, type is deduced via create_continuation helper function which subsequently is able to instantiate the required continuation object locally – which eventually gets copied back to the caller’s auto variable. And it’s actually the second problem – as the temporary object’s destructor would perform unwanted invoke – which is currently handled with activate() workaround.
Comments and propositions are welcome.
[Update] seems that I missed one important feature of C++0x which is decltype operator. By using it – the sample code above could be rewritten in a more straightforward way so that activate method and create_continuation helper function won’t be required:
void main()
{
auto SomeCode = [] () { std::cout << "message from continuation ...\n"; };
continuation<decltype(SomeCode)> ScopeExit(SomeCode);
// exiting this scope would invoke the anonymous function...
}