Sergey Vlasov's News Archive

Organize Visual Studio tabs with Tabs Studio add-in

February 9, 2003

Project started. Site includes main page, this news, my resume in plain text and contact info.

February 9, 2003

"Lack of user involvement traditionally has been the No. 1 reason for project failure. Conversely, it has been the leading contributor to project success."
Project success statistics

February 9, 2003

"Most of humans who have experimented the modern revolution agree that complexity goes along with technological progress, and that such complexity can only be mastered by pyramidal social structures. Many people realize that such democratic systems do not work perfectly and leave a significant part of the society discontented, yet there is a common agreement upon the idea that it is 'the least worse' of all political systems. I may be wrong, but I feel that XP refuses pyramidal systems, since they lead to a lack of share of responsabilities." Emmanuel Gaillot

February 10, 2003

I love Null Objects. Unfortunately I don't use this idea in "real" programming. So, every time I see some discussion about it I eager to learn "the last peace" that will enlighten me. BTW, there is a proposal for Boost.Optional: "An object of type optional<T> can be used to hold a value of type T which might have an *uninitialized* state." And this story began from a message with nice refactoring to Null Object given authorship to this one. Following the link I had read the whole page. It turned out that the author is Peter Norvig. His site looks very interesting, but I wouldn't say that it's very interesting inside. "Familiar and Unfamiliar Quotations" is fun and worth reading. Other topics is up to you. Many Lisp praises and again I wish to learn this language. Norvig recommends "Paul Graham's On Lisp and ANSI Common Lisp" - may be, may be. Studying new technology excellent books is a must, i.e. life too short to read good books.

I like real world statistics. Here is a programming languages popularity comparison by Tiobe Software.

February 12, 2003

Site update. Books section added.

February 13, 2003

Site update. Converted Resume to HTML. No photo yet.

February 14, 2003

Site update. Added my emblem to front page to make it looks not so primitive. Origins of the icosahedron picture lie here.

February 15, 2003

Site update. Code section added. Forces link was inspired by Maxim Friedental's posting to in January 2001.

February 15, 2003

Site update. Resume decorated.

February 16, 2003

Site update. Performed W3C validation. Consequent appearance changes.

February 17, 2003

Site update. Refactored and decorated Resume using CSS.

February 17, 2003

I'm going to start new fun project - Rubik's Cube. Eiffel Envision + .NET + NUnit + DirectX 9.0. Tools Envy ®.

Today, while downloading dx9sdk (225 MB), managed to create first test. Gotchas: At all job portals that I have seen word "Eiffel" doesn't exist. Smalltalk jobs rate to C++ as 1 to 10.

February 18, 2003

Databases are rare issue in modern OT applications. But many legacy systems (e.g. at my Mechel work) completely dependent on them. Two weeks ago I'd read Agility and the Database (Peter Schuh) - it seems to be real and valuable approach, quite enlightening.

There is also Agile Data Homepage by Scott W. Ambler. Lot of useful information, but maybe bit superfluous, especially for me right now. BTW, Scott W. Ambler's Agile Modelling mailing list was my last step before diving into XP.

February 19, 2003

Site update. Added Links section. Added my home office photo link to Resume.

February 20, 2003

Site update. At last, I made my photo and added to Resume.
Site obtained legitimate url. No more updates at, welcome to Hosted by ICDSoft.

February 22, 2003

Yesterday I received "Planning XP" book from Amazon. There was a large period of time, since I got access to Net, when books ceased to take important part in my education. Live messages and articles from thousands of people all over the world, it seemed to be modern way to learn. As my skills were improving the concept of Author started to appear. Martin Fowler at, Robert Martin at, Scott Ambler at From them I learned more, I were moving forward. Then I ran across Ron Jeffries mails (today it seems harder not to receive his messages <g>) and subscribed to XP list (outbursts happen, XP's preference for people brought together top software developers to spread XP ideas through this list). Almost accidentally last summer I bought "UML Distilled" and "XP Explained". It is beyond belief, but after all these years books still able to teach me <g>. Of course it was Martin and Kent who made this possible. Today I don't look at books titles, only on authors and I'm sure that "Planning XP" by Fowler and Beck definitely'll be one more step forward.

Cover scan and other relevant changes in Books.

February 22, 2003

Yet another TDD session Test First: Query Engine, now from Roger Lipscombe. Usually I skip such code (it too simple <g>). However this one in C++ (though not very mature C++) and it is so rare in these days <g>. His short essay also good (and short).

February 23, 2003

More notes on Unit testing database code with corresponding references. Looks like hot topic <g>.

February 23, 2003

Time to optimize. Client of my Radiokarta project made request to explore possibilities to improve program performance. Radio coverage prediction requires massive calculations and takes days when dealing with large areas. I don't remember when I had success with profiler. OK, let's try again. There are 3 profilers for my environment (MSVC 7, Win32) that I know of: Glowcode, DevPartner Profiler and Intel VTune.

Downloaded Glowcode. Looked good - small and humble. Crashed every time when starting to profile. Uninstall.
DevPartner Profiler. Integrates (hides) into MS VS. Required to build my program with special profile data. It worked for debug configuration, but failed with release build. Uninstall.
100 MB VTune. Last chance, better be good. And it really good. After I figured out linker "/fixed:no" option, rebuilt application and profiled I got my bottleneck (as usual it wasn't that I thought of) and reduced it to reasonable level. BTW, memory mapped file was approximately 3 times faster then fseek/fread in this case.

Side note. This project started in quite legacy style, but gradually gets better as I test and refactor. During optimization I again were extremely impressed how much code better with test. New acceptance and performance tests, substitute algorithms, refactorings were exceptionally easy to implement. Almost zero debug time and visual inspections made me really productive. I hope I am preaching to the choir.

February 24, 2003

Site update. Added link to Extreme Programming in Russian to Links section. Exclusive source of information for Russian-only speakers.

February 24, 2003

"The fastest way to learn is to boldly answer on the mailing lists. If you are wrong, a few caustic twits will explain in great detail why you are wrong.
Having posted and got flamed to a crisp, you have learnt. Having posted and been corrected, you have polished and honed your knowledge. Having posted and been complimented on your insight, you can perhaps rely on that knowledge." John Carter.

February 25, 2003

Site update. Changed title of this page to more distinct.

February 25, 2003

Fought with scripting in HTML. Don't do it without Microsoft Windows Script Debugger like I did - it just doesn't work.

February 27, 2003

Worked out my Compact News idea. I suspect it requires IE6, but please try it anyway and drop me email.

How it works. News stored in xml file. News filtering and presentation done via xsl. Cookie with last_read_id stored and retrieved by scripts and passed as parameter to xsl (because xsl can't do it itself).

Page has 3 modes of operation:

February 27, 2003

Workshop on Distributed Pair Programming. "NetMeeting plus phone call between a distributed pair works best for distributed pair programming". One (not very real world) study shows that "Software development involving distributed pair programming seems to be comparable to colocated software development in terms of the two metrics, namely productivity (in terms of lines of code per hour) and quality (in terms of the grades obtained)."

February 28, 2003

Site update. News page moved from root to news directory.

February 28, 2003

Site update. Now greeting at Compact News should disappear more quickly.

March 1, 2003

Today I tried to add tests run as Post-Build Event in MS VS.NET and it turned out that VS doesn't send system path to executed program's environment. Instead that path created from directories in Tools - Options - Projects - VC++ Directories - Executable Files. MS own way.

March 2, 2003

Finished reading "Planning XP". I never had any significant plans. Work with passion and work according to plan seem mutually exclusive. Is it time for me to change?

Big XP projects with tens of developers are very rare. And so Martin's management experience is invaluable. Usual planning discussions on groups are quite simple and miss (as I see now) many important points. I definitely need some planning experience and then I'll read this book one more time.

Relevant changes in Books.

March 3, 2003

Developing NT.

March 6, 2003

Site update. Added link to Compact News to the top of News page. Compact News works under WinXP + IE6 and Win2K(SP2) + IE5, don't know about other configurations.

March 6, 2003

Last month I encountered a few new languages/API (Matlab Simulink, HTML scripting, Eiffel DirectX). For a long time I didn't operate in such new environments when you don't have simplest thing that works - you don't have anything that works. You open reference and if it's from MS it's almost useless. You find example but it's in another language, during translation you introduce new bugs and still don't know why it doesn't work. You find working program source but it's too big and solid to give just a small hint. You start guessing and probing and your code becomes a mess. All in all we should be more tolerant to novices.

March 9, 2003

3 weeks elapsed since I announced Rubik's Cube project. Time to ship something. Release 1 placed at the bottom of Code section. ebcl.dll (standard Eiffel runtime?) is 13.5 MB in size, that's why executable package is so big. You can run tests yourself from exe file using NUnit. Of course there is full source code written (rewritten from ### see my previous post) according to resume-quality and TDD principles. For all Eiffel discrepancies you should blame me (not Chet and nor Bertrand).

Stories that I tried, but failed to implement: Tasks that I tried, but failed to implement: Now tools. It seems to me that Envision is immature product. Concept of mapping .NET namespaces + class names to unique original class names (System::Drawing::Color -> DRAWING_COLOR) and overloaded functions to unique original function names ( Color::Color(int color) -> make_with_color(color : INTEGER)) extremely counterproductive. Not only I can't cut'n'paste C# examples, but each time one must discover class' assembly name, go to Object Browser, select assembly, guess namespace, scroll to class and only then grab Eiffel class or function name. Envision likes periodically delete all intermediate binaries, so keep NUnit running or browse around cube.exe quite dangerous - Envision stops to work and requires restart of Visual Studio. Near every tenth compile cycle I were forced to reload VS, NUnit or both (but maybe NUnit problems is its own). Occasional errors which fixed after rerun or recompile (as I learned later) were killing me cause I naturally tried to change probably correct code (never before I didn't trust tools). In Eiffel one must declare all variables before function body and I often forgot to create instances (in C++ declaration, definition and usage more interrelated). Compile time is noticeable for such tiny project - 16 seconds for full rebuild and 8 seconds for "one file changed" rebuild. Debug DirectX runtime is absolute necessity - using DebugView from Sysinternals one can read detailed descriptions of all emergent exceptions and other events. Debug DirectX runtime significantly slower then Retail DirectX runtime so you may find ability to re-install one runtime over another using SDK installer useful (there is no need to restart computer). I almost failed to find free 3D editor with support of "x files" and ability to map materials to distinct faces of the object. But MetasequoiaLE R2.1 by O.Mizno did this job.

Well, "more features to come" and I hope to unleash power of DBC in most appropriate language.

March 9, 2003

Error handling is important and quite complex subject, but underrated in general. Exceptions are the one of the preferred methods to handle errors in C++ and David Abrahams always leads research in this area. So his article Exception-Safety in Generic Components (that I surprisingly didn't read before). Chapter 7 also provides original testing ideas.

March 10, 2003

Site update. Added link to Hedgehog Archive to Links section.

March 11, 2003

Find yourself XP - XpUserGroups.

March 12, 2003

Problem: Create a function for signal decimation. For example

assert(resample([0 1 2 3 4], 2) == [0 2 4])

Test fails, code the simplest thing

function result = resample(input, new_step)
result = 0 : 2 : 4

Test passes, now remove duplication

function result = resample(input, new_step)
result = input(1) : new_step : input(length(input))

Test passes, done.

Instead of removing duplication we could use triangulation

assert(resample([2 3 4], 2) == [2 4], 'second first element')
assert(resample([0 1 2], 2) == [0 2], 'second last element')
assert(resample([0 1 2 3 4 5 6], 3) == [0 3 6], 'second new step')

Tests fail, devise the same solution as above

function result = resample(input, new_step)
result = input(1) : new_step : input(length(input))

Tests pass, done.

From Kent's TDD book draft: "Triangulation feels funny to me. I only use it when I am completely unsure of how to refactor. If I can see how to eliminate duplication between code and tests and create the general solution, I just do it.Why would I need to write another test to give me permission to write what I probably could have written the first time?
However, when the design thoughts just arent coming, triangulation gives you a chance to think about the problem from a slightly different direction. What axes of variability are you trying to support in your design? Make some of the them vary and the answer may become clearer."

Here is my pros for triangulation and cons against first approach:

This speculations were inspired by recent pair programming session introducing TDD principles.

March 13, 2003

Created SV Programming Yahoo! group. Just in case.

March 15, 2003

Discovered programming blog community. The chosen ones are:

More than appropriate here a Writing as a Reflective Practitioner with Wisdom (beware unclosed header tag).

March 15, 2003

The Job Market Sucks, so Desperation Smells and Agencies Do Not Respect You. Programmers learn Hiring Patterns and sometimes smile at AnneLearnsToRecruit.

See also Top 10 tricks used by recruitment agencies!.

March 15, 2003

"Unit tests are written in the same language as the code they test. They interact with the programming objects directly, often in the same address space ... Functional tests, on the other hand, almost always run completely separately from the system that they are testing. They require specialized tools, often using different languages, that are designed to specify and recognize behavior that is visible to a human being as opposed to another programming object." from How XP Teams Benefit from Having Testers.

My projects really lack AT and I'm going to bring the customer closer to the development team. Teach her and help her create these testing scenarios.

March 15, 2003

Writing with XML is a recent article by Martin Fowler. Interviews with Martin and others at Artima.

March 16, 2003

Very interesting and easy to read paper on software economics Towards Measuring Software Value (you can hover mouse over indices to read notes) by Howard Baetjer.

"for reasons I will never understand, testers actually seem to enjoy this kind of thing" wrote Ron Jeffries about QA. You can see it for yourself in Test aerobics clip (9.5 MB) by James Whittaker.

Two sites about non-standard job searching techniques: JobHuntersBible by Dick Bolles author of "What Color Is Your Parachute?" and Ask The Headhunter .

March 17, 2003

Change Your Organization Diary.

March 20, 2003

    int signal_attenuation(){
        const int maxThreshold = 42;
        int result = free_space_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        result += obstacles_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        ENSURE(result <= maxThreshold);
        return result;
Code above is untestable. OK, here goes second version.
    typedef int (*IntFunction)();
    int signal_attenuation(int maxThreshold, IntFunction free_space_attenuation, IntFunction obstacles_attenuation){
        int result = free_space_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        result += obstacles_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        ENSURE(result <= maxThreshold);
        return result;
Much better. We can even use boost::function.
     int signal_attenuation(int maxThreshold,
                            boost::function<int> free_space_attenuation,
                            boost::function<int> obstacles_attenuation){
The problem is we don't need all this flexibility. Nobody will pass different parameters to our function in runtime. Production code and tests already determined. So, the last version.
    template <int maxThreshold, class FreeSpaceAttenuation, class ObstaclesAttenuation>
    int signal_attenuation(){
        int result = FreeSpaceAttenuation::free_space_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        result += ObstaclesAttenuation::obstacles_attenuation();
        if (result >= maxThreshold)
            return maxThreshold;
        ENSURE(result <= maxThreshold);
        return result;

    class MockFreeSpaceAttenuation{
         static int free_space_attenuation() const{
            return 1;
I'm glad to be able to express my design decisions in program code.

March 22, 2003

Added memory leaks detection to my test suite for Radiomap VC++ project. Found 2 leaks: some tests used global singleton object adding data to it (fixed adding clear method to global) and improper use of _com_util::ConvertBSTRToString() (fixed explicitly deleting received string). Not bad for 300 assertions in size test code. Thanks to standard containers and smart pointers.

For detection I used _CrtMemCheckpoint and _CrtMemDifference functions from Debug version of C run-time libraries. First checkpoint placed before first test and second after the last. No need to change other code or project settings. It becomes a little trickier if you want to suppress Release build warnings or wrap this API in elegant class, but doable (although I failed to get memory leak size).

March 23, 2003

Just started svBlog project creating a program to help me manage this news. Smalltalk, XML, COM, distributed development team (Maxim helps me).

Yesterday installed Cincom Smalltalk. I already have a little experience with Squeak and now I'm reading Ivan Tomek's introduction. For me the different kinds of messages and their precedence were most confusing and this tutorial clears it in a moment.

March 25, 2003

Compare "Clean up your room" and "Clean up your room. I'll check that all books on shelves and no dust on the bookcase." Why everybody prefer first form and then blame the executor for a deck of books on table leaving without notice clear windows? I think there 2 reasons: Accurate specification greatly benefit development process. But why customer should bother? The only reason I can think of is the possibility for him to get product much earlier. But how much? It's hard to give exact number, but definitely earlier. Anyway the saved time from the underspecification will be wasted during retesting and blaming. And I think that developers also underestimate test first approach. Well, what else they could think never trying (never heard of) it?

Tomorrow I will promote acceptance tests first practice to direction.

March 26, 2003

"Plans are useless, but planning is indispensable". Director started today's meeting talking about tests. Not real tests ("we should test our model with these inputs"), but tests nevertheless. To get correct answers we were sent RTFM and that was understandable, cause it's scientific research project. There was a talk several weeks ago when I mentioned usefulness of unit testing and director fully agreed, but had doubts in the line of "no time for tests". Maybe it helped.

One lesson for me - continuous communication is the key. Rare meetings are bad time to introduce new ideas, cause everybody have accumulated they own thoughts and want to talk more then listen.

March 27, 2003

Ever wrote throwaway code? I did it for years <g>. Now we have tests, but there still spikes for those who need excuse. I don't feel that bad code easy to write. It smells, it doesn't reveal intention slowing you down, it is big ball of mud hard to debug and automate. You have the right to produce quality work at all times.

"I don't always use TDD for throwaway code. When I don't, I almost always get in trouble and have a long debugging session. Slow learner." Ron Jeffries.

March 28, 2003

"In the future, we won't need to type, because we'll have computers!"

March 29, 2003

I'm on the news <g>. Laurent elaborated today on continuous communication and relevant principles. I envy to those who can turn single idea into plausible conception.

"If something (good) hurts, do it more often."

March 30, 2003

New blog I recommend to evaluate Reflective Surface. Top discovered link Hire a hacker FAQ .

April 1, 2003

How to copy a line of text using Windows Notepad? Home - Shift+End - Ctrl+Ins. Think about it. You don't think about it editing the file (your fingers automate this task), so think now. Five key presses are not a problem, the problem is in an attitude. We use object technology principles to discover high level concepts, we reveal intentions in code to be understood, but aren't our own actions also important? Paste line, comment block, thinking about it leads to rename variable, go to function definition. Are they straightforward in your IDE?

Using MS Visual Studio .NET and Visual Assist .NET for C++ projects, here is a list of functions (which use current text cursor position) that I have key bindings to:

Copy line to clipboard Handwritten macro
Paste line from clipboard below current line Handwritten macro
Open line up/down to current (similar to Home/End + Enter) Handwritten macro
Delete line MSVS
Comment/uncomment block MSVS
Increase/decrease indent MSVS
Go to function/class definition VA
Previous location (similar to back in IE) VA
Build+run tests/run MSVS
Open alternative file(.h from .cpp and .cpp from .h) VA

Other important features are auto completion and syntax highlighting (VA), tabs (similar to Netcaptor or MyIE) (MSVS), templates for class/test/function files creation (handwritten wizards).

In gVim (for Clipper/FoxPro projects) I additionally have "find same words and mark it" feature, just click the word to find holding Shift. Actually, it was the gVim that converted me. No need for toolbars and menus any more.

I'm now using VisualWorks 7 a little for personal project. You know "Smalltalks' IDE are best". Well, I'll say you this: default configuration is ... questionable. Different windows (9 to the moment) clutter my taskbar, no user friendly toolbar, menu, key bindings customization. Good news: there are parcels for syntax highlighting, autocompletion, tabs. Today I hacked through to add "go to class in one key" feature. Something like "change your environment".

Programming patterns?

April 4, 2003

One of the most useful principle in my personal work style is "do it now". Bugs, code smells, manual testing, excessive typing, obsolete libraries, everything that you are going to fix "tomorrow, after the new functionality will be finished" should be fixed right now. I presume it's unapplicable to standard commercial software development environment, but I never worked in such environment myself (you can think that I didn't have a decent job or you can think that personal motivation stronger then external pressure).

How it works:
1. There is no "tomorrow". Free time doesn't grow on trees.
2. More early is's fixed, more early you'll start to get benefits.
3. Quality work has strong positive feedback. And vice versa.

Sometimes it's hard. I spent last 4 days to set VW to the minimal comfort level. I have no problems with bad IDE, problem with VW was that it is possible to customize it. And if something doable, I can't leave it for tomorrow.

April 11, 2003

Quality is cheaper, if you can afford it.

April 12, 2003

"The facts are that Windows 2003 is compiled by VC 2003... Win 2000 was compiled using VC 5..." Egbert Nierop.

April 12, 2003

You are developing user interface for blog management program. You can draw it in Painter, run and experiment or you can write down requirements creating mental model. Example number 2: you have failing test. You can run debugger on it or you can start analyze test code.

Which approach is better? I prefer the latter. Former looks more efficient, but to solve a problem is not enough. Do we need this solution at all? Do we need toolbar, what size of the window we want, is this a right test? We should think about it and interacting with an environment is not the best way of thinking for me. Fast feedback is important, but first define the goal.

What if we don't know what we want? Well, it's another question...

April 13, 2003

Pair programming is not always (rarely) available, so we should use other techniques to pass experience (e.g. audio/video records).

I have a little experience using Windows Media Encoder 9 and this is how it works. I also recommend to download Window Media Player 9, it required for video editing and seems to have most recent codecs. I'm using Windows XP, but theoretically it should work under Windows 2000 as well. I'm using Genius Mic-01A microphone with frequency response from 100 Hz to 10 KHz and it sounds great. During recording my Athlon XP 1.667 GHz loaded up to 100% (70% on average).

Settings for WME9: Start from "Capture Screen" Wizard, capture "entire screen" and "audio", choose "high" quality, don't "begin capturing" and just click on "Finish". Go to "Properties", go to "Compression" tab and click "Edit", select "Quality VBR" video mode, go to "Quality-based" tab, select "Audio format" 16 kbps 22 kHz mono CBR, enter "Frame rate" 5 fps, go back to "General" tab, enter your favorite "Name" and "Export..." to unique profile file (otherwise some of your encoding settings will not be saved), press "OK" on the whole "Custom Encoding Settings" dialog. Now "Save" your session in file, next time just click this ".wme" file and you are ready to go!

A picture is worth 1000 words, so check the bottom of Code section. There is little programming experience in that file, but you can check quality of picture and sound. You can also use such recordings for personal reflections <g>.

April 15, 2003

"Correctness is the ability of software products to perform their exact tasks, as defined by their specification." Bertrand Meyer.

Without specification there is no correctness. Maybe this is the way to fight against "code first".

April 17, 2003

"You can't protect yourself against your own people's incompetence ... your best tactic is to trust them." Peopleware.

"... the programmers did not commit a bug. The team didn't do the right thing, it is true, but the problem starts with a missing Customer Test." Ron Jeffries.

What is your choice? Should we trust programmers or should we write more tests? Probably your don't have to make a choice. If you are a developer or a manager then trust, but when you are a customer then better check.

April 17, 2003

Is Proof More Cost-Effective Than Testing?

April 20, 2003

New blog to read CraigBlog.

April 20, 2003

"You should *absolutely never* have to look at the source code, not just 'almost never'. My personal rule: If something isn't documented, simply don't use it, as implementation is always subject to change without notice. There is interface and implementation, or, equivalently, documentation and code. Having both completely separated is IMO one of the fundamental properties of clean software design." Gerhard Wesp.

April 22, 2003

1. Passes all the tests; 2. Contains no duplication; 3. Expresses every idea you need to express; 4. Minimizes the number of classes and methods.
"... they're the rules of /simple/ design, not necessarily good. Though there is a relationship ..." Ron Jeffries.

April 23, 2003

"...we have to try to make sure that software gets written in a responsible way, discouraging or even disallowing dangerous settings, warning the user in a way that really catches his attention (i.e. _NOT_ a "Press OK, if you want to do that stupid thing", but rather [Enter 'I know this is stupid.' in the Textbox below.]) when he is doing something dumb..." Andreas Beck.

April 25, 2003

Back to programming.

When I first saw and tried CppUnit, the need to open test dialog somehow and click "Run" button every time I test was the reason I created my own UT framework that runs from command line and just displays assertions result in Windows MessageBox. I used the same approach creating UT framework for Clipper.

Then Eiffel and NUnit. I like NUnit's ability to collect tests from the program via attributes (no need to manage tests inside program). And we can start NUnit only once, later just clicking on "Run" button. NUnit also has assertEquals (to programmatically display nice descriptions like "Expected 1, but was 2.") and able to catch unhandled exceptions (to continue run other tests).

Then VisualWorks and SUnit. Lack of description in assertions is my main objection (SUnit 3.1 has descriptions, but it displays them in common launcher window and so they are ineffective). Despite that SUnit has several neat features such as time elapsed from the last successful run, number of tests and yellow background while running tests.

In my recent Matlab UT framework I'm trying to combine these best practices, particularly creating a large set of equals assertions comparing matrices and signals with graphical descriptions. And now I'm back to the problem of one button testing. Maybe it's not a problem in VisualWorks where SUnit window is small and just one of the other 10, so we can constantly keep it near the corner of the screen. But using MS VisualStudio I can do my work having only one active window containing program code. I don't like to have to take a mouse, drag cursor to taskbar, select UT Gui window and click "Run" in it.

Definitely there are programs to automate such tasks (I even wrote one myself), for example Tasker that I'm using right now. But I think it would be better if UT frameworks developers build some interfaces (COM, command line) into the program to facilitate true one key press operations.

April 25, 2003

Upgraded my VC++ 7 project from Boost 1.29 to 1.30. Transition facts: boost::function<int, int> now has syntax boost::function1<int, int> (boost::function<int (int)> not supported by vc7); boost::lexical_cast now uses long format for double to string conversion (3.14159265358979 instead of 3.14159); boost::thread now in dynamic, not static library.

Two most interesting things for me in this release are BOOST_CURRENT_FUNCTION macro similar to __FILE__ and __LINE__ (it works in vc7) and Filesystem Library.

April 25, 2003

My VisualWorks 7.0 project gradually ceased to work (storing program and development environment in the same place is not a good design decision, same with the tight coupling when overloading classes from different packages). So I decided to install version 7.1. With new version most problems remain the same (can't save files to d:\temp\, but only to d:\; deployment errors with default settings), but now I know it's not my installation fault and I will try to solve or workaround them.

WindowsXP controls in VW 7.1 looks little inappropriate as I use classic Windows scheme. Old windowSpec of my main window failed to load in v7.1, so I recreated it from scratch. To successfully deploy I included Toolbar resources in project (it used when you have a menu in program). Also I created separate image for deployment and I hope it will lighten the process (but definitely not to the level I have in C++). Testing using ForkedUI seems to cease to work too, but now I know that mixing acceptance testing with unit testing isn't a good idea anyway and I will try to use external tool such as TestComplete.

April 29, 2003

I'm eagerly reading on Acceptance Testing now. There are 2 main principles concerning GUI testing I got so far:
1. Testing is a software development activity, not monkey typing (I knew it and now I have references).
2. Developing application for testability is a good thing (same with unit testing, BTW). I'll try to add command line interface for my classical (GUI rich) Windows project.

April 29, 2003

If you have any interest in application testing read Improving the Maintainability of Automated Test Suites and Design for Testability, Agile Testing, and Testing Processes . If you want to know more meet Bret Pettichord and Cem Kaner. I think I don't need to remind you about Brian Marick.

April 29, 2003

Reviewing my Links page.

Removed link to Joel on Software (everybody knows about him without me and it's not so interesting now). Added link to just discovered Agile Articles (lot of resources divided by categories for easy search).

Added blogs section featuring Laurent Bossavit, Keith Ray and Brian Marick.

Added agile-testing yahoo group (posters include Bret Pettichord, Lisa Crispin, Elisabeth Hendrickson, Cem Kaner from a testing world as well as many known leaders of agile community). Removed Boost Users group as of little value, particularly for the reader of the main Boost (developers) group.

Added Matlab newsgroup to the list. It's my champion newsgroup for high traffic and time I spend reading it (I'm newbie, Matlab is very big and there is absolutely no flame, just Q&A).

May 1, 2003

Bertrand Meyer's "Object oriented software construction" is a best OT book ever (it's a pity that I still can't find enough time to finish it). It's equally important to be a specialist and a writer to produce lasting books and Bertrand matches this description very well. Here is some of his articles for Software Development Magazine. If you don't want to read all of them, take Achieving Interoperability in .NET.

May 1, 2003

I'm now reading (not very interesting) Martin Fowler's "Analysis Patterns" and there is Listing 7.3 "Creating a two-legged transaction" on page 139. ("I choose Digitalk Smalltalk over C++ because Smalltalk makes it easier for me to convey the basic ideas. The concepts should be readily transferable to C++" Martin <g>).
Transaction class>>newWithAmount: aQuantity from: fromAccount to: toAccount whenCharged: aTimepointOrDate
  ^self newWithAmount: aQuantity from: fromAccount to: toAccount whenCharged: aTimepointOrDate
        creator: nil sources: Set new

newWithAmount: aQuantity from: fromAccount to: toAccount whenCharged: aTimepointOrDate
               creator: aPostingRule sources: aSetOfEntries
  ^self new setAmount: aQuantity from: fromAccount to: toAccount whenCharged: aTimepointOrDate
            creator: aPostingRule sources: aSetOfEntries

Transaction>>setAmount: aMoney from: aDebitAccount to: aCreditAccount whenCharged: aTimepointOrDate
                        creator: aPostingRule sources: aSetOfEntries
  self require:
  [aMoney isKindOf: Money.
  aDebitAccount isKindOf: ServiceAccount.
  aCreditAccount isKindOf: ServiceAccount.
  (aTimepointOrDate isKindOf: Date) or: [aTimepointOrDate isKindOf: Timepoint].
  (creator == nil) or: [creator isKindOf: PostingRule]].
  self initialize.
  self addEntry: (Entry new setAccount: aCreditAccount amount: aMoney charged: aTimepointOrDate).
  self addEntry: (Entry new setAccount: aDebitAccount amount: aMoney negated charged: aTimepointOrDate).
  creator := aPostingRule.
  aSetOfEntries do: [:i| self sourcesAdd: i].
  self checkInvariant.

Object>>require: aBooleanBlock
  aBooleanBlock value ifFalse: [self error: 'Precondition Violation']

  balance := entries inject: Quantity zero into: [:total :each | total := total + each amount].
  self require: [balance = Quantity zero].
Look at DBC elements! When I started to use DBC in dynamically typed Matlab it was clear that before checking function parameters value I should check their types (storing type in a variable name like aQuantity for documentation is even worse than Hungarian notation). And here it is, the approach known 6 years ago.

I hope nobody will call setAmount with integer money, cause [false. true.] value equals to true and precondition violation would not be noticed <g>.

May 3, 2003

Apprenticeship at Adaption Software and RoleModel Software. Software development firms which care so much about employees education, wow.

May 4, 2003

For novices, greenfield development more productive and easy comparing to maintenance. It would be nice to keep project in greenfield, so what turns it into the maintenance? Code size, time, number of users? I think answer is change. What wrong with the changes, why they are so hard?
1. For a change we need to know how current program works, we don't need this knowledge for a new feature.
2. Changes look very easy from a user point of view (while she may have problems imagining new features, changes just pop up into the head). So, by contrast, changes from developer point of view look harder.
For experienced developers, XP and OT help understand how program works (intentions in code, clear mapping to real word concepts) and minimize number of required changes (single responsibility, no duplication).

Thinking about add and change reminds us about delete. Discussions about feature removal are rare and it may seem hard to do right, but in the light of this musings delete requires only to know how the program works. So delete = change - add. In other words, change = delete one thing and add another (on the other hand, delete often results in change of the other objects interconnections).

To minimize maintenance we can reduce number of change requests (using BDUF) or reduce cost of change (using solid software engineering practices). We can also try to transform change requests into the new feature requests, but following this principle while postpone the maintenance increase cost of change.

You may ask what wrong in using good engineering, it certainly can reduce cost of change to the level of new feature addition. But it requires great skills and not everyone want to invest time in education. Unfortunately, I don't see how to avoid it, except of using (fragile and limited) big up front analysis.

May 7, 2003

"But the hearts of Men are easily corrupted." In programming too. Cut'n'paste, lack of tests, fragile code can take control on you (well, at least on me) very easily. New working features overshadow what we'll need tomorrow.

How XP recommends to struggle with bad habits? Not. Code test and solution any (dirty) way down. Then recall code quality and refactor. These three steps supposed to be short term pleasant and despite that good in long term too.

You know all this jokes about "test addicted", "XP pusher" sometimes not so funny, for example when code 10 lines long too complex for me to comprehend, when I fear to refactor without tests, when I can't write code without user story and AT. Maybe it's my personal problem and not relevant to XP, but it seems like I'm very bad now in solving complex and abstract problems. Fortunately(?) I successfully simplify my current programming tasks, but type theory, lambda calculus, correctness proof, high level (UML) analysis are too complicated for me. When I read about projects like Sholis or when developers did not compile program for months and result yet has almost zero defects or when requirements thousands pages in size regularly changed and team handles it without claims of using XP I want to know how is it possible, I want to learn this techniques, but I can't.

I want to be better developer, not simpler. Though there is a relationship.

May 10, 2003

Finished reading "Analysis Patterns". Actually, I skimmed over. Martin is a great UML modeler and has extensive experience working in business domains, but I'm too far of these problems. Thus I also postpone "Patterns of Enterprise Application Architecture" until better days. It was very hard for me to concentrate on diagrams in the book, so I removed Craig Larman's "Applying UML and Patterns" from reading plans as well. Instead I added Paul Graham's "On Lisp" and "ANSI Common Lisp". First book and first 2 chapters of second book available online. Relevant changes in Books.

May 11, 2003

Do we need quality? I don't have references, so let speculate.

From the shrink-wrap user point of view, looking at my programs I think the only product that was buggy enough for me is Win95, it was replaced by Win2000 in February 2000. All other programs were selected by the means such as price, compatibility and features.

From the in-house developer point of view, assuring quality (debugging and manual testing) took much of my time. Maybe it's my another personal problem <g>, but I can't throw raw code to my users. Instead I chose to study software engineering, which also supports program evolution.

Conclusion is surprisingly clear. One needs to be better developer to be more productive. My 2 main projects last 3 and 5 years, so I better be productive in a long run.

(Other areas such as drivers, frameworks, languages probably have own peculiarities).

May 12, 2003

"... when defects are dependent upon more than one factor, the most common scenario is for the defect to be dependent on exactly two factors" Pairwise Testing.

"Since there are often too many parameter combinations to test all possible scenarios, the tester must use some methodology for selecting a few combinations to test" The Combinatorial Design Approach to Automatic Test Generation.

Other essays by Michael Bolton. At least, read Zero Balances and Zero Responsibility, Installation Programs and Effective Beta Testing. No, you can't read only one <g>. Most entertaining is A Review of Error Messages.

May 13, 2003

Duties of an application testing tool

1. Simulate user operations. 2. Retrieve application data.

Low level operations are easiest to implement. Sometimes they have user stories behind, e.g. "status bar should indicate object name under the mouse cursor" or "draw a red circle at the top of a graph".

When application GUI controls are standard OS controls, medium level also achievable. But not all text on the screen represented using controls -- labels and status bar information usually rendered as pixels.

Application level control requires special developers work. It can be COM API, command line interface or exclusive extension.

Experience evaluating TestComplete

One my project is a MSVC++ MFC app, other is in Matlab. All controls are native, so TC successfully drives them. There are extensions that allow to instrument MSVC++ program to be "open" for TC (call internal program functions from an external script), but I don't use them yet.

TC provide functions for screenshots capture, save/load and seek one image inside other (comparing parts of images less brittle to future changes).

For test code you can use VBScript, C++ Script or Delphi Script (mini CLR <g>) inside TC. Outside you have access to all TC functions through COM. Special (.h) library allows you to cut'n'paste between C++ Script and real C++, e.g. Sys["ActiveWindow"]["WndCaption"] works equally well in the script and in the language. Very convenient.

Recording facility creates UI commands equivalent to user operations. Plain recording is exactly what makes GUI testings so brittle, but it's a quick start to familiarize yourself with the tool and beginning of the tests development. Help from the tool is the only way to deal with controls without title such as edit boxes, result looks like setEditText(p.inputForm["Window"]("MWEDIT4194304", "1", 9), "1000").

VisualWorks applications are special. They don't use native controls, so you must use special tools. SilverMark's Test Mentor seems to be the one and only such a tool. It costs $3500, comparing to $350-$500 for TC. Anyway, evaluation version is always free <g>.

May 17, 2003

Experience evaluating Test Mentor for VisualWorks 7.1.

TM comes in parcels and intended to be used in development image. No support for testing deployed application, i.e. you can't test already deployed program and you can't test is everything included in deployed image during runtime packaging (I mean you can't test it automatically, manual testing is always with you)

TM's preferable tests development strategy is through UI recording. For example, you can add empty recording step inside test and TM will execute steps before planned recording (e.g. setup), then it will record your actions and then it will execute steps after recording (e.g. cleanup). So, you don't need to prepare application for recording manually. For verification you should select widget in the window using mouse, then TM will show list of parameters (specific for selected widget) and their current values. Selecting elements in this list automatically creates verification step. You can copy steps and scenarios, instead of recreating all from a scratch. Never before you could create lots of redundant data so easy <g>.

Programming tests, main showstopper is that I failed to give UI time for message processing. Obviously, I can't write selectMenu: 'Add'. press: 'OK', because message for menu needs to be processed in UI subsystem -- then dialog with OK button will appear. Adding Processor yield or delayFor: 1000 after selectMenu doesn't help. In TM GUI shell's scenario this two messages form two steps. When TM executes them, it does insert appropriate pause. Unfortunately, I don't know how. Perhaps when running tests TM creates different thread for itself.

Thus, instead of plain old functions I'm stuck with a GUI containing steps with code blocks like

self varNamed: 'newsToAdd' put: (NewsItem fromArray: #(2 'April 1, 2003' 'text')).
CommonSuite runScenarioNamed: 'Add news'

And I spent a lot of time to discover that this is the way to pass parameters and reuse modules.

TM practice is to create each assertion in different step. When unit testing, I often create several assertions in one function. Creating different step for each assertion is an additional work, but result more intention revealing. As more people work with AT and some of them may be non-programmers, it seems like a good approach.

GUI of TM itself quite ugly and buggy, while rich for running tests and analysing results. No problems during recording and playing scripts (I successfully reimplemented tests that were made using home-grown library). No descriptions in assertions. Little documentation and absence of discussions on web. All that is typical for VW.

So, it's a working tool. Disadvantages don't matter because there are no alternatives. Flashing windows of working ATs shine, especially if you don't know about lots of duplication ready to blow some day.

May 18, 2003

With the help of Maxim and acceptance tests, I have made program to manage news. Now I'm able to implement more (controversial <g>) ideas about how my blog(?) should look like.

All my ideas come from experience visiting other news resources. Most convenient scenario is when reader visit news page in exactly the same rate with it's updates (usually daily). If this is the case, news page should contain only new information. My style is different -- I can skip days, I can post several times per day and, most important, it's hard for me to post every day in the same time (but it's a good idea).

When reader visit news page more often than it updates, typical approach is to show her "yesterday news". Reading twice is a duplication that I want to refactor. Thus my Compact News (why almost nobody use it?).

When reader visit news page less often than it updates, typical approach is don't think about this case. Web top posters must die. Anti chronological order in news is like code before test. Thus again my Compact News where order is correct.

There is also first time visitors which interested in archives. Why typical archives are also in anti chronological order???

Here is my design. Main News page contains news for last month (32 days) in most simple (ac) form. Compact News page contains news for last two weeks (15 days). Archive page contains all news since the beginning. Permanent link to Archive is at the bottom of News page.

Perhaps I'll add more features later. Your ideas will be highly appreciated.

May 20, 2003

The more I use design by contract principles the more I notice how some of my errors could be prevented if I use DBC more steadily. There is little info on DBC (I can only recommend OOSC book), so here is my 2 cents.

Basic idea is that given precondition function obliged to satisfy its postcondition. It makes interfaces very explicit and robust. Client knows what to prepare for function call and what a result will be. Supplier can rely on precondition that simplify its job to single responsibility.

For me DBC is the next big step after TDD (which in turn occurred 1.5 years ago). They have much in common: drive design before code, require some time practicing to comprehend, document code. But while TDD is deductive approach (by example), DBC is inductive (by specification). And as both specification and customer tests required for software product, DBC and TDD both help developer build correct solution.

See also this more detailed introduction to design by contract. But more importantly try it for yourself. Precondition checks are most valuable and don't require anything from the language. Postconditions harder to formulate and often TDD solution more simple.

Two examples which happened last week that I talked about at the beginning.

1. For my Matlab project I wrote a function that snaps current mouse coordinates over graphic to data points. This function was thoroughly TDD tested with presumption that graphic's data (signal in time or spectrum) starts from 0. Later we added new type of graphic (autocorrelation function) that spans time interval from -T to T. It took some time to realize that cursor coordinates are now wrong and localize the problem. If I had explicitly written down precondition, I would immediately got error pointing to my (too restricted) function.

2. For my Smalltalk project I wrote a function for substring replacement. Presumption was that source string must contain substring to replace. Then I by mistake (wrong cut'n'past) passed to this function variable news instead of news_xml. Result was an internal VW library assertion and I spend some time to figure out that problem not in my function, but in caller. Again, if I had explicitly written down precondition it would been obvious immediately.

May 27, 2003

Today I killed the Bug which for two weeks terrorized our development team. Steps to reproduce problem were known and easy to follow (it occurred during program startup), but bug appeared only once in 10 to 20 runs when it knows we were hunting (and once in every 2-3 runs when we tried to work <g>).

As I discovered, the key was in mouse movement. If you move mouse over forming window, mouse move handler facing absence of (not yet created) principal objects wreak havoc. Actually, bug (unexpected axes object) was side effect of query gca command. gca returns current axes object and, if there is no axes yet, it creates one. The and clause is documented behaviour, but obviously I were not aware of it.

Lessons for me:

May 28, 2003

How don't waste your time developing software? Ideal development would be typing all code in a row, then deliver application (or, even better than typing, just say it or draw it to computer). No, it's an ideal programming. Development also includes gathering and analysis of requirements, which in ideal world could just be written down as well.

Requirements simplicity comparing to bloated code comes only from omissions. Large part of requirements is in implicit form (doesn't "Clean up your room" extremely vague?). Using modern programming languages and complete requirements in English, programming is a barely syntax reformatting. And I think requirements is not complete without specification of how things should be done (having requirements/specification document we should be able to run our system in manual mode without computer). Software libraries reuse is exactly the reason for chasm between users/developers and programs. Of course reuse also has a lot of benefits and programming task is to bring it to project.

Debugging is a tool to better understand program. Testing to check our assumptions. Refactoring to evolve program. Modularity to manage complexity (calling lots of H2O molecules "an ocean" is also a modularity). It seems everything is important <g>. But novices do spend much more time on the same tasks comparing to experienced developers. So, difference is only in effectiveness. Time waste as inverse of productivity again has led us to importance of skills.

May 30, 2003

Software Testing and Internationalization book by Manfred Ratzmann and Clinton De Young is a modern view on (agile) application testing. Most things are familiar, but check out Testing by Documenting ("Does it really work the way I say it does?") and Interactive Unit Tests ("call a single function interactively" when number of test cases "goes into the hundreds").

I'll use this book as a reference to well known practices in which I have some doubts.

1. "Acceptance testing as Black Box tests". Not able to test everything, we must maximize effectiveness of chosen tests and White Box testing could point out important and dangerous boundary conditions. Maintaining tests, we must minimize their number and White Box testing is exactly the tool to remove duplication from tests (if some functionality implemented through common function, we don't need to test this functionality every test case).

White Box AT blurs the line between unit and acceptance testing, improves non developers' understanding of the product and enriches requirements/specification documents. Moving AT closer to developers removes duplication with UT and could be effectively combined with UI and interunit communications testing.

2. "Use a scripting language to produce tests". I use C++. Yes, it's my native language and all that, but rumors about disadvantages of statically typed languages are big exaggeration anyway. If testing is a software development, why shouldn't we use best development practices?

June 1, 2003

Having 40 years experience in computer science, Daniel M. Berry offers a lot of papers on his site for us to learn, concentrating on requirements engineering. Most interesting are: See also:

June 2, 2003

If you want to change, try feedback.

June 4, 2003

NUnitAddin "Point and Test NUnit integration for Visual Studio.NET". Textract "development tool to capture text from Windows screen using OCR". It could be used in GUI testing or some automation tasks. I tried Kleptomania product which uses this technology and results pretty good for capturing text from statusbars, labels and other "bitmap controls". Capturing text from more complex windows depends on whether they use standard fonts.

June 5, 2003

Testing: Requirements Engineering: Misc:

June 8, 2003

While independent tests are easier to maintain, they miss complex and hard to get right interconnections in program. So, it's good to know about existence of Model-Based Testing:

June 8, 2003

Pete McBreen's articles. Not much news, but very well put and follows my own believes (references save time <g>).

June 8, 2003

ConTest project to find bugs in multi-threaded Java programs. This paper describes interesting techniques which could be applied in other environments as well.

June 8, 2003

How to Break Software by James A. Whittaker and Alan A. Jorgensen. More practical suggestions for testers.

June 9, 2003

They Write the Right Stuff for Shuttle using Clean Room Software Development process.

June 9, 2003

Acknowledgement and discussion of the real world problems in ClearStream papers:

June 10, 2003

June 11, 2003

The Personal Software Process - personal feedback on steroids. Main idea is that if we define the goal (LOC with minimal defects), measure how each activity (design, coding, testing) helps us and how much each activity costs (time), then we could tune activities to maximum effectiveness.

1. Our goal to is maximize business value of the product to customer for minimal cost and time. Code quality more important for development and maintenance (minimize cost and time). Business value is in working and specific requirements.

2. In XP, design, coding and testing are single activity. We can add requirements gathering and acceptance testing, but they still don't overlap - each activity helps in unique way (BTW, this is why we can't do "less XP", but we can do "more than XP").

3. Measuring time spent on each activity is easy, but without 1 and 2 it doesn't matter.

So, PSP is too narrow for me. It talks only about coding (TSP not better) and talks about work harder, not smarter - it doesn't introduce new practices. Well it talks about reviews, but from the paper I don't see what exactly does it mean - who, when and how perform this reviews? I hope it's not as bad as in Keith's and Ron's experience <g>.

PSP also strives for planning accuracy. According to Kari Hoijarvi: "It seems, that I'm probably the only one person in the world that finds both XP and PSP useful ... At least for me, the biggest measurable advantage of PSP is schedule prediction and tracking." I think, if it is important for you, just plan often.

Nevertheless, I will try again to measure my time spent. I tried 1.5 years ago: for 1 month I manually recorded all activities. It requires very good reporting facility, I hope I'll create one this time. And I definitely need automatic tool, at least something like Activity Recorder. It's like profiling application - I want to see the hot spots.

June 15, 2003

Chris Sells's site. I recommend to start from the beginning of the spout.

June 15, 2003

"Real software engineering has so little to do with actual technology, it's kinda sad" Chris Sells. Yes, software development is not fun. Testing, designing, refactoring, maintaining, debugging, gathering requirements, meeting is not fun for developers. Testers do have fun in testing, architects - in design, smalltalkers - in refactoring, nobody - in maintaining, hackers - in debugging, requirements engineers - in gathering requirements, project managers - in meetings. Developers do have fun in programming. Programming as reuse - as use of technology. Programming as with minimal effort (LOC) create sophisticated things (think about CreateWindow function, SELECT command or Rijndael class). The less LOC the greater reuse - you know this C and Perl gems. Reuse of the source code (aka remove duplication) will never compete with the reuse of technology.

But it's not the only source of fun in programming. Human beings have two source of "fun": pleasure and evolution. Evolution through creativity covered in the previous paragraph, the second part of the evolution is learning. Learning new things, there is no learning without new word.

Aren't there lot of new technologies in programming? The more experience I have and the more mature computer science is the more slowly new technologies come to me.

Purpose of this reflection was to discover why I'm not so excited in development as most of the programmers (including myself in youth).

June 19, 2003

"I could be wrong". So what? So other people will not trust me. Kind of.

I easily give people second chance. It's very rare that there is absolutely no time or resources to correct a mistake. And once I have the final result this is the point to judge.

It's about acknowledging mistakes in public. Not very easy, right? Generally, there are two sources of failure: not enough effort and not enough knowledge. Both are quite unpleasant for the one who expected result from you. But effort and knowledge are not "mistake" as we know it. Mistake by definition is something small: typo, missed event handler, broken cup. Mistake by definition is something fixable. On the other hand, we have car crash or big loss of data witch are called "incompetence". This distinction is only by result, not by human activity.

Thus acknowledging mistake isn't important - you will be judged by result. Acknowledging mistake sometimes presumes that you will learn from it. But, even if it true, it's "implementation detail" - there are lot of other ways to learn. Nobody care how you avoid making mistakes - just don't do them and everything will be OK.

Acknowledging mistake might have good psychological effect for the team: you signing to fix it and often free of charge, others looks smarter in contrast to you, you take off the blame from others. Making good things for the team pays back, but don't forget the cost.

Mistakes do have cost. Sometimes negligible, sometimes enormous. Try to control it.

June 21, 2003

2001 XP Universe Conference Papers:

June 22, 2003

Holodeck product by Security Innovation. First of all read Software's Invisible Users by James A. Whittaker (do you remember his "Test aerobics" clip?).

Brilliant ideas! Interactions with OS severely underrated. James also talks about unintended functionality, which particularly dangerous in security applications (Testing for software security, scanned 15 MB article). And it's not only ideas, Holodeck performs all low level work to assist tester in exploring an application.

From the test first developer point if view, Holodeck can be used instead of mocking OS API. Ability to substitute any function in Win32 or .NET API allows unprecedented control over OS memory manager behavior, file access and network connections. For example, using samples and external interface from the trial Holodeck version, I created two small test applications in Managed C++: first denies file access to Notepad (so File Dialog doesn't show any disks, directories or files), second runs my own application limiting memory usage to 30 MB (my program gracefully managed first use case that required lot of memory and terminated on second). According to docs, I can substitute any system call with my own function or just return arbitrary error code. "Permanent" substitution could depend on input function parameters. "Dynamic" substitution might occur during program run, e.g. you can intercept interface just before particular test case.

While Holodeck is not free and first version GUI is not very useful and we yet can't handle more conventional human user interactions very well, this is the way to go. And using Holodeck API (which is always more preferable anyway), you can solve some kind of the problems right now.

Found via Eric Jarvi's blog.

June 23, 2003

AppSight Black Box product by Identify Software. Superior way to diagnose software malfunctions in the field. You can read feature list in this paper and that's all. No trial version, no implementation details, no constraints. One obvious problem with this approach is that video recording and low level tracing consume _lot_ of resources. Well, sometimes we can afford it. Audio interview talks about turning on "full" tracing only in emergency situations to lower expenses, but the whole point is that we don't know when application will fall.

It's nice to think about general solution contrary to burdensome application specific trace messages, which cover only a small part of the picture. So, let's think.

June 28, 2003

Running as non-admin or Developer Lifestyle "...developing code as a non-privileged user and helping start a culture change on the Windows platform" seminal article by Keith Brown.

I always was a big (personal) security fan, reading and using appropriate stuff. And I always ran as a single most privileged user, but not anymore. Additional thanks to Craig Andera for popularizing these ideas.

Well, I'm not trying to sell security here. Rather I'm trying to bring out multi-user and limited privilege scenarios. Scenarios for which you should develop your applications. And, please, consider also scenario when user reinstalls OS and wants to preserve all settings <g>.

Try it one day. This is all-time experience.

June 30, 2003

It seems to be the best security blog available: joatBlog.

Top discovered link is a masterpiece called Caring for Your Introvert.

Top discovered security link is a Practical Approaches to Recovering Encrypted Digital Evidence. One clarification: quantum cryptography is to prevent eavesdropping at all.

July 1, 2003

"For R12 and R13 installations, you must run MATLAB at least once as Administrator after installing the program. After running the program, all users should be able to run MATLAB, regardless of their priveledges. This is neither a bug or a feature of MATLAB at this time." <ggg>

July 1, 2003

Path: HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\BitBucket\NukeOnDelete

What do you think Registry Monitor shows me here? Traces of trojan, spyware or virus? No, it's standard Recycle Bin working while one of my apps runs. Stunning work.

July 3, 2003

Exception Management Architecture Guide. "This document discusses design and implementation guidelines for exception management systems that use .NET technologies. It focuses on the process of handling exceptions within .NET-connected applications in a highly maintainable and supportable manner."

What interesting is the exceptions in distributed applications and logging for maintainability. So, you can skip the basics (try, catch, finally) and start right from a Gathering information.

July 3, 2003

I found that my Rubik's Cube binaries on the Code page don't include required ISE.Runtime.dll and I re-uploaded them. Now I have MS Visual Studio 2003 + Eiffel ENViSioN! 1.2 and I'll try to finish this project with something more useful and robust.

July 3, 2003

"TestComplete should be installed and used under the same account and this account should be set to administrator ... Perhaps, the situation will be changed in one of the future versions, but not anytime real soon." Bobby Edgar, AutomatedQA.

I don't want to work as admin and I don't have any alternative to TC. To think about...

July 8, 2003

I have Activity Recorder running for 1 month now and today I wrote a program to process accumulated data. Here is the results: Most important is that I don't have to be distracted to gather this (interesting) statistics.

July 16, 2003

Programming Rubik's Cube is exciting, if hard. To organize my Envision discoveries, I put it to Using Eiffel ENViSioN! for .NET development on my new Writings page.

July 19, 2003

.NET Desktops gallery hosted by Roy Osherove. One more way to learn from others. I'll post my picture when it will be open for submissions again (i.e. in 2 weeks).

Found via Brad Wilson's blog.

July 20, 2003

The Scriptomatic Tool - rocket start to WMI. This program "can return information for most of the interesting WMI classes on a local or remote computer" via auto-generated VBScript code, that you can copy to your application.

July 23, 2003

Rubik's Cube intermediate release 2 is ready in Code section. It even solves sometime.

Besides Eiffel and Direct3D, I learned how not to optimize unrefactored code.

July 26, 2003

Mike Clark presented Continuous Performance Testing With JUnitPerf article recently. I also did performance testing in several projects, I see a room for improvements in this generally unexplored area and I'd like to discuss it.

Simplest approach to optimize good working code is:

Problems with profiler:

Problems with performance tests comparing to functional tests is in their non deterministic nature: So, we should try to replace profiler with performance tests (it should be as good as replacing debugger with functional tests), but PTs require additional infrastructure (comparing to functional tests) which should be included in unit testing framework. Proposed enhancements include: It's important to split performance and functional tests, i.e. do not check results of executeHotspot() function: This is my view on a problem. I hope I'll also write about solution one day.

July 26, 2003

Site update. I renamed Books section to Reading as more appropriate.

July 27, 2003

My desktop in the gallery.

July 28, 2003

On March 17 I posted a link to Change Your Organization Diary. Since then project has evolved and now we additionally have end of March, April, May and the end.

July 31, 2003

"... I was convinced that being able to separate what is important from noise was the main task of an engineer, and also that of a physicist. If you take into account all the factors that are involved into a certain real situation then calculations quickly become cumbersome and meaningless. Yes, meaningless, because very big formulas are very good at hiding what is really going on.

... you have to know what to leave out of your model, what to approximate. Maybe latter you will add a little something to the model and your results will get better; but now you already understand what is going on.

... abstraction is the key to being a better engineer. At least for me. Abstraction is a process by which what is important in some situation is separated from what is not important."

Radu Grigore, Notes 0001.

August 1, 2003

According to Microsoft Developer Tools Roadmap 2003-2005, next year Visual Studio code name "Whidbey" will include:

"As projects increase in sophistication, programmers often need a means to better reuse and customize existing component-based software. To achieve such a high level of code reuse, programmers typically employ a feature called generics. In Whidbey, the CLR will include a type-safe, high-performance, compile time-verified version of generics which differs slightly in syntax and greatly in implementation from templates as found in C++ and generics as proposed for the Java language. Generics allow developers to author, test, and deploy code once and reuse that code for a variety of different data types with negligible performance impact to applications. The CLR implementation of generics will also reduce code bloat when compared to other strongly-typed implementations, leading to more readable and maintainable source. Microsoft currently plans to support both the creation and consumption of generics in C#.

In addition to improving code reuse, Visual C# will eliminate some chaotic chores often associated with coding, such as implementing enumerator patterns. Iterators are constructs that dramatically simplify this task. Based on similar features in research languages such as CLU, Sather, and Icon, these constructs make it easy for types to declare how the foreach statement will iterate over their elements. Rather than having to create the classes and build the state machine for manually implementing the enumerator pattern, the C# compiler will translate iterator code into the appropriate classes automatically.

Anonymous methods are practical language constructs that will allow C# programmers in the Whidbey timeframe to create code blocks that can be encapsulated in a delegate and executed at a later time. They are based on a language concept called a lambda function and are similar to those found in Lisp and Python. Anonymous methods are defined dynamically at the point where they are used, rather then being pre-defined as a named method of a specific class. Anonymous methods make some types of operations more convenient, particularly when the method signature or body needs to be changed at run time."

Visual Studio + C# is already extremely (short term) productive environment. Now C# is moving towards long term projects, while VB.NET stays for simple tasks. Do not underestimate MS Language.

August 7, 2003

At last, I tried VS 2003 on my main C++ project. Conversion from 7.0 compiler to 7.1 was very easy. It required only a little patch for boost::format (from Boost v1.30) and changes in my std::auto_ptr usage style. Visual Assist still rocks, configuring it I've found new usage for some old facilities and now it also auto completes files in #include clause and supports other languages than C++ (primarily C#).

Porting my custom wizards from VS 2002, I wrote a tutorial Custom wizards in MS Visual Studio 2003 for C++ projects.

August 12, 2003

I think it's enough for me to solve Rubik's Cube. Simple 4 steps look ahead + intelligent weight function just doesn't work. And I don't have any interest to implement complex algorithms required .

This experiment helped me a lot to try Eiffel language. I never thought those beautiful constructions are so hard to use. Lack of free functions and even static functions in classes; inconvenient loop with increment in a body, not in a header; embarrassing implementation inheritance, not composition; no enums; slow general functions like deep_clone and is_equal.

Nice features are, of course, native DBC; general functions like deep_clone; general persistence facilities. I have plans to finish OOSC and online future Eiffel book draft, then will come the final opinion.

So far, I've put release candidate executable in Code section. Now program has separate thread for processing, less delay between moves, ability to rotate cube planes from keyboard.

August 14, 2003

Hierarchies. Top-down decomposition. Divide and conquer. Does it make access to data easier?

Look at MSDN library, what do you use to read about some function? Contents? No, it's index. Look at file system, what do you use to open usual programs or files? File manager, Start menu? No, it's TypeAndRun or desktop/quick launch shortcuts (if it doesn't hurt your aesthetics). Look at writing, what do you use to save a file? File - Save? No, it's Ctrl+S.

The point is that all these intermediate layers are slow and unnatural. Natural way is 1 to 1 mapping (if I want to turn power off, I press Sleep button, I don't go to Start - Shutdown - ...).

How it relates to programming? Well, every programmer knows that most instant access is through global variables <g>. Strive for great names, prefer direct objects collaboration.

Next time you will structure, try to look further.

August 16, 2003

User Stories Applied for Agile Software Development book draft by Michael W. Cohn. This is work in progress and it covers user stories, requirements, planning, users, acceptance testing, XP and SCRUM. Everything is quite familiar for experienced XP reader. What particularly good in this book is a classification of users and separation of users from customers, managers and other not-a-real-users.

I wish I would find something about agile documentation. Besides the code, I see a need for:

1. Acceptance tests documentation for developers. Tests code is not enough, because:

2. User guide for users and developers.

3. Short presentation (overview) for newcomers.

1 and 2 directed to preserve information, while 3 - to transfer it.

Michael also wrote an interesting small article on resource validation Configuration Bugs That Bite. Not that two solutions offered looks very appealing, but the point is to pay attention to this problem.

August 21, 2003

Programming made easier. Today, without any previous experience, I've wrote windows service, that maintains performance counter representing current HDD temperature. As access to performance counters from VBScript kind of complicated, I've additionally created separate WMI class and finally got it from vbs.

Documentation, frameworks and IDE from MS are programmers' best friends.

I would publish this app, if some settings were not hardcoded for my personal configuration. If anyone has interest, feel free to contact me.

August 23, 2003

Deep Windows insights in Raymond Chen's blog.

August 30, 2003

Thinking about Proof vs Test (as in recent discussion in comp.object), sure, good proof guarantees better implementation than good tests, but there are other things that we are interested in software development - primarily design (managed complexity) and system evolution.

As of today, proofs are manual, while tests are automated. That makes tests more preferable for evolving systems. Tests (TDD) also help in design, making it more simple.

Now, what about other practices? What about DBC? DBC clearly is a design technique and automated almost as well as the tests. More interesting is that DBC also facilitates automated proof and simplifies implementation along with the tests.

Looking into the future, I see the needs for more design and more flexibility. Spreading DBC principles now is the right thing to do.

August 31, 2003

Bertrand Meyer's "Object-Oriented Software Construction" Second Edition. What makes this book so great?

It also has some limitations - an applicability of OO in general, Eiffel in particular and year of publication (1997) in excuse.

All in all I highly recommend to read it.

Now I'm going to finish "Improving Web Application Security: Threats and Countermeasures" . Then I'll read ongoing work on future third edition of "Eiffel: The Language" by Bertrand Meyer. It's available here (username is "Talkitover", password is "etl3").

I've decided to list electronic versions of books in my Reading section. From the past reading I've included "Programming Applications for Microsoft Windows" Fourth Edition by Jeffrey Richter.

September 1, 2003

"Improving Web Application Security: Threats and Countermeasures" by Meier, Mackman, Vasireddy, Dunner, Escamilla and Murukan. Title is quite misleading, I would call it "Modern Windows Security: The Complete Guide". This book covers everything from TCP/IP to Web Services, from Registry to Isolated Storage, from ASP.NET to SQL Server, from code review to deployment. It uses theory (assets, vulnerabilities, threats, attacks and countermeasures) and practice (code examples, checklists, tools).

Why my current work doesn't have anything with security? <g> For those like me, I can recommend to read about code access security in .NET (security relations between assemblies) and DPAPI (W2K encryption API that uses the user's logon credential).

I've restricted my reading plans in Reading to a bare minimum and added my first XP book "XP Installed" to recommended part.

September 7, 2003

I found rubik solver in Amzi! Prolog + Logic Server samples. Core engine was written in Prolog by Dennis Merritt, but this product offers interfaces to other (modern) languages. So, my project got a new hope to be useful.

Release candidate 2 (see Code section) is now finally able to solve the cube, more fast and less memory hungry. The only thing left is the code cleanup. I'm also interesting how it works on the other computers - your feedback is welcome.

I'm also using NUnit 2.1 now, but there are hardly any useful features for me comparing to 2.0.

September 9, 2003

Added links to .NET Framework 1.1 and DirectX 9.0 to Code - Rubik's Cube section.

September 11, 2003

My Cube demo drops 300 frames for 60 seconds run at 100 fps. I thought it was .NET garbage collection.

There is a great tool CLR Profiler that you can read about and download from these 2 articles: Writing Faster Managed Code: Know What Things Cost by Jan Gray and Writing High-Performance Managed Applications : A Primer by Gregor Noriskin. It allows you to see life of every object in your application and it fast. When, for example, AQTime slows my demo by a factor of 10, CLR Profiler runs it almost in real-time.

CLR Profiler distributed in source code and you have to build it for yourself. I recommend to change its temporary directory from %WINDIR%\TEMP to something more appropriate (e.g. %TEMP%) and fix 2 bugs in ReadNewLog.cs (it fails when loading large logs with IndexOutOfBounds error).

You should run CLRProfiler.exe under Admin account. I recommend to turn off Calls tracing, otherwise log file size will be very large and processing will be slow. Most interesting analysis view is Time Line, which shows heap and work of garbage collector.

Well, GC is bad for applications like my demo. It could run anytime, stopping all other threads in (simple) application for 10 - 50 ms (1 - 5 frames). The only way to "control" it is System.GC class with Collect method, which doesn't even guarantee to compact heap (the most time consuming operation in GC cycle). But as GC runs only once in 5 seconds and compacts heap only once in 20 seconds (according to CLR Profiler) it can't drop more then 30 frames.

The real problem with performance turned out to be dependant on window size. With window of 400*400 pixels I had 300 frames dropped, increasing it to 600*600 I got 500 dropped frames. It doesn't depend on rendered scene complexity, so I think it's just raw video/memory/bus speed when copying frame buffers. I made a little tweak changing SwapEffect from Discard to Flip (it reduced drop count in large resolutions for 20%-50%).

Finally, I reduced default window size to 300*300 (100 dropped frames in 60 s) and considered it done.

BTW, a one way to measure frame rate in DirectX applications is Fraps utility. Although, Trace.WriteLine + DebugView is a way more flexible <g>.

September 14, 2003

Rubik's Cube release candidate 3 is ready. Just one more step.

September 19, 2003

Coders Baffled by Satisfied Client from BBspot. Yes, it relates to programming <g>.

September 20, 2003

When you Add Reference to your C# application in VS IDE, components in main list is not from the GAC. E.g. you may have DirectX 9 runtime installed and Managed DirectX libraries in the GAC, but you would not see it in VS.

To workaround this problem you can add key like this one to the registry:
@="F:\\WINDOWS\\Microsoft.NET\\Managed DirectX"
(you can point to any directory and use any key name AssemblyFolders\My Key).

Then copy your dll files (like Microsoft.DirectX.DirectSound.dll) to this directory.

September 20, 2003

Reading on XP brings me less and less new information and I decided to stop. There are lot of other topics to master. My current interests are .NET, security, Eiffel and C++. I also very interested in functional languages and formal program verification, but I plan to study it later.

I feel myself obliged to update Links section.

Refactoring, Extreme Programming and Test Driven Development are gone from my Yahoo! Groups. comp.soft-sys.matlab is gone from my Newsgroups - my Matlab project successfully finished 3 month ago.

Dale H. Emery added to Weblogs. Psychology is also one of my interest. The only reason I didn't link to Dale earlier - is that I though everybody knows about his page anyway.

Craig Andera, Raymond Chen, Brad Wilson, Chris Sells and Roy Osherove are added to .NET/Windows Weblogs. I posted links to them, so you should have your own opinion already.

Added to Security Weblogs: joatBlog - you know him, A Day In The Life Of An Information Security Officer - great investigation stories, two .NET security blogs by Ivan Medvedev and Greg Fee.

Management Weblogs section consists of two blogs by Johanna Rothman and one by Esther Derby

Two Yahoo! Groups added: Windows Technical: Off Topic - unofficial discussions in great company, Eiffel Software User list - Eiffel developers list.

3 lists from on .NET: ADVANCED-DOTNET, DOTNET-CLR and DOTNET-CX. I didn't try appropriate .NET newsgroups, but I think that signal/noise level in these lists is a way more better.

Two newsgroups added: comp.lang.eiffel and (recent testing tools news).

Some blogs that I read, but didn't link: Martin Fowler's Bliki - it doesn't match my interests. Michael Feathers, Ron Jeffries and Christian Sepulveda started their blogs, but don't post much. And I recently discovered Pete Kruckenberg's Perfect World.

I don't read Troy Jessup's Security Blog, but it's the most beautiful one that I've seen.

On front page I now describe this site contents as my software engineering experience.

September 25, 2003

I've updated my Using Envision article given more experience and more answers from Emmanuel Stapf [Eiffel Software]. New topics:

September 25, 2003

C# Future Features - VCS Language Changes.doc.
// Generics:
Stack<int> stack = new Stack<int>;
// Constrained genericity:
public class Dictionary<KeyType, ValType> where KeyType : IComparable
// Implementation of iterator interface for class developers:
public class ThreeElementsList
        public string foreach()
                yield "microsoft";
                yield "corporation";
                yield "developer division";

public class List
        internal object[] elements;

        public object foreach()
                foreach(object o in elements)
                        yield o;
// Anonymous methods:
public class MyForm
        ListBox listBox;
        TextBox textBox;
        Button button;

        public MyForm()
            listBox = new ListBox(...);
            textBox = new TextBox(...);
            button = new Button(...);
            button.Click += new EventHandler(sender, e)
See also little discussion on this document and Design and Implementation of Generics for the .NET Common Language Runtime paper by Andrew Kennedy and Don Syme.

September 26, 2003

Differential Testing for Software by William M. McKeeman. Mostly, it's about random tests construction and test reduction. Test reduction is particularly interesting, although I don't know is it practical enough to apply on conventional (not random) code.

September 26, 2003

Following Comeau, Dinkumware now also has online C++ code test compiler - Dinkum Exam?.

September 27, 2003

Using Software Restriction Policies to Protect Against Unauthorized Software - you can prevent Windows (not .NET) applications to run based on their hash, path, certificate or zone. Make sure to restart your file manager or command line after policy update, as "only new programs started will enforce the policy".

It's not as powerful as .NET CAS, but certainly useful.

September 28, 2003

You can click on my favicon.ico and your browser will remember it as icon for my site, probably.

October 2, 2003

Cube demo RC4 is ready. I changed "engine" from "turn based" (events run as fast as your machine can handle) to "time based" (events run according to timer). It allows cube to run with same speed on all computers and slow processing leads to low frame rate, not to slow movement. There are also improvements in performance monitoring, code quality and documentation.

October 2, 2003

If you use eiffel.el with MS Visual Studio for Eiffel code formatting, I recommend to change eif-indent-increment to 4 (default is 3) as in VS tab is 4 spaces long and previous discrepancy formats multi-line function calls wrong:
You can also set eif-body-comment-indent to 1 (default is 0) to shift comments off the code.

October 10, 2003

Bertrand Meyer's ongoing work on "Eiffel: The Language. Third Edition". It's the only source of information on modern Eiffel facilities: tuples, agents, implicit conversion between types. And, of course, it also thoroughly discuss other (basic) features.

It's a great complement to OOSC. OOSC concentrates on design, while this book concentrates on programming. So, read first OOSC and then this book.

As it's a language reference, it's not always very entertaining. Parts of the book are still not finished and last update was 1 year ago. But you just have no other choice. You, as general Eiffel developer, can't get this information from other sources. And it's still has quality of Bertrand Meyer's work.

I am more comfortable with Eiffel now. When I've been reading OOSC it was mostly what I can't do in Eiffel, but ETL3 shows that Eiffel is quite practical and contemporary. Eiffel was one of the first languages with support of .NET and Eiffel Software still actively develop new tools and environments, offering free editions as well.

While Eiffel community is extremely small and Eiffel job market behaves accordingly, the language is quite unique/capable to justify its study. Meanwhile, I have 3 more weeks to finish and send my Cube demo to Eiffel Class Struggle 2003.

I recently received latest Bruce Schneier's book "Beyond fear" and Harry Beckwith's "Selling the invisible". It will be my current reading for now.

October 20, 2003

I tried to use VMware 4.0.5 to tests my Cube demo compatibility with Windows 2000 and 2003. Direct3D did not work under emulation. I mean, W2K virtual machine + DirectX 9.0b retail (redistributable) runtime + Managed DirectX demo + Reference DeviceType = Can't create Direct3D device.

It's not new. The news is that when I installed DirectX SDK Summer update on virtual machine it began to work. You don't have to install full SDK, Install DirectX Runtime + Install Additional Runtime Debug Files is enough.

Then I tried the same trick with the original (old) DirectX SDK and yes, it also works.

October 22, 2003

Cube demo v1.00 binaries (1 MB). It still requires .NET 1.1 and DirectX 9. New features: fullscreen mode, wireframe mode, cube maintains proportions when changing window size, option for black background, option for software rendering.

Source code will be released later.

October 27, 2003

Jeffrey Richter's "Applied Microsoft .NET Framework Programming". Assemblies, reference and value types, constants, properties, events, enumerated types, attributes, delegates, exceptions, memory management, reflection, fundamental patterns (convertibility, equality, cloning, disposing).

This book focuses on IL level and also describes how many of C# language constructs maps to IL code. It's very useful for non C# developers.

No threads, no interoperability with unmanaged code, no remoting. Written style is good, but nothing special.

Overall, book is good. It's my first CLR book and I've learned a lot.

.NET lost several points in my eyes - lack of good design is obviously clear. Programming in C# without generics and multiple (implementation) inheritance requires to write a lot of duplicate code. Things will be better in Whidbey (C# 2.0), but then we will also have revisited MC++ (see also Ecma International Moves to Standardize C++ Binding for CLI) and, probably, Eiffel Envision 3.0 <g>.

October 29, 2003

Bruce Schneier's "Beyond fear". Security trade-offs, examples, analysis, statistics.

If you read Bruce, you will admire this new book. He doesn't repeat himself and writing is excellent.

If you don't know Schneier and security, well, each of his books is a right place to start.

October 30, 2003

Harry Beckwith's "Selling the invisible". Service marketing.

Services are different from products (we don't use them often, they are more hard to evaluate, we can make most of them yourself).

While focusing on marketing, the first thing this book suggest is to improve your service. Then it talks about naming, pricing and other visible things which make image of service in prospect mind.

The book is very small and reminds me "UML distilled" - lots of practical and smart suggestions, touching broad topics (all very relevant) and staying in focus, citing examples and other books.

Software development is service, especially when you use XP model. That was the reason I bought this book. But it gave me more - broader view on not obvious (but important) market aspects.

October 31, 2003

"Peopleware" (Second Edition) by Tom DeMarco and Timothy Lister.

Book for managers, not for me.

November 1, 2003

One of my favorite tools, CLR Profiler (memory usage profiler for .NET applications) was updated recently (10/28/2003).

New in version 1.1: Still, you (like me) probably would like to:

November 8, 2003

Nicolai Josuttis's "The C++ Standard Library". Utilities, containers, iterators, functors, algorithms, strings, I/O, internationalization, allocators.

Excellent balance between tutorial and reference, readability is very hight. Code examples for almost everything. Library internals revealed to facilitate understanding. Hard answers to practical questions included (components thread safety, errors in standard, typical standard implementation that you can rely on).

Some parts of the library were of less interest to me (I/O, alocators, numerics), but without this book I would not know what I don't use. German accent is noticeable and a little disturbing (for me, non native English reader).

It considered to be the best book on the subject. I concur.

November 12, 2003

I'm ready to design my own file manager.

Here it is - SurF. It's not a product (I've worked on it for only 3 days), but a statement.

November 15, 2003

C++ blogs, finally:

November 16, 2003

Advanced Programming By Contract: Designing for Correctness and Extending a Method of Devising Software Contracts by James McKim.

November 16, 2003

Herb Sutter's "Exceptional C++".

First of all, it's not just a reprint of C++ Guru of the Week - it's a new (very readable) book.

For such a complex language as C++, books like this one is an excellent opportunity to refresh (and correct <g>) your knowledge.

November 18, 2003

SurF version 0.12. New features: While it's my default file manager from now on, I recommend you to wait for more stable release.

November 21, 2003

Herb Sutter's blog.

November 22, 2003

Investigating .NET Languages by Jason Bock. C#, VB.NET, MC++, Eiffel.NET and SML.NET mapped to CIL.

Good article on very interesting for me subject.

Found via Darrell Norton's blog.

November 29, 2003

Overeaters Anonymous: Exceptions, Part II by Marc Miller (nice weblog, BTW).

I'll give you my example.


Allows to create directory.

Go to Temp directory in Surf.
Press F7.
New directory dialog should appear with focus in edit box.
Type abc and click OK.
Surf should browse to empty Temp\abc directory.


void FileListView::keyDownHandler(System::Object* sender, WinForms::KeyEventArgs* e){
    if (e->KeyCode == WinForms::Keys::F7){
       NewDirectoryDialog* dialog = new NewDirectoryDialog();
       if (dialog->ShowDialog() == WinForms::DialogResult::OK){
           System::String* dir = System::IO::Path::Combine(directory->FullName, dialog->directory());

void makeDirectory(const std::wstring& dir){

Now, let's focus on makeDirectory. First of all, sometimes it will not be able to create directory (because of wrong name or read-only device) and it's not exceptional scenario. So, I better change its name to tryMakeDirectory. To see how exactly CreateDirectory could fail let's look at MSDN:

.NET Framework Class Library
Directory.CreateDirectory Method
Creates all directories and subdirectories as specified by path.

Parameters path The directory path to create.

Return Value A DirectoryInfo as specified by path.

Exception Type Condition
IOException The directory specified by path is read-only or is not empty.
UnauthorizedAccessException The caller does not have the required permission.
ArgumentException path is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.
ArgumentNullException path is a null reference.
PathTooLongException The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.
DirectoryNotFoundException The specified path is invalid, such as being on an unmapped drive.
NotSupportedException Creating a directory with only the colon (:) character was attempted.

These are two type of exceptions: invalid argument exceptions and IO exceptions. Minimally designed system should make arguments requirements explicit, but with .NET we should devise it ourselves. And there is the third exceptions type: CLR exceptions (like System.StackOverflowException, System.OutOfMemoryException, System.ExecutionEngineException) which could occur any time.

Following (my) good practices I should ensure function arguments requirements (eliminating ArgumentException, ArgumentNullException, PathTooLongException, NotSupportedException), catch and process IO exceptions, let CLR exceptions go through up to the call stack.

How I can "ensure function arguments requirements"? There is no ValidatePath. If I try to create it from "Condition" statements, then documentation to Path.InvalidPathChars says: "This array is not guaranteed to contain the complete set of characters that are invalid in file and directory names." Bad luck.

My current code is:

bool FileListView::tryMakeDirectory(const std::wstring& dir){
     bool result = false;
     System::String* error;
        result = true;
     } catch(System::IO::IOException* e){
        error = e->Message;
     } catch(System::UnauthorizedAccessException* e){
       error = e->Message;
     } catch(System::NotSupportedException* e){
       error = e->Message;
     if (!result)
         WinForms::MessageBox::Show(error, (L"[Surf] Error creating " + dir + L" directory").c_str(), 
                                    WinForms::MessageBoxButtons::OK, WinForms::MessageBoxIcon::Warning);

     return result;

Explanation. PathTooLongException and DirectoryNotFoundException inherit from IOException. ArgumentException "should not be possible" as I use PathCombibe to make dir. ArgumentNullException is not possible as I pass non NULL.

But having said all that I'll probably go back to Win32API for this use-case (boost::filesystem doesn't support wide strings, yet).

Root of the problem, of course, is not in exceptions. It's just CreateDirectory should not throw anything: it should assert path validity and return error code for runtime IO problems.

BTW, Eiffel .NET developers have even more fun missing(?) direct catch filters. Code looks like:

feature try_make_directory(dir: STRING): BOOLEAN is
      exception_occured: BOOLEAN
      error: STRING
      if not exception_occured then	
         feature {SYSTEM_DIRECTORY}.create_directory(dir)
         Result := True
      if last_exception_type.is_equal("System.UnauthorizedAccessException") then
         exception_occured := True
         error := tag_name		

feature last_exception_type: STRING is
        e: EXCEPTION
        e := feature {EXCEPTION_MANAGER}.last_exception
        if e /= Void then
           Result := e.get_type.full_name
           Result := ""	
        Result /= Void

December 1, 2003

Updated my Resume. New features <g>:

December 2, 2003

SurF version 0.18:

Code is clear and stable now. NUnit doesn't work with MC++ assemblies and I didn't find a solution for it. So, I don't have a single unit test yet. It's quite interesting experiment to develop without UT. Although, this program has almost zero logic. Of course, I have lots of acceptance tests. And I use DBC. Assertions without doubt change my design, I don't think unit tests would change it the same way. Without UT I have to run program more often for manual testing, this is bad. But again, for GUI and API interactions UT doesn't fit well anyway.

December 9, 2003

C++ Standard Working Group selected papers:

December 12, 2003

SurF version 0.22: Concerning "empty tab" bug. It's when I have a tab open on SurF project directory and develop in VS, after some time this tab becomes blank. As it's absolutely harmless and a little mystique, the bug is still here.

December 14, 2003

Eiffel ENViSioN! 2.0 is now released. December 9th, 2003 (41 MB) download.

December 18, 2003

Ever wondered at System.Drawing.Color names? How are Beige, BurlyWood, Linen look like?

Color Names page will show you.

December 18, 2003

Rubik's Cube version 1.20: For those of you interested in source code - I use Envision 2.0 now and you will find a lot of improvements (especially as I didn't release v1.0 code).

This release doesn't properly indicates missed cube resources.dll, hiding mouse cursor works awfully with dialogs, debug build doesn't indicate not installed DirectX and debug build has serious issues with HIGH_RESOLUTION_TIMER. But if you just watch the demo (as a good user <g>) you shouldn't care about it.

Concerning HIGH_RESOLUTION_TIMER. I use QueryPerformanceCounter Win32 API function directly from Eiffel now (previous versions used it via intermediate C# library). And I have a small example which (maybe not deterministically, but 100% reliably) reproduces memory corruption in Debug build (can't reproduce for Release build). Eiffel Software has no answer why it happens and whether it is the problem with Eiffel compiler or not. If it wasn't just a demo I would revert back to C# library.

December 18, 2003

Probably it's a little early to talk about my experience in Envision 2.0, but I can't leave my article in Envision 1.2 state.

So, what I found most useful in 2.0:

1. Name overloading.
You can write create {VECTOR_3}.make(x, y, 0) now instead of create {VECTOR_3}.make_from_value_x_and_value_y_and_value_z(x, y, 0).

2. Lots of (small, but nasty) bugs fixed.

That's all. Thus, I would call it maybe version 1.5, not 2.0. But it's my (inexperienced and narrow) personal opinion.

You can read more about improvements here (it is Eiffel Studio online documentation). Not news, but other useful link is External features, also missed in Envision docs.

Not all is fixed in v2.0 unfortunately:

1. I had problems with installation and References browsing doesn't work on my non-admin account. But on other machine with Windows 2003 it works fine for casual User.
2. Jump from Find in files doesn't work any more.
3. Expanded still doesn't supported.

All in all, it is a step forward. Envision team gives us free version of the real Product for .NET development in Eiffel. They are extremely responsive on (our) user feedback and just need a little more time.

December 18, 2003

Herb Sutter's "More Exceptional C++".

I like it even more than the first book. While first book sometimes goes to dark corners of C++, this book is practical from the first page to appendices. It is also 64 pages longer :)

December 20, 2003

Scott Meyers's "Effective STL".

You can't read to much about C++. Scott brings out a lot of STL usage/performance details and explains them extremely well.

December 21, 2003

The "Empty Tab Bug" unveiled:

__gc class FileListView{

      new System::Threading::Timer(new System::Threading::TimerCallback(this, timer_handler), this, 1000, 1000);

void timer_handler(System::Object*){
	Invoke(new TimerDelegate(this, on_timer_in_UI_thread));

void on_timer_in_UI_thread(){
	if (fileWatcher->any_changes() && tabManager->is_tab_selected(parentTab)){
		std::vector<FilePath> entries = directory_contents(current);
		for (std::vector<FilePath>::const_iterator i = entries.begin(); i != entries.end(); ++i){
			FilePath fullFileName = path_combine(current, *i);
			add_list_item(i->cli(), file_icon(fullFileName, BackColor), file_color(fullFileName));


System::Drawing::Color file_color(const FilePath& file){
	System::Drawing::Color result = System::Drawing::Color::Black;
	System::IO::FileAttributes a = System::IO::File::GetAttributes(file.cli());
	if (a != -1){
		if (a & System::IO::FileAttributes::Hidden)
			result = System::Drawing::Color::DarkGray;
		else if (a & System::IO::FileAttributes::Encrypted)
			result = System::Drawing::Color::Green;
		else if (a & System::IO::FileAttributes::Compressed)
			result = System::Drawing::Color::Blue;
	ENSURE(result == System::Drawing::Color::Black || result == System::Drawing::Color::DarkGray ||  
		result == System::Drawing::Color::Blue || result == System::Drawing::Color::Green);
	return result;
As timer fires from separate thread, we need to marshal this call to UI thread (via Invoke) and only from UI we actually perform list update. InvokeRequired helps us do not forget about it.

The question is "Why list sometimes stops to display any contents while everything else works fine?".

The answer is "Because GetAttributes throws when it can't find the file". Why I don't handle it? Because MSDN says:
File.GetAttributes Method 
Return Value
The FileAttributes of the file on the path, or -1 if the path or file is not found.
OK, it throws, but why "everything else works fine"? Where is this exception gone? Exception goes from file_color to on_timer_in_UI_thread to Invoke and finally to timer_handler. Remember, timer_handler is in separate from UI thread. So, exception silently kills timer thread and "everything else works fine". While without EndUpdate list doesn't display anything anymore.

The lessons are:

December 21, 2003

Reading "C++ Templates" on Precompiled Headers:

"... it is usually relatively straightforward to create a header file named std.hpp that includes all the standard headers:

#include <iostream> 
#include <string> 
#include <vector> 
#include <deque> 
#include <list> 
This file can then be precompiled, and every program file that makes use of the standard library can then simply be started as follows: #include "std.hpp"

Normally this would take a while to compile, but given a system with sufficient memory, the precompiled header scheme allows it to be processed significantly faster than almost any single standard header would require without precompilation. The standard headers are particularly convenient in this way because they rarely change, and hence the precompiled header for our std.hpp file can be built once.

Some committee members find the concept of a comprehensive std.hpp header so convenient that they have suggested introducing it as a standard header. We would then be able to write #include <std>. Some even suggest that it should be implicitly included so that all the standard library facilities become available without #include."

Never before I heard about this approach (to precompile standard headers) from a distinguished C++ experts like David and Nico. And yes, it makes total sense. I immediately made three files for SurF: std.h, boost.h and platform.h (Windows and .NET stuff). All plus dbc.h included in stdafx.h.

It significantly reduced #include clutter in .cpp file headers. (Total rebuild time was also reduced from 30s to 21s).

I also, finally, added strings like #using <System.Windows.Forms.dll> to platform.h. It was necessary for VC++ 7.0, but 7.1 doesn't require it anymore. I added them to enhance Visual Assist intellisense capabilities, that turns out still depend on #using includes.

December 25, 2003

SurF version 0.24: It looks like version 1.00. I implemented all basic functionality and there is no bugs left.

December 29, 2003

Received new books:

December 29, 2003

"Thank you for participating in the beta test program for Eiffel ENViSioN! 2.0 ... We also would like to announce that Sergey Vlasov is the winner of the beta-test program. He reported the highest number of high quality bug reports. As such he will receive a free copy of Eiffel ENViSioN! 2.0."

There is a lot of power inside this box.

January 3, 2004

"C++ Templates: The Complete Guide" by David Vandevoorde and Nicolai Josuttis.

The title of the book ("... we found a dearth of literature that concentrates on the fundamental concepts and advanced techniques of [templates]") and authors (distinguished C++ experts) make any additional recommendations to read unnecessary. It's all about argument deduction, specializations, instantiations, names look up, metaprogramming, etc, etc.

But even more valuable is an application of these rules. Descriptions for Barton-Nackman trick, empty base class optimization, curiously recurring template pattern, expression templates, SFINAE principle. Lots of examples and future directions of C++ language.

What an indispensable book for modern C++ development.

January 4, 2004

"Pattern Hatching" by John Vlissides.

Patterns usage and development by example. I don't see patterns usage to be challenging and patterns development to be actual for me.

On the good side, this book describes Generation Gap pattern that recommends encapsulate automatically generated code (by GUI wizards, script preprocessors) in separate class and provide handwritten behavior in class that inherits from it. I think this is the right thing to do (although I can't evaluate it as I don't use wizards).

Overall, this book was not of much value for me.

January 4, 2004

Another colors reference (now in alphabetical order, better for search and offline storage): C# Color Name Table by Joseph Newcomer.

See also his Win32 to .NET map: C# for MFC programmers Quick Equivalents Map.

January 12, 2004

Working software today and tomorrow

slogan is added to the front page.

January 13, 2004

"Windows Forms Programming in C#" by Chris Sells.

Forms, dialogs, drawing, printing, controls, design-time integration, resources, data binding, multithreading, web deployment, serialization. "Parts of this book have explored sections of the framework that are completely outside the System.Windows.Forms namespace because you need that knowledge to build real WinForms applications."

"... this book does a great job of hitting a huge number of features". It was great for me as a second book on .NET (after Richter's on CLR fundamentals). Such (pure technology) overviews are very useful for starters. But if you are experienced .NET developer or reader (Chris wrote lots available online and in MSDN), this book would be a less valuable.

January 14, 2004

A Shareware Life blog by Thomas Warfield. Shareware business model, marketing, games development. One more way to make money.

Found via Dana Epp's (security) blog.

January 14, 2004

SurF version 0.25:

January 24, 2004

Learning from mistakes: the Don Quixote pattern story by Roy Osherove. "... no initial time estimation was expected of me. After the couple of days were over I went to my team leader and said that I am still investigating the various ways in which this would be possible to do."

It is so easy to create environment where having a problem is only your problem. Where it is so desperate for you to get stuck. This is the scenario I afraid most from a new job, and unfortunately it is real.

It is so easy to create environment where that couldn't happen. Where you work in pairs. Where business objectives don't allow you to spike for more than a day or two. Where you can leave the problem to your subconsciousness and return to it later.

It is not very easy to make the right choice, to not make a mistake.

January 27, 2004

"The Common Language Infrastructure Annotated Standard" by James S. Miller and Susann Ragsdale.

I expected to learn IL code and better understand .NET principles. Unfortunately: Sure, this book provides good overview. Emphasizes correct terminology. Describes IL coding. But for programmers in high level languages it's almost useless.

It's important for application developers not to concentrate on (MS) technology too much. So, I recommend to look for a more concise source on the topic.

January 27, 2004

Static Verification and Extreme Programming paper by Peter Amey and Roderick Chapman from SPARK team.

Reminds us that automatic code analysis is possible, if we write contracts and have verifiable coding standard.

January 29, 2004

Digital Mars introduces the first C and C++ compiler to support contracts

February 5, 2004

Eiffel Class Struggle 2003 results and submissions code. I'm only 11th. It would be very interesting to see judges' comments as well. I hope they will let us learn from 3 judgment months.

February 11, 2004

"Managed DirectX 9 Kick Start: Graphics and Game Programming" by Tom Miller. Lots of Direct3D from points to vertex and pixel shaders, sound, input devices, 2D graphics, networking, audio and video playback.

Tom is the development lead for MDX and blogger. In this not a very big book he touched plenty of topics. Most of the book contents are comments to enclosed examples. Examples are very illustrative and essential for such a complex API as DirectX.

On the dark side, this book is small enough to go in depth. Has as a target audience intermediate level programmers - comments are often excessive. Code quality is not high - code duplication particularly bad in printed form.

Overall, it's a best MDX overview book so far. Very interesting for hobbyists. For 3D specialists it's perhaps too simple. Non-game developers probably should wait for a more mature 3D API.

February 11, 2004

There are no signs that all judges' comments for Eiffel Struggle 2003 going to appear. At least, I can post my personal score (separate page to be able to reference from Code section).

February 21, 2004

Computing Curriculum public draft (February 6, 2004). Look at Software Engineering knowledge areas on pages 25-39. This I would call erudition. This I would like to know myself (and I'm working on it). You can also use it to plan courses for starters :)

February 27, 2004

SurF version 0.26: It uses Boost 1.31 now.

March 1, 2004

As a prize from Eiffel Struggle, I received a professional license for Visual Eiffel by Object Tools. To try it out I decided to write a little GUI app (that will place for me some figures into 16*8 table) using Eiffel library (in Rubik's Cube I used .NET facilities for GUI).

I started from GRAPE library, but didn't find analog for Win32 FloodFill function (one of my figures is filled triangle and I don't know how to draw it other than drawing three lines and then filling the interior). So, I turned to WEL library and got the work done. I needed only the picture, but I've got also a standalone executable that I can distribute to others.

One thing that I were particularly interested to know is how external resources (such as Win32 pens and brushes) are freed in Eiffel (how it can work without RAII <g>). To my surprise it works automagically in GRAPE - I can create any number of pens without a single GDI leak. In WEL I have to explicitly call delete.

That's all with Visual Eiffel for now.

March 2, 2004

Paul Graham's "On Lisp". "This book is intended for anyone who wants to become a better Lisp programmer". Perhaps I should have took this description more seriously when I looked for a general introduction to functional programming. I had carefully read two first chapters of "ANSI Common Lisp" (also available online here), first 5 chapters of "On Lisp" and then skimmed through the rest of the book. Lisp language is very simple and "untyped" (just like Smalltalk) while I like to have help from compiler and "typed" intentions, so I didn't have an incentive to go deeper.

Overall, most material was familiar for me from modern C++ approaches like templates meta programming. Except nondeterminism, that I encountered adapting Rubik's Cube solver written in Prolog.

I will try to read "Developing Applications With Objective Caml" by Emmanuel Chailloux, Pascal Manoury, Bruno Pagano. OCaml language seems more practical and proper for me.

April 19, 2004

I'm in a process of changing my organization. I don't work for NII RES anymore and I'm going to stop my software development activities at Mechel.

So, I don't program much these days.

April 19, 2004

A Comparative Study of Language Support for Generic Programming paper by Ronald Garcia, Jaakko Jarvi, Andrew Lumsdaine, Jeremy Siek, Jeremiah Willcock.

"This paper reports on a comprehensive comparison of generics in six programming languages: C++, Standard ML, Haskell, Eiffel, Java (with its proposed generics extension), and Generic C#. By implementing a substantial example in each of these languages, we identify eight language features that support this broader view of generic programming."

April 19, 2004

Eiffel ENViSioN! version 2.01 was released on March 25, 2004. I haven't tried it yet.

April 19, 2004

Proposal to add Design by Contract to C++ by Thorsten Ottosen from C++ Standards Committee Post-Sydney mailing.

April 21, 2004

Updated Links.

Web: Comeau C-C++ Online conformance test was removed (I don't use it, VS 2003 is (good) enough for me), Agile Articles and Hedgehog Archive were removed as these sites don't work anymore.

Newsgroups: comp.object's description was altered (formal methods advocated by Costin Cozianu and Steven Perryman even more appealing for me now than "classical agile" point of view); comp.std.c++ was added for discussions on C++ future; microsoft.public.dotnet.framework.clr, microsoft.public.dotnet.framework.drawing, microsoft.public.dotnet.framework.performance were added for my interest in .NET essentials; microsoft.public.win32.programmer.directx.managed was added for my interest in Managed DirectX.

April 30, 2004

Blogs updated in Links.

Updated links to Dale H. Emery, Raymond Chen, SecurityMonkey, Ivan Medvedev. Added link to short (blog only) joat.

Removed links to Keith Ray (trying to minimize agile reading) and Greg Fee (not supported anymore).

Added links:

General section: Ars Technica - tech news, Lambda the Ultimate - computer science, Pete Kruckenberg - networking the world, Charles Cook - computing, Darrell Norton - agile .NET, Gunnar Kudrjavets - quality software, Valery Pryamikov - different and same.

Security section: Dana Epp - developing secure software, Michael Howard - MS security.

.NET (old Windows) section: Mike Gunderloy - critical news, Joel Pobar - Rotor, Rico Mariani - on performance, Tom Miller - Managed DirectX, Fabrice Marguerie - tools and source.

Employment (old Management) section: Zoe and Gretchen - careers at MS.

Testing section: Jonathan Kohl - tester and developer collaboration, Tim Van Tongeren - testing real world.

May 12, 2004

Practicing Cleanroom on students: High-Quality Software Through Semiformal Specification and Verification by Allan Stavely.

May 28, 2004

Mail lists updated in Links.

Updated links to Boost and Eiffel Software User list.

Added SecurityFocus Mailing Lists: BugTraq - reading since October 2000, Focus on Microsoft, Firewalls, Secure Programming.

Added NTBugtraq - "discussion of security exploits and security bugs in Windows NT, Windows 2000, and Windows XP plus related applications".

Added DOTNET-WINFORMS list from

Added lists: DirectX programming issues and Compiler Developers for .NET

Added Resistance as a Resource Yahoo! Group - Dale Emery's list.

January 2, 2005

For the last 7 months I'm working as Information Security Administrator at Mechel Chelyabinsk. My main responsibility is a protection of users workstations - about 2000 Windows computers, mostly connected to local network:

I always have interest in security and now on this job I've got hands on experience and deeper understanding. I better realize how vulnerable we are now and how much improvements required for software to become secure.

I'm also missing my software development activities and I'm looking for opportunity to get back.

January 5, 2005

I'm using TopCoder currently to rebuild my C++ skills and get trained on quick algorithmic solutions - it's great! Practice rooms have all tasks from previous competitions and each task has solid description and extensive test suit.

Today I participated in live competition (Single Round Match 226, Division 2) as GliderTC. Solved easiest task of three. And solved second (medium) a minute after coding phase had finished :( I have no idea how people solve all 3 tasks in these 75 minutes. Maybe I should use shorter variable names <g>.

It's refreshing to write in pure C++ without Boost, .NET libraries and Windows API. Programming is fun again!

May 27, 2005

Unusual Scanner version 0.20 - disk scanner for nonstandard (possibly malicious) files (readme). I wrote it for my current work to simplify analysis of client computers infected with trojans. I also wrote server part - it checks file for known malware using Kaspersky Antivirus engine and databases. I implemented very simple and unreliable file transfer protocol between client and server, so I don't distribute server part with uns publicly.

July 19, 2005

Experimental Rubik's Cube version 1.28 with DirectX 9.0c support. Expect stable version in a week.

Experimental SurF version 0.43. Expect stable version in a month.

July 27, 2005

Rubik's Cube version 1.30 with DirectX 9.0c support (readme). If you already saw previous version (1.20) no need to download this one.

Previous versions of Rubik's Cube was developed for the very first version of DirectX 9 (v1.0900). DirectX 9.0c was released a year ago and it includes only v1.2902 components. And then DirectX 9.0c June 2005 edition includes only v1.2906 components. Overall, end user has hard time to use applications dependent on old Managed DirectX components. This version of Rubik's Cube supports DirectX 9.0c Gold and DirectX 9.0c June 2005 edition (and it will probably fail under newer...).

This version of Rubik's Cube was compiled using Eiffel Envision 2.5 (previous version used v2.0). While Eiffel Envision 2.5 still doesn't work under non-admin account out of the box, it is fixable by coping HKCU\Software\Classes registry keys from Administrator account to HKCU\Software\Classes in User account. (Actually, it took me a week to make it work on 2 different computers, but I can't reproduce what special I did for that).

August 15, 2005

Proudly presenting SurF File Manager version 0.48. There are large improvements over previous v0.26 and you can read about it here.

I've also simplified Code page removing my old projects and shortening thoughts on code importance.

August 24, 2005

"C++ Coding Standards" book by Herb Sutter and Andrei Alexandrescu. Reference of best practices in modern C++ development. The authoritative book that can officially support your personal coding style <g>. Discusses what needs to be discussed - concise and practical.

This is how C++ Coding Standard in your organization should look like.

October 11, 2005

I'm working at Applied Technologies Chelyabinsk now as a Windows C++ developer. Project is challenging, environment is open, programming is fun!

Updated resume and foto.

October 23, 2005

I'm actively using COM (ActiveX, BHO, RPC) in my current project - never used it seriously before.

So, I reread Dale Rogerson's "Inside COM" - why COM interfaces and how they differ from C++ interfaces, registry, aggregation, marshalling. All fundamentals and ideas of COM. Good book.

Finished reading George Shepherd's and Brad King's "Inside ATL" (I was very interested in libraries that simplify COM usage). The book describes ATL wizards and classes. For me, it's too shallow for reference and too detailed for practical guide. My current objects work fine from ATL wizard's code and I don't ask for more.

I've started reading Don Box's "Essential COM"...

November 9, 2005

It's a free testing period currently at Brainbench. I took the opportunity and here are my results. Good tests.

November 18, 2005

Finished reading Don Box's "Essential COM". I liked it more than Rogerson's "Inside COM" - it's more detailed about apartments, marshalling and additionally describes security and options to pass parameters to interfaces.

I hope this is all I need to know about COM.

November 27, 2005

I'm updating SurF from .NET 1.1 to 2.0 in VS 2005.
Breaking changes

1. std::vector<System::Byte> doesn't compile now. Changed it to std::vector<unsigned char>.

2. Delegate creation
DoubleClick += new System::EventHandler(this, double_click_handler);
had to be changed to
DoubleClick += new System::EventHandler(this, &BaseFileListView::double_click_handler);
3. I use ui_strings.resx and files for English and Russian interfaces. In VS 2003 Resource File Names were:
I accessed them using
resources = new System::Resources::ResourceManager(S"SurF.ResourceFiles", System::Reflection::Assembly::GetExecutingAssembly());
In VS 2005 I got a System.Resources.MissingManifestResourceException and had to change Resource File Names to:
Now I access them using
resources = new System::Resources::ResourceManager(S"SurF.ui_strings", System::Reflection::Assembly::GetExecutingAssembly());

4. System::Windows::Forms::ListView lost file colors in a very bizarre way. First, it shows files with black color. If I resize window - all colors appear normal. Until I select file - then it becomes black again. My solution was to add WinForms::Application::EnableVisualStyles() call to main.

5. I obtain file icons in separate thread using:
void ColorIconUpdater::start(){
	workerThread = new System::Threading::Thread(new System::Threading::ThreadStart(this, work));
void ColorIconUpdater::work(){
	SHGetFileInfo(file, 0, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_SMALLICON);	
In VS 2005 this CoInitialize fails with RPC_E_CHANGED_MODE and I changed it to:
void ColorIconUpdater::start(){
	workerThread = new System::Threading::Thread(new System::Threading::ThreadStart(this, &ColorIconUpdater::work));
void ColorIconUpdater::work(){
	SHGetFileInfo(file, 0, &shfi, sizeof(shfi), SHGFI_ICON | SHGFI_SMALLICON);	
6. System::Net::Dns::GetHostByAddress is marked as obsolete in VS 2005, but
GetHostEntry("").HostName == ""; 
GetHostByAddress("").HostName == "SV";
I'll continue to use GetHostByAddress.

7. Label.AutoSize = true doesn't change actual size immediately anymore. Changed it to:

label->AutoSize = true;
label->Size = label->PreferredSize;
Nice changes

1. [System::STAThreadAttribute] now works for WinMain and I happily removed previous unreliable workaround:

System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA;
as first line inside WinMain.

2. Added DoubleBuffered = true; for ListView that implements file list. No more flickering!

3. System::Drawing::Icon slightly changed scale code and I finally noticed that my up and current icons were scaled from original 16*16 to 32*32 when loading from resources and then back to 16*16. So, I changed LoadIcon to LoadImage and problem solved.
Performance changes
1. ListVew updates noticeably slower.

2. Build time is 10-20 % slower in VS 2005. SurF.exe build by VS 2005 runs all tests 8% faster in Release and 100% slower in Debug builds.

November 27, 2005

One more breaking change - in ListView (List view mode) that uses SmallImageList if you edit item and substantially increase text length this item will be displayed truncated with ellipsis at the end. Until you set ListView.UseCompatibleStateImageBehavior property to true.

November 29, 2005

And one more update issue. To display submenus such as Send To or Open With in file context menu I used following code:
void BaseFileListView::WndProc(WinForms::Message* m){
     bool menu_msg = (m->Msg == WM_INITMENUPOPUP || 
                      m->Msg == WM_MEASUREITEM || 
                      m->Msg == WM_DRAWITEM) && 
     if (menu_msg)
         (*shell_menu)->HandleMenuMsg(m->Msg, m->WParam.ToInt32(), m->LParam.ToInt32()); 
In .NET 2.0 when I selected Send To submenu SurF terminated with FatalExecutionEngineError in WinForms::ListView::WndProc call. I changed this function to:
if (menu_msg)
   (*shell_menu)->HandleMenuMsg(m->Msg, m->WParam.ToInt32(), m->LParam.ToInt32()); 
Works fine now.

December 2, 2005

Official breaking changes in .NET Framework 2.0 for C++ Design-Time and CLR Run-Time.

December 10, 2005

Released SurF version 0.51 for .NET Framework 2.0:

December 10, 2005

.NET Framework 2.0 supports automatic form scaling based on user font size. I always ensure my apps look fine with large fonts and this new feature is a welcome addition. I successfully applied autoscaling to all dialogs in SurF and very happy with the result.

I developed following template to correctly use autoscaling:

  1. Create all controls and Controls->Add them.
  2. Autoscale form based on current font.
  3. Setup controls (as they know now about nonstandard font).
Sample code looks like this:
WinForms::Button* connect_as = new WinForms::Button();

ClientSize = System::Drawing::Size(400, 200);
AutoScaleDimensions = System::Drawing::SizeF(6, 13);
AutoScaleMode = WinForms::AutoScaleMode::Font;

connect_as->AutoSize = true;
connect_as->Text = S"Connect as...";
connect_as->Location = System::Drawing::Point(10, 10);
connect_as->Click += new System::EventHandler(this, &SelectShareDialog::on_connect_as);

December 10, 2005

On my Windows XP SP2 system C:\WINDOWS\system32\dllcache\ file (you need Admin rights to access it) is compressed (NTFS compression) and has size of 7,382 bytes. Windows Explorer shows it's size on disk also as 7,382 bytes - while with cluster size of 4,096 bytes it should be 8,192 bytes. Same problem with all compressed files from 4K to 8K in size.

Bug, feature? Where to report?

December 10, 2005

Tried SlickEdit Tools for Visual Studio 2005 trial today. It allows following refactorings for C++ code:

Unfortunately, it doesn't work. I managed to apply Rename, Replace Literal and Extract Method to empty native Win32 project, but nothing more complex - inclusion of <iostream> breaks SlickEdit, using SlickEdit on C++/CLI project fails, Move Method refactoring fails.

Back to the manual coding again...

December 13, 2005

Tested Ref++ - Refactoring for Visual C++. Available refactorings: All of them work for native code. The moment you turn on CLR support in project settings Ref++ becomes disabled. And I'm using .NET for more than 3 years now...

December 13, 2005

It's possible to create malformed data file that will lead to access violation when loaded using CArchive MFC class (Bug Details).

Martyn Lovell's response: "Thanks for the report. This is the kind of situation we should be robust to. We'll try to fix this in time for our service pack."

December 14, 2005

I still experience flickering in WinForms::ListView .NET 2.0 despite setting DoubleBuffered = true under Windows 2000 (under XP it works fine). This seems to answer it:"... you could enable double buffering on the listview to remove the flicker. This is only supported on XP and above with comctl 6" Mark Rideout, Program Manager, Microsoft.

And you can't copy comctl32.dll from XP to 2000 as it depends on other XP system components (like kernel32.dll).

December 14, 2005

Intellisense update in VS 2005 is quite intrusive and I use Visual Assist anyway, so: "There is a undocumented way to disable C++ Intellisense - Rename or delete the following file: vs_root_path\VC\vcpackages\feacp.dll" Martin Richter.

December 18, 2005

I missed the fact that Avalon doesn't require Vista and runs on XP. Interested in trying it out I found that WinFX November CTP SDK is quite large (930 MB) download. I also found that You can't use C++ with compiled xaml in the same assembly.

Once I developed for Managed DirectX without SDK using only Runtime Components and I thought maybe it will work for Avalon too. I installed WinFX November CTP Runtime Components - entire package is 43 MB, web install for my system is 16 MB. Tried Chris Sells examples and found that I can't change XAML even for C# without SDK.

But maybe I don't need XAML? I like to write my UI in C++ anyway. I tried to access Avalon directly and it seems to work. Documented it in my new article Avalon without XAML.

December 21, 2005

Created SurF File Manager project on SourceForge - I would like to bring more attention to SurF. It also means that SurF is officially open source now.

December 25, 2005

What's so special in Avalon - Top Ten UI Development Breakthroughs In Windows Presentation Foundation article by Ian Griffiths and Chris Sells.

January 3, 2006

"Writing Secure Code" Second Edition by Michael Howard and David LeBlanc. What an educational book! RPC, ActiveX, COM, pipes, web, databases, sockets, files - everything requires secure design, implementation and testing. Impersonation, cross site scripting/SQL injection, DOS, privilege escalation, buffer/stack/heap overflow - this book made them real for my apps and I'm sure it will make same for yours. And more important - it shows the defense.

Highly recommended.

January 15, 2006

" ... when I ask people what language they'd like to program in they answer "language X", even before I've told them the problem. This is disappointing in that they may have just picked a language which is not appropriate for the problem." What Should Change in Comp Sci Education blogpost by Kang Su.

I'm a strong believer in multi-paradigm programming. Wish to have time to write something big in Prolog and Haskel...

February 18, 2006

SurF version 0.52 is released:

May 7, 2006

SurF version 0.53 is released:

May 22, 2006

SurF version 0.54 is released:

May 26, 2006

"Exceptional C++ Style" by Herb Sutter. The first Sutter's book that didn't impress me. Repetitions in text (in question, in solution and in answer), repetitions from his previous books (std::string unstrung), little new information (looking at contents I can name only generic callbacks design discussion as interesting for me).

My conclusion is that "Exceptional C++ Style" adds little value to Sutter's previous excellent work.

June 13, 2006

Two articles that caught my attention recently: The .NET Developer's Guide to Identity by Keith Brown and The Laws of Identity by Kim Cameron.

It's modern look at Authentication and Authorization technologies on Windows platform and beyond. WCF, InfoCard and why we need unifying identity metasystem.

Happy reading!

June 14, 2006

I converted SurF from Managed C++ to C++/CLI last week. Conversion was rather straightforward and if I knew it is so easy I'd made it earlier. 80 percents of conversion is to convert * to ^ and new to gcnew for .NET classes. Do use regular expressions for it (but take into account that Replace in Files with Regular expressions eats last symbol in tag for closed files, so Keep modified files open after Replace All).

For example, to convert * to ^ for classes from System namespace use:
Find what - System\:\:{[a-zA-Z\:]+}\*
Replace with - System\:\:\1^

It will replace System::Exception* with System::Exception^ and so on.

To convert new to gcnew use:
Find what - new System\:\:{[a-zA-Z\:]+}
Replace with - gcnew System\:\:\1

Everything else could be found in C++/CLI Language Specification. Language overview clause is particularly informative.

June 15, 2006

I developed ClickOnce installer for SurF. Producing application and deployment manifests for C++ application requires usage of mage.exe and mageui.exe that you can find in Microsoft Visual Studio 8\SDK\v2.0\Bin directory.

My big personal problem was that I used same Name (SurF) in application manifest as name of exe file (SurF.exe). I knew that manifest file name should be different from exe name and named it appropriately, the problem is that during ClickOnce installation manifest file name is changed according to Name in application manifest (becoming SurF.exe.manifest)! With this foreign manifest my exe was not able to use built in manifest and "failed to start because MSVCP80.dll was not found". Now that I know about it this is not an issue any more.

Using mage.exe it is possible to automate manifests generation from command line. I generate application manifest almost completely automatically (manual is only version number) using following line:

mage.exe -New Application -FromDirectory surf -Processor x86 -Name "SurF File Manager" -Version -ToFile surf\SurF_File_Manager.manifest -CertHash "01 df 59 30 ef 11 84 6b 55 ca 90 55 ba f5 93 be 07 a2 27 23"

Deployment manifest is significantly less automatable from command line, so I generated one using mageui.exe and use mage.exe to update it for new builds:

mage.exe -Update surf\SurF_File_Manager.application -AppManifest surf\SurF_File_Manager.manifest -CertHash "01 df 59 30 ef 11 84 6b 55 ca 90 55 ba f5 93 be 07 a2 27 23"

It's nice to have Web installer! (current prerelease version is here .NET 2.0 required).

July 2, 2006

When I wanted to add custom application icon to ClickOnce installer for SurF and mage.exe didn't have command line switch for it that was the last straw. I moved to MSBuild.

Now I have one deploy.proj file:
<Project DefaultTargets="Build" xmlns="">

        <DeployUrl>use property parameter</DeployUrl>
        <SupportUrl>use property parameter</SupportUrl>
        <Version>use property parameter</Version>
        <Description>use property parameter</Description>
        <UpdateInterval>use property parameter</UpdateInterval>
        <UpdateUnit>use property parameter</UpdateUnit>

        <Thumbprint>01 df 59 30 ef 11 84 6b 55 ca 90 55 ba f5 93 be 07 a2 27 23</Thumbprint>

        <EntryPoint Include="SurF.exe"/>
        <IconFile Include="app.ico"/>

       <Dependency Include="ru\SurF.resources.dll">

        <File Include="doc\*.*">

        <File Include="settings\*.*">

    <Target Name="Build">



            Publisher="Sergey Vlasov"

Following command line executes it:
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe" surf\deploy.proj /property:Version= 
/property:SupportUrl= "/property:Description=SurF File Manager" 
/property:UpdateInterval=6 /property:UpdateUnit=Days
Results of build are signed application and deployment manifests (with custom application icon that is shown during installation and in Start menu). For C++ projects which VS2005 doesn't support with Publish IDE feature this approach is far more powerful and maintainable comparing to Mage and MageUI.

Speaking about app icon, actually you can set it in MageUI: select icon file in application manifest and double click on File Type cell.

July 2, 2006

I planned to include deployment manifest in SurF zip archive to enable local ClickOnce installer and updates in addition to web installer and updates. Unfortunately, this scenario is not supported as application identity for ClickOnce application includes the URL where the application file originally came from. It means that if you install application from local path and then try to update it from web site you lose application settings - same application that is deployed from different URLs is two different applications from ClickOnce point of view.

I ended up with separate ClickOnce web installer and xcopy zip archive.

July 2, 2006

SurF version 0.56 is released:

July 8, 2006

"A lock-free procedure guarantees progress of at least one of the threads executing the procedure. That means, some threads can be delayed arbitrarily, but it is guaranteed that at least one thread of all makes progress at each step. Statistically, in a lock-free procedure, all threads will make progress.

Lock-based programs can't provide any of the above guarantees. If any thread is delayed while holding a lock to a mutex, progress cannot be made by threads that wait for the same mutex; and in the general case, locked algorithms are prey to deadlock."

Introductory articles for lock free programming: So, we have Interlocked.CompareExchange in .NET and _InterlockedCompareExchange in Win32. Theoretically, it is enough to start replace locks right now.

July 31, 2006

Latest (beta) builds of Visual Assist support refactoring for native and CLI C++ projects. Learn more and try for yourself.

July 31, 2006

"Leading at the edge: leadership lessons from the extraordinary saga of Shackleton's Antarctic expedition" by Dennis N. T. Perkins presents analysis of Shackleton's expedition accompanied with case studies of modern business leaders facing significant organizational challenges.

"I believe that Shackleton and others who have faced the limits of human endurance have left an invaluable legacy. This legacy incorporates the leadership strategies outlined in this book, but it extends beyond that. The lessons drawn from the experience of others can help individuals to clarify their personal values and to make decisions about the kind of people they want to be as leaders. By defining ourselves, we will be better able to reach The Edge - wherever and whenever we choose to pursue it."

It clarified a lot for me.

August 11, 2006

SurF version 0.57 is released:

August 16, 2006

Producing Open Source Software: How to Run a Successful Free Software Project book by Karl Fogel. While I do use and write free software I never actually learned about it. What makes many developers and users contribute to project? How to organize and attract them? Why OSS projects distributed and licensed the way they do? It's all in the book.

"More than 61% of our survey respondents said that their participation in the focal F/OSS project was their most creative experience or was equally as creative as their most creative experience" (Why Hackers Do What They Do: Understanding Motivation and Effort in Free/Open Source Software Projects by Karim R. Lakhani and Robert G Wolf). Count me in.

September 23, 2006

SurF version 0.58 is released:

February 26, 2007

SurF version 0.59 is released:

April 17, 2007

SurF version 0.60 is released:

November 6, 2007

SurF version 0.61 is released:

November 30, 2007

SurF version 0.62 is released:

December 23, 2007

Concepts, Techniques, and Models of Computer Programming by Peter Van Roy and Seif Haridi.

Lazy evaluation, Declarative Computation Model, Declarative Concurrency, Message-Passing Concurrency, Transactions, Relational Programming, Logic Programming, Distributed Programming, Constraint Programming. I wish I'd read it much, much earlier. Not now when I'm so immersed in C++. Not now when I'd read it only as programming concepts overview without delving in the details, without idea how I can try it in practice.

Draft version available for download here.

December 27, 2007

"Extreme Programming Explained: Embrace Change" Second Edition by Kent Beck and Cynthia Andres. It's completely new comparing to first edition, with different explanations and updated practices (while still compact at 224 pages). Recommended iteration length in now one week (instead of two or three) with daily deployment ideal. One of the new primary practices is Ten-Minute Build - "automatically build the whole system and run all of the tests in ten minutes". Very interesting idea is tests for architecture - "to improve the architecture they would first improve the stress tests until the system broke. Then they would improve the architecture just enough to run the tests". Must read without a doubt.

BTW, there is also Ease At Work presentation on Google Video. It has nothing with the book, but everything with Kent Beck.

December 28, 2007

Updated Links to resources I regularly read.

January 18, 2008

SurF version 0.63 is released:

February 8, 2008

SurF version 0.64 is released:

February 11, 2008

"C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond" by David Abrahams and Aleksey Gurtovoy. Describes Boost Metaprogramming Library (MPL) in detail. Two interesting chapters on building domain-specific embedded languages in C++. Novel compile-time performance study.

MPL in itself doesn't resonate with me. The reason is probably it's more suited for library developers and I'm more focused on application programming right now. So, I can't say I've taken much from this book personally. Strong writing nevertheless.

February 11, 2008

"In Search of Stupidity: Over 20 Years of High-Tech Marketing Disasters" by Merrill R. Chapman. Colorful modern IT history lessons on IBM, Microsoft, Borland, MicroPro, Novell and others. Not reading much about these big ones previously, the book was quite educational for me. And I hope I will not repeat their mistakes <g>.

February 21, 2008

For a long time I wished to try out Prolog and logic programming. Castor to the rescue! It's C++ Logic paradigm library that fits into C++ very nicely. Thinking about a project I can apply it to I remembered Einstein test. 5 years ago I wrote solution to it in "pure" C++ and now I wrote solution that uses Castor. Both run under 1 second, new solution is 200 LOC v 300 LOC for the old one, new solution is a way more declarative and consequently easier to read.

On the one hand given logical problem was easily solved by traditional OO and functional means, on the other hand applying LP you don't have to solve it at all! I will definitely try to stretch declarativeness further in my work.

February 22, 2008

Today I tried to solve 15 for 3*3 grid. New realization that uses Castor is 3 times shorter and 10 times faster comparing to "pure" C++ solution I wrote 1 year ago (both solutions don't use any heuristics). LP rocks.

February 24, 2008

"Effective GUI Test Automation: Developing an Automated GUI Testing Tool" by Kanglin Li and Mengqi Wu. I don't usually bash books, but right now I seriously work on acceptance tests automation at work and this book's title is quite catchy. It starts pretensiously from how available commercial testing tools are inadequate and then implements 5% of Test Complete functionality in C# including all boring Win32 interop details and XML scripts parsing. I quickly skimmed over it and just want to warn potential buyers of this book.

Speaking of Test Complete, I'm not completely happy with it either and plan to try Ranorex.

February 26, 2008

"Open Source and Free Software Licensing" by Andrew M. St. Laurent. Annotates common open source licenses (MIT, GPL, QT and others). Compares with non-open source licenses (e.g. Microsoft Shared Source Initiative) and contrasts with proprietary licenses. Describes basic principles of copyright law. Touches software development using open source and free software licenses.

I would say this is exactly the amount of information open source developer should know about licenses in exactly understandable language. Excellent book.

May 2, 2008

Made little benchmark of VS 2008 C++ parallel build performance today.
Hardware: Intel Core2 Quad (Q6600) @ 2.4 GHz, 3.5 GB RAM.
Soft: Windows XP 32bit, Visual Studio Team System 2008 + Feature Pack.
Solution: Native C++, boost, std, std::tr1.

Tested varying maximum number of parallel project builds (PPB) and /MP compiler switch making full solution rebuild:

PPB = 1 + /MP Disabled PPB = 4 + /MP Disabled PPB = 1 + /MP Enabled PPB = 4 + /MP Enabled
Project1 CPU time, s 1 0 1 1
Project2 CPU time, s 20 21 9 9
Project3 CPU time, s 3 3 3 7
Project4 CPU time, s 14 15 10 11
Project5 CPU time, s 5 6 4 7
Total CPU time, s 43 45 27 35
Total clock time, s 46 36 29 22

So, 4 cores give me 46/22 = 2.1 times performance boost.

May 3, 2008

"RSA Security's Official Guide to Cryptography" by Steve Burnett and Stephen Paine. Compact practical cryptography guide not delving into math or specific APIs. Explains everything from ground up, but absolutely with no repetition allowing to really explain protection, attacks, key management, protocols, hardware solutions in compact 400 pages. I enjoyed reading this book.

See also short and entertaining Crypto Blunders online paper by Steve Burnett.

May 14, 2008

WPF is generally nice, but particularly when programming in C++/CLI some things are so much non obvious. Take for example task of embedding image.png in .exe and using it as BitmapImage. Following is how I made it work:
  1. Rename image.png file to image.png.wav.
  2. In your WPF project Add, New Item, Assembly Resource File (.resx) with Name g.
  3. In g.resx tab Add Resource, Add Existing File image.png.wav.
  4. Make sure View, Other Windows, Properties Window is visible.
  5. In g.resx tab select image.png, in Properties window set Persistence for image.png to Embedded in .resx.
Now you can load image as usual:
System::Uri^ uri = gcnew System::Uri("pack://application:,,/image.png");
System::Windows::Media::Imaging::BitmapImage^ bitmap = 
	gcnew System::Windows::Media::Imaging::BitmapImage(uri);

May 31, 2008

I've just released Regent - a program that automatically creates search and replace regular expression from text example. This is v1.0.0. I'm eagerly awaiting user feedback to see in what direction it should grow.

June 8, 2008

Site update. Added links to Regent and SurF to front page. Added Home link to all site pages.

July 2, 2008

Regent version 1.1.0 is released:

September 15, 2008

Regent version 1.2.0 is released:

October 19, 2008

"Happy families are all alike; every unhappy family is unhappy in its own way." I think it is true for software projects as well and explains why watching When Working Software Is Not Enough: A Story of Project Failure video presentation by Mitch Lacey was so interesting for me.

December 9, 2008

I'm gradually watching PDC 2008 videos. (Note that high-quality WMVs include video of the speakers.) Most interesting ideas so far:

Windows 7 desktop.

Jump lists overview Jump lists breakdown
Custom switchers overview

I'll definitely add jump lists and custom switchers support to SurF.
Code contracts.

Code contracts example

Support for my beloved DBC. But it seems only in managed code.
Build time history.

Build time history

It's always a risk that code change inadvertently significantly increase build time or decrease application performance. These changes are hard to track automatically as slow time variations are completely normal. Visual Studio 2010 TFS displays 10 last build times after each build on a little graph and it is easy to assess it visually. Adding similar graph for UT run time should allow to monitor application performance as well.

December 10, 2008

Top 3 blogs I discovered in recent months:
  1. Rands In Repose - Lots of great ideas on project management, communication, companies and work. Very inspiring.
  2. James Whittaker - Looking into the future of testing.
  3. Engineering Windows 7 - Windows 7 explained.

December 12, 2008

Cover "Debugging applications for Microsoft .NET and Microsoft Windows" by John Robbins. I try to avoid debugging making source code as high quality as possible using unit tests, design by contract assertions, exception specifications and code review. And so is John! There is a whole chapter right at a start of the book about assertions, tracing, comments and unit testing.

Most of the book is about development and debugging in Visual Studio .NET. When Visual Studio is not enough John describes other tools (WinDBG, Dr. Watson) and writes (C++ source code included) his own utilities and libraries (CrashFinder, Tester, CrashHandler, DeadlockDetection, MemDumperValidator, MemStress and FastTrace).

The book was written in 2003 and analyses mostly unmanaged code involving good amounts of assembler. It's too low level for me right now. I still hope that I don't need such kind of techniques to find bugs in my programs.

John is certainly a Windows debugging guru and excellent writer. He wrote a newer "Debugging Microsoft .NET 2.0 Applications" book and maintains an interesting blog.

December 24, 2008

Oslo is interesting. For my needs it can replace XML and SQL with a higher level "M" language.

"Four" by "Led Zeppelin" is awesome!
"Back in Black" by "AC/DC" is so so.
"Bad" by "Michael Jackson" is terrible.
module Microsoft.Samples
  import Language;
  language MusicLibraryLanguage
    syntax Main = s:Statement+ 
	=> MusicLibrary(valuesof(s){l...

    syntax Statement = 
        al:Grammar.TextLiteral "by" 
        ar:Gramar.TextLiteral "is" r...
   { Album {al}, Artist {ar}, Rating {r} }

    token Rating1 = "terrible" | "awful";
    token Rating2 = "so so";
    token Rating3 = "awesome";

    syntax Rating = Rating1 => 1 | 
        Rating2 => 2 | 
        Rating3 => 3;

    interleave skippable = Base.Whitespace
Module ModuleName
      Album  = "Four",
      Artist = "Led Zeppelin",
      Rating = 3
      Album  = "Back in Black",
      Artist = "AC/DC",
      Rating = 2
      Album  = "Bad",
      Artist = "Michael Jackson",
      Rating = 1
Right section represents data in "M" format - already better than XML. But with some "M" programming in the middle we can also access almost natural format in the left section.

It's not first grammar parser in the world, but it can be the best. Having rich infrastructure (integration with Visual Studio, syntax highlighting, debugging, visual and programmatic parse errors reporting) and exporting data to different formats (text, XML, databases and programming APIs).

Oslo Schema Evolution Example Another example is database table definition using "M". Type Friendship is automatically transformed in SQL table Friendships behind the scenes. Later type Friendship2 adds LoveIndex field maintaining compatibility with older clients.
Oslo advertised a lot and raised my skepticism. What I saw in PDC videos is reassuring. While right now it's "nascent technology" by Chris Anderson words, Oslo is a next big thing.

January 1, 2009

More details on .NET contracts:

What can I do with contracts How does it work

There are two static contracts verifications tools available: cccheck and Pex. Particularly useful as normal unit tests can't check for precondition violations.

I wandered how library solution allows writing Ensures statement at the beginning of a function and execute at the end. The answer is ccrewrite tool as post build step.

Contracts and Pex are available today for VS2008 with an academic license (Non-Commercial Use Only).

January 2, 2009

CHESS - an elegant solution for finding concurrency bugs in native and managed code.

class Account {
  int balance;
 Account(int b) {
  balance = b;

 int read() {
  int r;
  r = balance;
  return r;

 void deposit(int n) {
  balance = balance + n;

 void withdraw(int n) {
  int r = read();
  balance = r - n;
DWORD WINAPI WithdrawThread(LPVOID param) {
 Account* a = (Account*)param;
 return 0;

void RunTest() {
 Account* a = new Account(10);
 HANDLE hThread = CreateThread(NULL, 0, WithdrawThread, a);
 WaitForSingleObject(hThread, INFINITE);
 ASSERT_EQUALS(9, a->read());
Concurrency Explorer

Class Account has a bug in withdraw method. RunTest function can theoretically reveal it, but very unlikely in practice. CHESS, on the other hand, systematically and predictably tries different possible thread interleaving and on fourth attempt finds the bug and the problematic interleaving sequence.

CAP architecture CHESS:_Find_and_Reproduce_Heisenbugs

January 7, 2009

"Applications = Code + Markup: A Guide to the Microsoft Windows Presentation Foundation" by Charles Petzold. Describes all WPF elements - controls, drawing primitives, XAML, dependency properties, routed input events, resources, data binding and animation. The book shows no wizards or other helper tools, only C# code and XAML markup - my respect to the author. Writing style is methodological, sometimes even pedantic.

Looks like a reasonable book for the first time WPF learners.

January 9, 2009

If you use boost::thread 1.37 + Visual Studio 2008 SP1 + /clr option and get linker error LNK2022: metadata operation failed (8013119F) : A TypeRef exists which should, but does not, have a corresponding TypeDef: (dummy): (0x0100001e). Add to problematic cpp file:
namespace boost {
	struct thread::dummy {};

January 13, 2009

To get default folder icon I always used following code:
SHFILEINFO shfi;              
DWORD_PTR success = SHGetFileInfo(L"", FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), 
Under Windows 7 beta it incorrectly returns 5 instead of 1 in shfi.iIcon. A workaround is to provide some dummy path:
DWORD_PTR success = SHGetFileInfo(L"dummy path", FILE_ATTRIBUTE_DIRECTORY, &shfi, sizeof(shfi), 

February 2, 2009

SurF version 0.65 is released:

February 22, 2009

"Intel Threading Building Blocks: Outfitting C++ for Multi-Core Processor Parallelism" by James Reinders. Algorithms, containers, memory allocators, mutexes, tasks and examples.

The book and the library are written first of all with performance in mind - lots of pointers, tasks joggling and complex algorithms. For me correctness and simplicity is more important. Fortunately TBB has really good abstractions like atomics, parallel algorithms, scalable memory allocators and the book provides decent information on how to get started.

This is the only readable documentation on TBB, so if you use TBB you should read this book.

February 23, 2009

Convinced by Microsoft's Parallel Pattern Library, Asynchronous Agents Library and Concurrency Runtime future talks that manual threads and locks management is in the past, I decided to try TBB. I had read the TBB book and worked on SurF v0.66 release with TBB in mind.

I started from making my tests runner parallel aware. In SurF project I have 58 test suits that run after each successful build and take 11.7 seconds (each suit contains 5-20 tests). I also have 4 additional heavy test suits than I run infrequently. All 62 suits run in 25.5 seconds. Using tbb::parallel_for over test suits I reduced normal tests time to 7.25 seconds (1.6x speedup) and all tests time to 9.4 seconds (2.7x speedup) on my quad-core Q6600. Running VS 2008 TS's profiler I see that most time is spend in system CLR modules and I have no idea what I can optimize to get closer to 4x speedup. Maybe I can organize individual tests into separate tasks, but it looks like a lot of work with no guarantee of noticeable speedup.

My second task was QuickPath search speedup. Serial version took 40 seconds to calculate score for each directory on disk. I applied tbb::parallel_for over directories and time grew up to 55 seconds. Uh-oh. Profiler showed lot of time spending in memory allocation. I added tbb::scalable_allocator parameter to two most used temporary vectors and time fell down to 12 seconds (3.3x speedup) - good enough for me.

I also used tbb::concurrent_vector - good for concurrent reading and adding elements, unfortunately there is still need for a lock obtaining begin and end iterators when another thread uses push_pack. tbb::atomic<bool> - used it for checking should_stop flag in running thread. I didn't use tasks explicitly and there is no equivalent to Asynchronous Agents in TBB.

Overall, high level threading libraries is a way to go. TBB is available for 2.5 years now - don't miss it.

February 24, 2009

In SurF v0.66 I have implemented background search in QuickPath dialog. When search completes the Full path text becomes bold. When a better match is found a previous full path fades out and is replaced by the better one. Internally, for 200 ms after the new Search text was changed updated Full path is not displayed immediately to filter out "low quality" candidates.

Get Microsoft Silverlight
Download WMV video (138 KB)

It makes QuickPath dialog somewhat complex with lots of state transitions (fading, new search text, updated full path, search completed) and two timers (1.5 s fading and 200 ms search text changed). Timers don't mix with normal unit tests. And even with "heavy" tests there would be dependency on concrete times (1.5 s and 200 ms).

Instead of it, I moved all time measurement code out of TextTransitionsModel and left it to ITextTransitionsView implementation.

class TextTransitionsModel
	TextTransitionsModel(ITextTransitionsView& view);
	void on_search_text_changed();
	void on_search_completed();
	void on_path_updated(
		const boost::optional<std::wstring>& path);
	void on_fade_timer_tick();
	void on_search_text_changed_timer_tick();
class ITextTransitionsView
	virtual void text_box_append_text(
		const std::wstring& text) = 0;
	virtual void text_box_clear_text() = 0;
	virtual void text_box_font_set_bold() = 0;
	virtual void text_box_fore_color_set_fade() = 0;
	virtual void search_text_changed_timer_start() = 0;
	virtual void search_text_changed_timer_stop() = 0;
	virtual void search_text_changed_time_set_to_now() = 0;
	virtual void fade_timer_start_time_set_to_now() = 0;
	virtual void fade_timer_start() = 0;
	virtual void fade_timer_stop() = 0;
	virtual bool is_fade_time_elapsed() = 0;
	virtual bool is_search_text_changed_time_elapsed() = 0;

TextTransitionsModel receives updates on search text changed, search completed, path updated and timers' ticks. It doesn't know anything about real time, but it can start/stop fade and search text changed timers. It can ask the view to store current time - time_set_to_now. And it can ask the view is allotted time elapsed - time_elapsed. Plus the model controls the Full path text, font and color.

Tests for TextTransitionsModel are now very simple using private TextTransitionsView implementation:
class TextTransitionsView : public ITextTransitionsView
	TextTransitionsView() : text_box_font_bold(false), 
	fade_time_elapsed(false), fade_timer_enabled(false) {}
	virtual void text_box_append_text(const std::wstring& text) 
		{ text_box_text += text; }
	virtual void text_box_font_set_bold() 
		{ text_box_font_bold = true; }
	virtual void fade_timer_start_time_set_to_now() 
	virtual void fade_timer_start() 
		{ fade_timer_enabled = true; }
	virtual void fade_timer_stop() 
		{ fade_timer_enabled = false; }
	virtual bool is_fade_time_elapsed() 
		{ return fade_time_elapsed; }

	bool fade_time_elapsed, text_box_font_bold, fade_timer_enabled;
	std::wstring text_box_text;
void test_bold_font(TestErrors& errors)
		TestErrors::AutoPrefix ap(errors, L"set text and completed");
		TextTransitionsView view;
		TextTransitionsModel model(view);
		errors.assert(view.text_box_font_bold, L"bold");
		TestErrors::AutoPrefix ap(errors, L"completed during fade");
		TextTransitionsView view;
		TextTransitionsModel model(view);
		errors.assert(view.fade_timer_enabled, L"timer");
		if (view.fade_timer_enabled)
			view.fade_time_elapsed = true;
		errors.assert(view.text_box_font_bold, L"bold");
I'm not afraid to test timers code any more :)

February 24, 2009

I used Silverlight to demo QuickPath search in my previous post. Here is the making of the demo.

1. I used Windows Media Encoder capturing screen of a specific window in high quality. Silverlight doesn't support Windows Media Video 9 Screen codec, so I used Windows Media Video 9 codec in Quality VBR mode. Captured window's width and height should be divisible by 2 or you get "The specified stream does not exist" error.

2. I created Silverlight Application with a test page in Visual Studio 2008 SP1 with Silverlight Tools installed. Modified width and height in Page.xaml to match my video size. Added column for Play button. Added my video with auto play turned off. Added Play button:
<UserControl x:Class="QuickPathDemo.Page"
    Width="526" Height="134">
    <Grid x:Name="LayoutRoot" Background="White">
            <ColumnDefinition Width="476"></ColumnDefinition>
            <ColumnDefinition Width="50"></ColumnDefinition>
        <MediaElement x:Name="Video" Width="476" Height="134" AutoPlay="false" Source="QuickPathDemo.wmv"/>
        <Button Content=" Play " Name="bntClick" HorizontalAlignment="Center" VerticalAlignment="Center"
		Click="Button_Click" Grid.Column="1">
Added Play button click handler to Page.xaml.cs:
private void Button_Click(object sender, RoutedEventArgs e)
3. I put QuickPathDemo.wmv from step 1 and QuickPathDemo.xap from step 2 to the images folder on my site. Added reference to QuickPathDemo.xap Silverlight application to the news.html page on my site:
<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="526" height="134">
	<param name="source" value="images/QuickPathDemo.xap">
	<param name="minRuntimeVersion" value="2.0.31005.0">
	<param name="autoUpgrade" value="true">
<a href="" style="text-decoration: none;">
<img src="" alt="Get Microsoft Silverlight" style="border-style: none">
QuickPathDemo.xap and QuickPathDemo.wmv files are loaded with the news.html page load, but with 5 KB and 138 KB in size it is not a problem. Works in FireFox as well as in IE when Silverlight runtime is installed.

February 24, 2009

SurF version 0.66 is released:

March 17, 2009

Introducing my new project Tabs Studio - A Visual Studio advanced windows tabs add-in:

Tabs Studio's tabs in Visual Studio IDE

Free alpha is available for download. Expect v1.0 release in a month.

March 28, 2009

Tabs Studio v0.8.5 is released:

Tabs Studio's tabs in Visual Studio IDE

March 29, 2009

"Lean thinking" by James P. Womack and Daniel T. Jones. This book is about better manufacturing, primarily in automotive industry as lean originally started in Toyota.

Most revolutionizing idea for me is that batch processing (produce 500 tons of steel, then produce 500 car body frames, then paint all body frames, than assembly all cars) is a big waste of resources. Continuous production (produce steel for one car, then produce body frame, then paint, then assemble and sell it) is faster and more efficient. Batch processing is more optimal in single operations, but overall process efficiency (value for customer) is low. Continuous production is also superior in quality comparing to batches.

The book contains lots and lots of examples of lean transformations, for example in Porsche and Pratt & Whitney. These examples don't refine basic ideas much, but are an easy read and create aura of lean inevitability.

April 1, 2009

Tabs Studio beta is released:
v0.9.0 - April 1, 2009
v0.8.6 - March 31, 2009

April 6, 2009

Tabs Studio v1.0.0 is released:

April 25, 2009

Created Tabs Studio Blog.

June 10, 2009

In a Visual Studio add-in Microsoft.VisualStudio.Shell.Package.GetGlobalService method always returns null. It works fine in Visual Studio integration package, but not in add-in. A workaround is to get IServiceProvider from DTE2 object which you always have in add-in:
System.IServiceProvider serviceProvider = 
	new Microsoft.VisualStudio.Shell.ServiceProvider(
		dte2_object as Microsoft.VisualStudio.OLE.Interop.IServiceProvider);
IMyGlobalService service = serviceProvider.GetService(typeof(SMyGlobalService)) as IMyGlobalService;
See How to get services from the VS DTE original blog post that presented this idea.

July 13, 2009

"Understanding Statistical Process Control" (second edition, Russian edition) by Donald J. Wheeler and David S. Chambers. Statistical Process Control "... is an effective method of monitoring a process through the use of control charts. Control charts enable the use of objective criteria for distinguishing background variation from events of significance based on statistical techniques. Much of its power lies in the ability to monitor both process center and its variation about that center. By collecting data from samples at various points within the process, variations in the process that may affect the quality of the end product or service can be detected and corrected, thus reducing waste as well as the likelihood that problems will be passed on to the customer."

Roughly speaking, a process (e.g. car wheel manufacturing) could be "stable" or "not stable". "Stable" process can be gradually fine tuned to be as precise as needed (variations in wheel diameter from one manufactured wheel to another can be reduced to be as low as needed). In "unstable" process you can't guarantee to your customer that wheel diameter is in certain limits and to fix it you need to find a variability reason outside the process (e.g. operator need eyeglasses or manufacturing machine requires oil change).

This book explains the foundations of Shewhart's control charts - very practical and industry accepted tool. Statistically processing several wheel diameter measurements you can build Shewhart's control chart that will tell you whether your manufacturing process stable or not. The book also explains why gradually reducing variation in stable process (e.g. up to 1 mm) is economically valuable even when customer accepts wider variation (e.g. up to 5 mm).

Statistical process control works better for continuous variables (diameter, weight) than for discrete attributes (number of bugs, number of failed tests). When final results are new versions of the same program I have even more difficulties to see applicability of SPC. Nevertheless, I do believe that ability to detect unknown errors distinguishing them from natural variability is a very important one. Very well written and principal book for me.

July 28, 2009

"The Definitive Guide to Windows Installer" by Phil Wilson. This book is a good overview of all Windows Installer concepts: tables, searches, conditions, component, features, sequences and updates. I used WiX to create my first msi installer and read this book to get started. "The Definitive Guide" uses Visual Studio installer and Orca to create example installer packages. So, it wasn't perfect match though underlying principles of course the same.

I think this book is a nice middle ground between practical WiX documentation and fundamental MSI SDK documentation.

August 6, 2009

Using Speech Recognition to Program in Microsoft Visual Studio - a little demo of work in progress at Renaissance. I think at current level of technology only speech can be better than keyboard for programming.

August 7, 2009

Since January, Kent Beck has a blog. I'm eager to read more of his thoughts on software craftsmanship.

August 16, 2009

"Professional Visual Studio 2008 Extensibility" by Keyvan Nayyeri. I didn't like this book. Astonishing amount of filler materials (text repetitions, code listings, code listings repetitions(!), wizard screenshots). Shallow and dry discussions (long feature lists, message box level examples). I'm very interested in VS 2008 extensibility (primarily, on add-in and package level) and this book is the only one on the subject - otherwise I wouldn't read it to the end for sure. Not recommended.

September 8, 2009

"Predictably Irrational: The Hidden Forces That Shape Our Decisions" by Dan Ariely. This book illustrates how different forces influence our decisions and behavior moving us away from what we truly want. How specially arranged price options influence our perception of price, how free prevents us from buying what we need and even how we are happy to do things, but not when we are paid to do them.

Through the series of thoughtful experiments and introspective writing you will learn a lot about human behavior in everyday life. It resembles Cialdini's "Influence: Science and Practice", but carefully crafted experiments set this book on the next level. Highly recommended.

See also the Predictably Irrational web site.

October 29, 2009

I've read Windows User Experience Interaction Guidelines in PDF format and I've got new perception on UI design. Spacing, aligning, grouping and separation that were insignificant, now take my attention in every dialog that I see. I started using link and separator controls. I'm now judicious about using icons in menu. I've understood real difference between error and warning messages - it's not severity, it's that warnings tell about potential problems in the future. Now I know about rules for referring to UI elements in the documentation and for composing messages to the users.

I've started learning about design. Highly recommended guide.

October 29, 2009

"Visual Studio Hacks" by James Avery. This book presents tips and tricks on using Visual Studio and extending it with additional tools. Content applies mostly to VS 2003 as the book was written in time of VS 2005 Beta.

Writing is very good and despite my extensive experience working with Visual Studio I did learn new things.

November 9, 2009

"Essential Windows Presentation Foundation" by Chris Anderson. This book explains all WPF components such as windows, controls, resources, visuals, layout, 3D, animation, media, data, templates and styles. It is not explanations in depth of course, but most important is the architectural view that Chris presents - why WPF was designed this way and how different parts of WPF support each other and interoperate.

Very good book that structured my WPF knowledge.

November 16, 2009

If you are using Visual Studio 2010 Beta 2, you might be interested in my new project Text Sharp - Visual Studio 2010 text clarity tuner.

November 24, 2009

"Programming WPF" by Chris Sells and Ian Griffiths (second edition). In depth WPF book. I found many interesting details and dark corners omitted in the other two books on WPF that I've read. Highly recommended.

December 1, 2009

"Implementation Patterns" by Kent Beck. A small book with some good advices on naming and micro refactoring. Material on Java collections performance was completely inappropriate here. There is no much Kent in this book.

December 8, 2009

"The Long Tail" by Chris Anderson. This book describes global economy change from hit market to abundant selection of products. How modern technology allows more people to be producers and enter global market. How consumers enter the same global market and how it leads to raise of "niche" personalized markets as opposed to "hit" good for everyone blockbusters. Explains why I've lost interest visiting a physical book store or a CD shop after being spoiled by online experience, why I'm listening several times more different music now than 10 years before.

Very interesting analysis, incorporating lots of data from Google, eBay, iTunes, Netflix, Amazon and blogs.

December 22, 2009

"CSS: The Missing Manual" by David Sawyer McFarland. This is my first book about CSS and I like it a lot. It answered all my newbie web designer questions: how to think in CSS, how to create standard compliant pages, how to design for different browsers, practical tips and tricks using both HTML and CSS. The book describes peculiarities of IE6, IE7, FF and Safari (being written in 2006). Content is a little wordy, but I think it is intentional - I memorized a lot of practical CSS usage (usually after reading a book I memorize only ideas).

After reading this book I've redesigned my Tabs Studio site. I changed DOCTYPE from HTML 4.01 Transitional to XHTML 1.0 Strict, created fixed width layout with borders and floated some images. Implementing new design required some additional googling, but ideas from the book created solid foundation for my work.

December 28, 2009

"The tipping point" by Malcolm Gladwell. This book is written in usual Malcolm's style - discovering unusual forces that drive our society. The theme of the book is why products, ideas and behaviors sometime explode in popularity.

Excellent writing, but I'm not sure in what category to put it - business or psychology.

December 31, 2009

"Don't Make Me Think!" by Steve Krug (Second Edition). A short book on web usability - mostly just common sense, but "Like a lot of common sense, though, it's not necessarily obvious until after someone's pointed it out to you." Indeed, I've added names to all my pages and the word home to home links on Tabs Studio site after reading it.

January 14, 2010

"Web Bloopers: 60 Common Web Design Mistakes and How to Avoid Them" by Jeff Johnson. Lots of real website screenshots from both good and bad sites. Structured catalog of common bloopers that can be used as a checklist for your own site. Covers content, navigation, forms, search and presentation. Useful guide overall.

January 27, 2010

"Inbound marketing" by Brian Halligan and Dharmesh Shah. Be social - Twitter, Facebook, Linked-in, Digg, StumbleUpon, YouTube. Create remarkable content - site and blog. Get found in Google - SEO, adwords.

Too high level for that I already know and too social for my personality to act on. At the very end of the book there are six pages of "Tips from the Trenches for Startups" that was probably more valuable for me than the rest of the book.

February 11, 2010

I've updated Text Sharp for Visual Studio 2010 RC.

February 11, 2010

You can follow me on Twitter now.

February 22, 2010

Resolved the System.TypeInitializationException at CModuleInitialize.LoadWpfGfx(CModuleInitialize* ) on customer's machine that prevented Tabs Studio from loading. It is a rare WPF error not specific to Tabs Studio that several other people also experienced according to Google. Having Process Monitor's logs from the remote machine I determined that the "HKLM\Software\Microsoft\Net Framework Setup\NDP\v3.0\Setup\Windows Presentation Foundation" registry key is missing. Copying it from a working machine resolved the problem.

March 6, 2010

My new project: Runtime Flow - The Visual Studio add-in for control flow monitoring.

March 7, 2010

"Crossing the chasm" by Geoffrey A. Moore. A serious and insightful book about high-tech products marketing. The full product idea and the market leader position required to win pragmatist customers are the most valuable lessons I learned from this book. I will also reread it later to absorb the smaller points, too numerous to grasp on the first read. Highly recommended.

May 21, 2010

"Pricing on Purpose" by Ronald J. Baker. A very educational book. The main point of the book is that you should charge your customers based on value delivered to them, not on your costs. The real value of the book is in lots of historical, philosophical and practical information about pricing and value creation. As I'm learning some economics this book was very interesting for me.

Organize Visual Studio tabs with Tabs Studio add-in