RSS
 

A good basis for unit testing

13 Apr

Over time, one developers techniques and habits that “just work”. In this post, I would like to share with you a set of base classes that I’ve been using and refining over time. They make my Unit Test writing a little more efficient and easy on the eyes.

The base of the base

I often start a new software project by setting up some form of base unit test class with functionality that I know I will be using, such as using embedded resource documents, various kinds of verifiers, test names etc. I usually name this class “BaseUnitTest”. This blog post will not be focussing on this base of bases, but to give you an idea, this is roughly how it starts out.

public class BaseUnitTest
{
    private Assembly _testAssembly;
    public EmbeddedResourceManger ResourceManager { get; internal set; }
    public IoVerificationManager IoVerifier { get; internal set; }

    public BaseUnitTest ()
    {
        _testAssembly = Assembly.GetCallingAssembly();
        ResourceManager = new EmbeddedResourceManger(_testAssembly);

        IoVerifier = new IoVerificationManager();
    }
}

I usually add on methods to this class in the form of Verfiers of different sorts. A handy base class for your Unit  Tests is not the scope of this blog though…

Wrapping AutoMocking and Instance creation with BasedOn<T>

Now follows the real nugget. A base class for your unit tests that uses StuctureMap’s AutoMocker to construct a nice, testable innstance of the class under test.

[TestClass]
public abstract class BasedOn<TInstance> : BaseUnitTest where TInstance : class
{
    public MoqAutoMocker<TInstance> AutoMocker { get; internal set; }
    public TInstance Instance { get; internal set; }

    [TestInitialize]
    public void RunBeforeEachTest()
    {
        AutoMocker = new MoqAutoMocker<TInstance>();

        OverrideMocks();

        Instance = AutoMocker.ClassUnderTest;

        ExecuteBeforeEachTest();
    }

    public Mock<TInterface> GetMockFor<TInterface>() where TInterface : class
    {
        return Mock.Get(AutoMocker.Get<TInterface>());
    }

    /// <summary>
    /// Use this from your OverrideMocks() method so that all replacements are made before
    /// the Instance is created
    /// </summary>
    public void Replace<TInterface>(TInterface with) where TInterface: class
    {
        AutoMocker.Inject<TInterface>(with);
    }

    public virtual void OverrideMocks()
    {
    }

    public virtual void ExecuteBeforeEachTest()
    {
    }
}

How it works

The BasedOn<T> class defines an AutoMocker for the class that will be tested as well as a member named ‘Instance’ that is used in the unit tests. The method RunBeforeEachTest() is attributed with [TestInialize] so that it will execute prior to each unit test.

Note: Because this attribute is used in the baseclass, you cannot re-attribute any method in your derived unit test class. That is why there is a method named ExecuteBeforeEachTest() that you can override to accomodate your Unit testing needs.

If you need to prepare a special Mock or stub into the class you are testing, you can override the method OverrideMocks() in your unit test class – this method is executed just before the Instance member is created. The method Replace<T>(T with) is meant to be used for this very purpose.

Example of use

The class PersonManager is a business layer service that handles Person objects. In the following example, we are setting up a Unit test to ensure that person objects that do not have surnames cannot be updated. Using the BasedOn<T> base class:

[TestClass]
public class PersonManagerTests : BasedOn<PersonManager>
{
    [TestMethod]
    public void UpdatePerson_PersonHasNoLastName_DoesNotInvokeRepositoryUpdate()
    {
        // Arrange
        var testPerson = new Person();

        // Act
        Instance.UpdatePerson(testPerson);

        // Assert
        var repoMock = GetMockFor<IPersonRepository>();
        repoMock.Verify(o => o.Update(testPerson), Times.Never());
    }
}

In the next example, I am preparing the repository to throw an exception to verify
that an exception uses the logger interface:
 
[TestMethod]
public void Create_RepositoryThrowsException_ErrorMessageIsLogged()
{
    // Arrange
    var somePerson       = new Person();
    string exceptionText = "Something really bad just happened";
    var someException    = new Exception(exceptionText);
    var repoMock         = GetMockFor<IPersonRepository>();

    repoMock.Setup(o => o.Create(somePerson)).Throws(someException);

    // Act
    Instance.Create(somePerson);

    // Assert
    var loggerMock = GetMockFor<ILogger>();
    loggerMock.Verify(o => o.LogException(exceptionText), Times.Once());
}
 

The magic performed by AutoMocker combined with a relatively simple base class has helped me immensly in making my tests more readable – and for others to read! At the time of this writing, AutoMocker supports Moq, Castle, and TypeMock.

For those classes that you do not want automocked, you can always bypass the BasedOn<T> class and inherit the BaseUnitTest directly for access to the test helper methods and verifiers.

Smilefjes

 
 

Smart Reflection with dynamic type in .Net 4.0

05 Mar

A collegue of mine at my current project in NRK showed me how to use the dynamic keyword in C# to perform dynamic casting from a base type to a derived type. I just had to share!

The example starts with the following hierarchy of types:

public class Person{
}

public class Police : Person {
}

public class Fireman : Person{
}

The heart of the matter

Typically, you will have a controller/manager class that calls different workers based on the type of object at hand. In ASP.NET, for example, you may have a controller that will return a different rendering of a view based on the 
type of person to render. In its simplest form, the following 3 functions could form such a controller:
public void Draw(Person p) {
    Console.WriteLine("Drawing a generic person");
}

public void Draw(Police police)    {
    Console.WriteLine("Drawing the police");
}

public void Draw(Fireman fireman) {
    Console.WriteLine("Drawing a firefighter");
}
Easy peasy, you say and proceed to write some test code: 
// Arrange
var people = new List<Person>{
    new Person(),
    new Police(),
    new Fireman()
};
// Act
foreach (Person p in people)
    Draw(p);
Do you see the problem?

…the above code will issue 3 calls to the function that draws the base person type. The other two functions are never called. This is self-explanatory, since the foreach loop defines a Person reference. Using var has the same effect, because it is getting populated from a list of Person objects. The compiler simply does not see the Police or Firemen objects.

Now, if you change the foreach-loop to this:

// Act
foreach (dynamic p in people)
    Draw(p);

(use of the dynamic keyword requires that you add a reference to Microsoft.CSharp and System.Core)

The dynamic keyword is strongly typed, but, the compiler is told that the type of object, p will be determined at runtime, and not during compile time, thus each person object in the list will become a strongly typed police and fireman during runtime, similar to dynamic_cast in c++ (damned near identical if you ask me!)

Concerns

Any type of run-time-type checking will involve reflection in some form or another, however, Microsoft has gone a long way in ensuring that this is second-generation reflection, using a funky named tri-state cache to keep things fast. Another concern, of course, is that you can always cast any type to dynamic without compile-time checking, so you basically want to ensure 100% coverage by unit tests as well as ensure that the unit tests will catch type-mismatches.

Conclusion

Using the dynamic keyword will clean up the code considerably at the cost of having to keep in mind that you wil have no compile time checking of any lines of code that involve the dynamic keyword, so make sure you write those unit tests. Additionally, because this is run-time checking, you should consider other options if you depend on faster code, but for most of your code, the performance impact is non-measurable.

More on dynamic keyword here – Official documentation on MSDN

Dissecting the C# 4.0 Dynamic programming – Good article about the inner workings of dynamic

 
 

Faster and Slower

12 Feb

Growing concerns about the direction of Xaml-based applications

Microsoft, what the hell do you think you are doing by diverging WPF, Silverlight and Silverlight for WP7?? None of those 3 destination platforms have any solid foothold as of yet. By making different options of XAML available in different destination platforms, you’re only doing one thing: pissing off developers. Stop doing that, this is really simple:

WPF

imagesCA28TSXTWPF should be the mother of all xaml based apps and have every available technology to it – including webcam support as in silverlight, MEF, etc. WPF needs to be that “unlimited” target platform from which both silverlight and WP7 pick their features from.

Silverlight

imagesCA197ISS

Why oh why can I not use data triggers in SL? What is the reasoning for it? I know MS has “shifted focus” for Silverlight. This, in my ears, is bull. Silverlight on iOS and Android will give developers reason to use it. WPF alone cannot succeed as the only xaml-based platform, and SL makes sense for servicing the current craze of tablets and smart phones. Very few people will disagree when I say that MS powered devices (tablets and phones) are lagging far, far behind. For SL to be a success, it needs to penetrate iOS and Android. End of story. rest is just bull.

Silverlight for WP7

phone7I accept that SilverLight for windows Phone 7 will offer different capabilities from Silverlight as a xap, but what I don’t get is why this version of Silverlight has to be a framework behind the current release of Silverlight web?? It makes no sense, whatsoever to keep developers in confusion station by not holding back releases until the technology is ready on all platforms!

Converge now!

What Microsoft needs to do, is to hold back releases, so they can do a unified XAML platform upgrade targetting windows, SL and WP7 with the same developer options and syntax. No data trigger support for WP7 means dont release it for Windows or SL either! This is FAR better for developers than the mess you’re giving us now! XAML as a developer platform, needs a unified version number, we dont want to have WPF for .Net 4.0, Silverlight 5.0 for web and SL 3.5 gutted for WP7. 

So, where was I?

You may have notice that digitaldias was down for a week or two.

I’ve been using an SHDSL line (Single-Pair High-speed Digital Subscriber Line) for the last 6 years, giving me a whopping 2Mbit in both directions!

Recently, though, I’ve been on the lookout for higher download speeds, as iPads, laptops, and even the PS3 consume more and more information from the web. When I was offered the option of 20Mbit down, and 1Mbit up for much less moolah, I took it.

My blogs will load at half speed (as if you care!), but then again, I dont connect back to my office over VPN anymore, so I dodn’t have any good excuse to pay that much for a decent speed out anymore.

I still want higher output speed, for using skype in HD, but that’ll have to come when the prices (and availability) fits.

Logo

My ISP, Nextgentel delivered fast and reasonably priced this time. For that, they get a nice, well deserved kudos from me Smile

 

Hosting a Silverlight app in Azure

07 Nov

A quick introduction to how you can get up and running with Microsoft Azure – It is a hands-on guide into creating a silverlight application that uses a REST api to manage SQL data in the cloud.

Who should read this:

This article assumes that:

  • You know (and love!!) the SOLID programming principles
  • You know what WCF is and how to host and consume such services through IIS
  • You have some knowledge of the Entity Framework ORM
  • You want to get something out on windows Azure, but you’re not quite sure how to

 

The concept

I am writing an inventorizer application. The idea is to keep track of my movies and to know where in my house they are supposed to be. This way, I know where to put a stray movie, as well as check that all movies that are supposed to be in a specific shelf actually are there.

Later, I will extend the application to access my movie list from mobile devices, so it’s going to require a REST api right from the start.

Entities and storage

To get started, I defined 3 basic entities for my application:

Entity Detail
Location Room / Area in my home
Storage Shelf, drawer, box, etc. Exists inside a Location
Movie Stored inside a piece of storage

 

Using Entity Framework, I started by creating a model from a blank database:

image

I’ve explicitly given the entities the prefix “Db” in order to separate the objects from my C# domain objects.  Automapper does the conversion for me – pretty straightforward. I keep my domain objects clean, and clear of the Sql Server, as you should too.

SQL Azure

To work with SQL Azure, you need to have a valid Azure account and you also need to have created a database for the purpose. I won’t go into the details of the database creation process; basically, you follow a database creation wizard that does what you expect it to.

Once created, you want to connect your Visual Studio Server explorer to this newly created database. To do that, you first allow yourself through SQL Azures firewall, which is fairly simple, flip to the Firewall Settings tab and click on the button “Add Rule” which brings up this:

 image

Complete the firewall rule by setting your IP number then click OK and flip back to the databases tab to get a connection string:

imageThe connection string does not have your password in it. You’ll have to edit that in after you put it in your settings file. If you need help in pushing your model to Azure SQL, just drop me a line, and I’ll help you out.

Setting up the REST service

Setting up the REST service is a mattter of

  1. Defining your service interface
  2. Implementing the service in some class
  3. Setting up the service endpoint configuration in your service configuration file

Important note:
In order to implement REST and use WebGet and such, you need to include a reference to System.ServiceModel.Web. Make sure in your project properties that you’ve selected the full .Net Framework 4.0 and not the .Net Framework 4.0 Client profile as your target framework, or System.ServiceModel.Web won’t be visible for you to reference.

Defining the service interface

Not much hassle here, the special consideration is the REST way of making the endpoints accessible:

image

Implementing the service

Since we started with the EF model, implementing the service simply means creating a repository interface (for convenience) and then implementing it with the generated context class

image

Setting up the service endpoint configuration

To roll out a successful REST service that serves both POX (plain old xml) and JSON data, I had to actually create two different binding configurations even though they’re equal in configuration.

image
Second, set up a couple of behaviors, differenciating only in the default response format:

image
Finally, set up the endpoints you need:
image

Since we are hosting this in Azure, we do not specify any addresses.

Creating the client

Now that both the database and REST API is up and running, you only need to create a regular silverlight client, point it to the service, and you’re in business. I actually created a SOAP endpoint in addition to the POX and JSON addresses since I do not need to box data between .Net clients, thus my Silverlight client config has the following service reference:
image
Notice the relative address, since I’m hositing the Silverlight client from the same location as the service, I use the relative address to avoid cross-domain issues. This took me some time to figure out. I usually start out with a basicHttpBinding and then swap over to TCP/IP once everything is up and ok.

If you need more details on how to write a silverlight client, just drop me a message.

Azure considerations

So, having completed, tested, and debugged the project here on earth, it was time to deploy the pacakge to Azure. There was one last remaining thing to do, and that is to put a checkmark on your Sql Azure configuration screen in order to allow your services to connect to the database:

image
This is definetely another one of those “easy to forget, hard to figure out” things…

Integration Testing

I wanted to have a set of integration tests that directly referenced the SQL Azure database without destroying any data, so I opted for the transaction approach where you basically begin a transaction before each test, and then roll back all changes after running it. This led me to the following base class:

image

The base class basically implements the TestInitialize and TestCleanup methods to begin a transaction before each test, and roll it back (Dispose()) after each test has run. Any test that throws an exception will then automatically roll back the database.

TIP:
If you use the TestInitialize or TestCleanup in a base class, your derived test class won’t be able to use those attributes. This is why I added the virtual Given() function so that I can do my test setup there, should I need to.

An example of use:
image

The testclass above creates an instance of the class StorageRepositorySql and the test that is run is then packaged inside a transaction scope and rolled back so to not disturb my SQL server data. If you want more details on the base class, just let me know.

Running these tests is surprisingly fast, on my 2Mbit internet line, most of my tests run for less than 50ms each, which is pretty amazing, considering the transactions and that I’m in Norway while the Azure store probably is in Ireland!

Conclusion

Microsoft promises that “going Azure” should be pretty straightforward, and not much different from what you’re already used to. I tend to agree, it has been surprisingly easy to get something up there and running. Most of the challenges were actually in configuring the REST endpoints and figuring out how to allow the WCF services to access the SQL database, but other than that, the rest is straightforward.

At the end of this article, I’ve prepared a short Silverlight application that simply lists the locations in my SQL Server. It should be available through the following URL:

http://digitaldias.cloudapp.net

However, since this is work in progress, you may see a more advanced thing on this page as my application progresses, or something completely different, or, perhaps nothing at all – I make no guarantees, other than that it should be there if this article isn’t too old Smile 

P.

 
1 Comment

Posted in .Net, cars, Eating, Work

 

Watt’s a dog?

31 Oct

- “Yes he is”

My old blog server was sucking out roughly 700 Watts/Hour. By buying a new, modern, cheap PC, I’ve reduced the cost of hosting my own blog to 1/10th of what I was paying!

How much was the old server costing me?

700 watts on idle setting means 0.7 kWh, 24 hours a day, 365 days a year = ~6100 Kwh per year! This was an age-old Compaq Proliant Server with two power supplies and a series of cooling fans – not only did it pollute my power bill, it also made a serious amount of noise!

Given today’s power prices, that means roughly  3,000 NOK ( 368 EUR / 511 USD) per year just for having my blog available 24/7! Something had to be done, and fast!

Options

I started to look for a replacement by checking out some servers, but most of these use around 200W of power, and were fairly expensive compared to desktop PC’s (I wanted at least a dual core and 2GB RAM)

I looked into a few Windows Home Servers, but  frankly, I need IIS7, and dont want to limit myself to what I can do on that platform. It is a point, however, that Home Server CAN host WordPress, and HP MediaSmart is rumored to use around 80W/hour, which is not bad at all!

Cheap desktop PC to the rescue

I landed on a cheap-ish Packard Bell iMedia PC (image below) that looked like a match for the job. Priced at roughly the same as a year worth of server power, I got a dual-core AMD processor with 3GB of ram and some 300GB of drive space. plenty  for hosting IIS7 and WordPress on MySql, and no restrictions in case I want to deploy an ASP.NET application or two.

Packard Bell imedia Desktop PC

Once at home, I hooked it up to my watt meter and low and behold, the darned thing does not use more than 50W on balanced setting (around 62W on high performance setting)

50W is a number I can live with 24/7!! I’ve got lightbulbs that use more than that! New cost per year (in power):

238 NOK ( 29 EUR /  40 USD)

That is less than the monthly fee for using one of the cheaper web-hotels out there!

 

Conclusion

Investing roughly a year’s worth of electrical power to my old web-server, I was able to cut the power consumption of my blog to 1/10th. Since I don’t have that much traffic, the hardware is more than able to respond to my needs, and I got rid of that old, noisy huge box that was doing nothing but costing me money. Less electricity spent = more frogs to kiss somewhere…

You’re actually reading this on the new hardware right now!

 
 

Testing Windows Phone 7 class libraries with MSTest

18 Aug

In this post, I explain how you can unit-test your Silverlight and Windows Phone 7 class libraries using MSTest and the built-in test system of VS2010, enabling you to right-click a test to run it.

image I am a test driven developer, and simply hate the testing harnesses available to SilverLight (SL) and Phone 7 (wp7) development enviroments. I do believe that Microsoft should make it a priority to allow MSTest to execute the class libraries written for other language runtimes than the CLR in windows, but that is a side issue.

Today I bring you my proposal for a workaround.

Origin

I wrote a helloWorld application for wp7, and downloaded Roger Peter’s cheat sheet for unit testing apps this platform. The stuff does work, but looks highly impractical in my view – mostly due to the lack of screen estate, but also because it does not integrate with the Visual Studio 2010 test harness.

 

The key is in the link

The trick to getting your logic tested is to link the source files into a new, regular window class library project. Here’s the recepy:

  1. Hatch an idea for a wp7 app (or SL) with the potential to rule the world (don’t they all?)
  2. Create a solution for your application, and add a wp7 Project
  3. Add another wp7 project for your tests
  4. Create a regular Windows Class Library and choose to add existing item. Pay close attention to the drop-down arrow on the ADD button. Use this to select “Add as Link”
    image
  5. Do this for all the classes that you wish to test

 

Within your project, you should see the linked files marked with a small arrow, marking it as linked:
image

It mostly works!

Having done this, you now have a regular windows class library that you can use to unit test the logic of your application using MSTest. As an added bonus, should you want to create a wpf applicaton later, you can, of course, re-use code in this way for cross-target platform work.

Changes done to the linked file happen only in the original file, so you can now drive the logic in your class file with unit tests by using your unit testing framework of preference.

image

Why it has a smell to it

This is still somewhat smelly workaround, consider that you cannot unit-test wp7/SL specific functionality. It is only a workaround that applies to code that compiles to windows and wp7/SL at the same time. Having said that – if you follow the SOLID principles, you should not have any problems unit-testing most of your code, it would only be the platform specific parts and GUI that you leave to the lacking test harness, for those you can safely use the recommended test harnesses, such as the one proposed by Roger Peter.

The perfect solution would, of course be to have MSTest support these other runtimes as a silent simulator or something.

 

Ranting over change – an exercise in futility?

12 Aug

I’m an avid blog reader/commenter and have seen the rise of a wave of rants about Microsoft’s LightSwitch and Microsoft WebMatrix. These are products designed to make writing windows applications as well as web pages even easier than it already is, making the process of creation accessible to more people than ever. Some express direct rage about this, others are concerned about their bread & butter.

 

"State of the Art" Amiga Demo, winner of The Party 1992I’ve been around since the ZX81 (in excess of 26 years) as a developer, flipping through an endless plethora of developer languages.
In those days, developers learned assembler first, after a few months of punching in BASIC code from a dubious UK-based computer magazine.

Remember all those cool demo’s on the Spectrum/C64 and later Amiga scenes? 90% of’em were done in pure assembler! Pascal was hot for a short while before yielding to C/C++ .

 

I switched over to the Microsoft platform sometime during the MSDOS / Windows 3.11 era.
(i386SX without a floating point processor!)
In my opinion, the moment you loose control over the CPU’s registers and/or it’s memory, is the moment you lost control.

MSIL/BYTECODE languages (java, C#, VB…), interpreted languages (ruby, python) are not ,  by that definition, "pure" languages. They take away control from the developer in order to prevent the developer from making mistakes that tear down all of it’s surrounding applications (and often, the OS). Actually, when I come to think of it, even Assembler takes away some control in that you can no longer address invalid registers, or shift memory to non-existing locations without a compiler error.

Time, money, and big feet

How often do I read how "messy" C++ is because you have to handle the memory yourself. The fact of the matter is that C++ requires a strong sense of discipline; if you understand the language, then you can write Greedy brains!applications that make the best Java and .Net apps look really, really neandrathal, in terms of anything! (performance, memory footprint, program size…) – at the cost of time!

And let’s just say, when people started enrolling in developer classes in the 90′s, it wasn’t because they had a sudden geek awakening, they saw money in software business, and wanted to be a part of it. Today, they’re the vast majority of developers out there. Microsoft makes money on software licenses. It is only natural that they write code for these masses.

But at the cost of performance and memory footprint, C#, Java and other languages make our everyday easier; I can whip out a complete, working business application mockup in a day or two using modern tools (SilverLight/SketchFlow). I used to be employed in a large consultant business where the vast majority of solutions delivered were MS Access "applications".

 

So what makes it all good enough?
- Solving the customer’s problem.

 

Conventional Purist Pattern Pride

In all our purism, dogmas, theorems and idelogies, the fundamental truth is: The customer doesen’t give a rat’s jewels about how you solve his problem! He looks at you as being a huge expense that has to be made, nothing more. If you can satisfy his needs with a technical solution that is less expensive than the competition, then you’re more than likely to have a satisfied customer. Ayende has a great image on his rant on this – really boils it down to the essence!
I am a purist myself, make no mistake about that,  I do take pride in my software craftmansship, but I’ve also seen so much “bad” sofware out there, and the customer is happy!
- At the end of the day, that’s really all that matters!

For long running, or high-risk software that requires quality;
I more than often see that it really just boils down to convention. Patterns tend to be tweaked around to circumvene technical limitation, or even more common, user ignorance. Who does not have a “Tweaked” MVP pattern, or a “somewhat modified version of” MVC.. recognize yourself? 

My opinion is that it is you, and not the software, that sets the standards. Just like a carpenter, if you do not have pride in the work you do, you simply cannot deliver quality software, regardless of how good tools you have. Granted, using a nailgun instead of a hammer, you can still produce cleaner looking wallboards without the dents and bruises of 60 missed hammerhits, but if your nails are spread around shotgun style, you know that wall aint gonna last long anyway.

MetaProcess, MetaDeliver, MetaWin:

Microsoft is making it easier and easier to shovel out software that requires less skill to develop with products like LightSwitch. Is this bad?
I say – “No, that isnt necessarily bad”

ANY “good” software has undergone the following metaprocess:

  • Have a clear definition of application’s domain (what does it do?)
  • Plan for re-use and upgradeability(modularity) where possible
  • Make the application as maintainable as possible (clean code, clear intentions, refactor)
  • Cover your application’s functionality with tests(TDD, DDD, DDT)

Neither language, nor technology have any impact on this metaprocess.

meta-tag-seo

What is important, is that the technology’s operator understands the technology (a question of syntax and experience). If it helps me deliver software at a lower cost without compromising my craftmansship, then by all means, give it here!

In my view, WebPrism and LightSwitch must also undergo the same metaprocess in order to be developer platforms that are usable for corporate offices.

 

Some references (Links go directly to the articles):

InfoQ article

The Inquisitive Coder

Jason Zanders WebLog

PCWorld.com

Ayende’s Blog

 

Finally caved – site now hosted by WordPress

25 Jul

It took me a while – 14 years to be exact – to leave the concept of writing my own home page and instead just use something ready made. You can still look up what is left of my most recent site by clicking on this here text, but I wont make any promises about it staying there for long.

I am still hosting the site though, the wordpress server is running locally on my MySql database.

As you can tell, I was already using asp.net to display the contents of my wordpress blog on my homepage by nosing into WP’s database – but I was finding the solution ugly, and to be able to comment, you still had to navigate to the WP page and use the functionality there.

So, instead, I will add any relevant links here on this page, presumably, the guestbook will be one of the first linkes that I will redesign, and expect me to do a whole lot more with the photography bit. As it is now, its completely uselss.

So, I hope you all like it, I found a theme that I find easy on the eyes, comments should be a whole lot easier to write for you all now.

Oh, and by the way, Lego’ homepage is still where it was at …

Cheers!

 

Time to play with Lego!

17 Jul

I’ve always had this distinct notion that my house will not be without a pet. So when we lost Quita, we soon started to look around kennels to see if any of them had a fresh litter with puppies for sale. Some of you may recall that Quita came into our house  the moment we learned that Bella had cancer, they spent 3 wonderful months together before Bella finally yielded to her disease.

Not many days after, we found Lego, a Cavalier King Charles Spaniel, who was born on May the 20th, he was one of two males left in a litter of five. He is the firstborn, and has a distinct white-ish color on the tip of his two back paws.

Why the small race, you say?

As some of you know, Both Quita and Bella were a Doberman breed, and I have to admit, I do love them, but our local county law (Skedsmo kommune) introduced a “leash all year, everywhere” rule that basically makes life miserable for medium and large-sized dogs. Dogs need to run free, and to be able to socialize with other dogs in playing with them, and not being only restricted to a quick whiff at the end of a tight leash. This only makes dogs more aggressive.

Rules like this have no meaning – there is no wildlife near my town that need this type of protection. There are no farms with animals nearby that warrant this law. Do we need a law to protect people from dogs?? –  if so, it is  an epic declaration of fail for humanity! 

 

Coming home

We picked Lego up yesterday, at 8 weeks of age. He was the last of his litter to abandon the home. All of his siblings left the house the day before. In a way,  that was a good thing. Lego slept alone in his crib for a night in known surroundings. His mom even started to reject him (as they do when the pups reach this age) so I feel we got him at the optimal time! First born, and last to leave.

BUT – I’m not going to write too much about Lego on this site.

He was first born, but last to leave his home. In our waiting, we created Lego’s own news page, so that you can follow his progress.

So point your browser to http://lego.digitaldias.com for news, updates and photos of Lego. That’s where the news will be – for convenience, it’s also a WordPress blog, so you can point your favourite newsreader to it and get the news when they are fresh!

Happy summer!

Pedro & Lego

 

My dear Quita is dead

25 Jun

Quita

My dearest dog Quita, or Strolls Querida, as was her full name, is dead.

We joked about how Quita was born in a bucket of fuel, she was allways happy, crazy, but with a very short attention span.

Over the years, there had been a few minor incidents where she’d bark or even nibble at someone as a perfectly reasonable reaction to something sudden, such as someone accidentally stepping on her, but never a brawl, or anything major.

Last year, Quita began showing more hostility after a period of false maternity, she took a few rubber pets as her children, and behaved agressively (barking) against every person and animal she laid eyes on. Our veterinary recommended we remove the pets, and low and behold, we saw a completely different dog, much calmer, docile than she had ben for the last 2-3 years!

Then we took a trip to Germany, and on the way back, she bit a stranger in the leg. The bite itself is excusable – she was eating out the back of the car when the person almost stumbled over her. It was only skin-deep, so she did hold back, but the episode was enough to put a deep scare into me and Bergfrid. A few days ago, she scared my neighbour as he walked by our entrance, she charged at him, barking and missed him only by a meter when her leash stopped her from getting at him. This is what sparked us to get to the veterinary to have a talk.

Quita in the hallway

The veterinary knows Quita well, as he has been her exclusive veterinary ever since she came into our home. We have visited him at least twice a year for the last 5 years, and so he knows her history well, and was pretty firm in his conclusion: She’s too old to be of value to the police/military, and to give her away to some other family is just going to be handing the problems over to them. We were left with the choice of limiting her life further by incarcerating her movements even more (more at home, tied up when we have visitors etc) or just ending it.

Knowing her inside out made the choice easy. Quita loves to run and socialize. To take that away from her would mean to make her life miserable, so we decided to end her life there, before we got back home and started regretting it, and potensially risk a catastrophe when some kid playing ball accidentally ran into our garden while Quita was in there.

The veterinary found a nice room for us, and gave Quita an injection with a heavy muscle relaxant so that she would feel relaxed and drowsy. He then left, so that we could make our goodbyes, and then came back around half an hour later for the final, lethal injection. This put her out almost immediately, there was no cramps or anything. We stayed with her until she was getting cold.

P1010080

It is not possible for me to explain how much Quita meant to me. It is true what they say: “You cannot possibly grasp what a best-friend is unless you’ve had a dog”.

The attachment, joy, and companionship that Quita gave will be so, oh so missed!

It was the right decision to make, but  it’s a whole lot easier to say than to do. It was possibly the hardest decision that I’ve made,

-ever.

 
3 Comments

Posted in Quita