Sep 13, 2010

10 Pancakes #2

This is yet another links list, enjoy.


 - WPF Triggers, Actions, Behaviors
 - Firedrill best practices for money saving
 - Patterns for Parallel Programming for .NET 4.0 book / guidelines
 - Code Contracts
 - Rx Extensions
 - Rx for Javascript
 - Free agile trainings
 - In fact, I see none people who do "agile" and familiar with agile principles and manifesto at the same time. I wonder why...
 - And dynamic languages are driving me crazy these days, I should learn a couple:
   * http://blog.wekeroad.com/2010/08/09/csharps-new-clothes
   * http://blog.wekeroad.com/2007/08/29/the-c-makeover

Aug 25, 2010

Why I love RhinoMocks?

Well, to begin with I really do :)

Anyway, currently I am involved in several projects simultaneously. And it turned out that each project has it's own 3-rd party libraries and tools. Well, one has RhinoMocks and the other has Moq. I do not mind learning new things so I thought why not to try Moq.

Everything went well (without documentation reading) until I decided to create a mock of the сlass with "virtual" method. The test was simply to check whether the method gets called. I wrote the test and it failed. Well, I added good code - failed again. Went through the debug - failed anyway :) What could go wrong?

Here is my class I had to mock:
    public class MyViewModel : ViewModelBase    
    {
        public MyViewModel(IEventAggregator events)
        {
            this.eventAggregator = events;
            this.SubscribeToEvents();
        }

        // ... Lot's of other code.

        public virtual void VerifyCurrentView()
        {
            // Smart things here
        }
    }


The class subscribes to certain events from event aggregator and tries to call VerifyCurrentView method after events are handled.

So, how would you check whether the VerifyCurrentView method code actually gets called?
Never mind, here is how I thought I could do this:

    var vm = new Mock< MyViewModel >(events);

Guess what? The constructor never gets called in this case :( I spent an hour trying to figure this out - no luck.

Consequently, the following test (mock) does not work:

[Test]
    public void My_test_Moq_version()
    {
        var events = new EventAggregator();
        var vm = new Mock< MyViewModel >(events);


        vm.Setup(m => m.VerifyCurrentView());


        // Act
        events.GetEvent< AlertHistoryLoadedEvent >()
            .Publish(new HistoryTypeInfo[0]);


        vm.VerifyAll();
    }

And I had no idea why it was happening and neither a desire to know "the truth". I spent another 5 minutes to write the same with RhinoMocks:

[Test]
        public void My_test()
        {
            var events = new EventAggregator();
            var vm = MockRepository.GenerateMock(events);


            // Act
            events.GetEvent()
                  .Publish(new HistoryTypeInfo[0]);


            vm.AssertWasCalled(c => c.VerifyCurrentView());
        }

And it works! Just like that.
RhinoMocks just rocks!

10 Pancakes #1

It has been a while since my last post. I think I will be posing more in the future, we will see :)

Anyway, today I would like to start a new ideas that I tried to put off too long time for now. You see, I find too much of interesting stuff every day and I cannot simply throw it to everybody via IM and e-mails.

Starting this week I will be posting links I went through and think would be beneficial to my friends, colleagues and other good people.

So, here is the first 10 links:
 - Scrum check-list 2010 free e-book:
 - New Uncle Bob Martin blog - the clean coder
 - Scott Hanselman over Effectiveness and Efficiency
 - SICP Book
 - Pro HTML5 book excerpt - Chapter 6
 - New Embedded DB for .Net - EffiProz
 - Managed Esent DB for .Net
 - RavenDb
 - The blog of Managed Esent author

May 6, 2010

Power Tools for Visual Studio 2010

Microsoft has gathered all power tools together on one site. Great!
So, whenever you need one of those go there to get it:

  • http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx


Have fun with it!

PS: Until Rob Conery will create a better tool just for you.

Apr 27, 2010

VSTS 2010: CodeContracts Issue

If you are unable to create any projects in Visual Studio 2010 after installing the "latest" CodeContracts build then the following link might help you to solve it pretty fast:
 - http://social.msdn.microsoft.com/Forums/en/codecontracts/thread/5cb13a3e-811c-45f9-b7a8-09c39979acd6

Mar 4, 2010

Job Invitation Dear

Hey! What you feel being invited to work for someone in the following way?

"We have a high growth of demand for development. A lot of projects are using this technology now. Much more are coming. You have a chance to join the newly formed expertise excellence department that will incorporate the technology experience in it. If you are keen of this technology it is the high time to jump in and take part in tremendous growth of expertise"

Do you feel excited?
Do you feel challenged?
Do you see opportunities?
Me? No, I do not! Do you know why?

Well, the famous Joel Spolsky said about it a lot already. You see, there should be something in the job post. There should be something in the employer, you know? I do not mean that everyone should strive for uniqueness, but trust me - if your company is able to interest someone to work for them only by using the job invitation then they probably can hire anyone to work with you.

Remember the quote in the beginning? How about this one?

"We have a high growth of demand for development [in the universe]. A lot of projects are using this technology now [in the universe]. Much more are coming [guess where to? to the universe]. You have a chance to join the newly formed expertise excellence department [in the universe] that will incorporate the technology experience in it. If you are keen of this technology it is the high time to jump in and take part in tremendous growth of expertise [in the universe]"

Does it sound somehow differently? You see, nothing has changed since I added the company name (the universe). The context did not change. The meaning left the same. There should be a difference. It just should be. If it does not, you lose. Because this is just the name, the name of your company is the only thing that makes your company different. This is it.

Jan 24, 2010

User Interface Design and Architecture

Not so long ago I started to deep into UI design and architecture, the process, tools, best practices and so on. The reason was simple, as soon as I started figuring out how to do great software I quickly found that the software should do the "right thing". And by doing the "right thing" it should show this thing, make it available for the end user, make him or her understand how it works without reading the specs or how-to material, do the thing, explain all steps, errors, warnings, show the result and finally the software should have a super cool and flashy look.

Well, as I started to look into details of what I was thinking about the more and more materials I started to find. Here, on this page I will try to gather the materials I, for some reason, found useful. And I do this for a very simple reason, not to find it again, because... you know, sometimes it is extremely hard to find good stuff even with Google.

Videos

Books

Articles

Tools
Extremely useful tools will be referenced here.

And of course, I am very thankful for your feedback and help! Thank you very much!

Update: 04/10 - Added "color" articles' links

Aug 20, 2009

Test more, document less

Today, one guy from my test team said that the documentation is not very important for him. The thing is that used to write very extensive documentation. Lot's of details were covered. A lot of knowledge were put into one document - one for each requirement.

Unfortunately, as people start working, the different aspects of a requirement will likely to change - the user interface, the data bounds, important functionality gets added, redundant things gets removed or redone. Anyways, something changes. All these changes are being tracked by people during the work process, on the communication level - as it is the most efficient way to share things. But the documentation remains intact, and the problem is - it gets old, retired, and then I simply delete it or reqrite anew one.

Anyway, the process of getting a very good document is pretty complicated, and boring.

On the other hand, the documentation is an important artifact on the project. As it has information right about the thing it describes. So it helps people work - they know how to do their job from the documenation.

I may be reaching out from the point I started. They guy said he does not need the documents any more. What's changed?

The thing is that we introduced a scrum-like two-week iterations some time ago. But there was a problem. As soon as we released a build, let's say three days before the release - we had plenty of problems right away. As a result, a number of iterations were blown up, the date were shifted to the future, customers put on hold, etc.

Therefore, we dicided to perform a two-phase testing. The first phase, it when the feature gets implemented - the build is being moved to the development (!) server where tester can look at it, study it, suggest (!) improvements or report bugs. The second one, when the build if ninaly gets released with all features planned for the iteration. This time we do integration testing (?) and verify that everything is performing correctly.

The outcome is amazing:
  • testers study functionality by using it, not making guesses from documentation
  • we reduce risks failing the deadlines by performing additional verification
  • we reduce risks of deployment failures, as we do it more often
  • testing takes the same time as it would take it we did regular "develop, then verify" process
  • now we can think how we can make our documentation more efficient, so it would not go on retirement

Aug 19, 2009

Open Source and Commercial Software

Many people would like to use open source frameworks and tools, however, for a certain reason they choose something they can call commercial software and pay money the same quality product.

One of the "benefits" of commercial products sounds similar to the following:
commercial product has support so I know whom to contact when I will be trouble (be sure you will %99), while open source has no support

OK, while this may be true think of the followin please: do you compare equal products. I can think of both products as equal when I have commercial product on one side and open source product with active development on the other. Assuming open source is in active development I can conclude it has the very support we did not saw earlier, hasn't it?

The other argument, again:
commercial product has support that can promise me a deadline...


Yeah, guys, do you really think that something is different with planning in open source software? I guess not. The planning is done as we usually do for our projects. Same ideas applies to the mighty commercial software we tend to buy instead of using the one that is useful and at no cost.

Anyway, it is your choice. Just think of it, please.