A big thank you to TekPub

by Chris Nicola 28. August 2010 14:43

If you have not heard of TekPub yet, I recommend you give it a whirl.  TekPub is a site with video learning for various software development technologies.  Topics include MVC, nHibernate, Git, JQuery, Rails and more.

The videos are a great way to get started but they are also fairly in depth.  Most series contain 8 or more videos so they are very good for taking your first deep dive into a particular technology.

TekPub also gives back by sponsoring various user groups, now including ALT.NET Vancouver.  They will be providing us with one-day subscription coupons which we will start to give away at monthly meet-ups and events.  So on behalf of everyone who is a part of ALT.NET Vancouver I want to thank TekPub.

Tags: ,

ALT.NET

Summer's almost over, it's conference time

by Chris Nicola 28. August 2010 10:46

Well it's almost Fall in Vancouver, and that means both TechDays and the Agile Vancouver: Much Ado about Agile conferences are coming up.  Last year unfortunately I missed TechDays, but I am fortunate this year to have the opportunity to go to both.

I will actually be speaking at TechDays in the "Local Flavors" track, which consists of speakers from here in Vancouver.  I'll be giving a talk on CQRS and how to leverage the pattern to achieve greater reversibility in software designs.

I recently received the draft program for Agile Vancouver and once again it has an amazing line-up of speakers.  I don't want to spill the beans before they post it though so I'll post a link as soon as I know it's official.  I can say that there will be an Open Spaces portion on the Friday that will be faciliated by Adam Dymitruk, Robert Reppel and myself. 

I am excited to be involved in both Agile Vancouver and TechDays.  I highly recommend attending both of them, they are great opportunities to learn and discuss and on the topic of discussions, there is a good chance that there will be one or two 'extra-curricular' (think #altnetbeers) events happening.  So be sure to keep an eye out for announcements either here or at ALT.NET Vancouver.

Time to get back to preparing slides.

logo techdays_canada

Tags: , , ,

Agile | ALT.NET | Events

CQRS: From NoSQL to NoDB

by Chris Nicola 2. August 2010 10:41
ncqrs This weekend I spent most of my Sunday working on a filesystem based provider for nCQRS, something largely inspired by some work @adymitruk did recently.  I've done this for a few reasons:

  • To provide a quick and simple way for people to get up and running with NCQRS and test locally
  • To allow developers minimize their reliance on third-party DB providers
  • Make nCQRS more web-hosting friendly (you won't find many providers supporting .NET and MongoDB)
  • Make a point, that using CQRS is not nearly as complex an architecture as some out there would have you believe.

The core idea behind NoSQL is not to facilitate the CQRS pattern (though they often go hand in hand), rather it's to recognize that a SQL database is not always the right tool for the job.  Similarly, there are likely to be scenarios where using anything more than some data files is overkill, or merely inconvenient and that is the idea behind the NoDB provider.  Just store the events in text files, of course the query-side data can still go wherever you want it to.

(Note that I'm using the term 'database' here to refer to sophisticated database providers, arguably even file-based data storage is a form of database.)

More...

Tags:

Coding | nCQRS

Simple tools make integration testing easy

by Chris Nicola 21. July 2010 19:47

 

Technorati Tags: ,

I've been working on a small library that requires using an FTP client to upload and access files stored on a remote FTP.  Now I want to do TDD, but the .NET FTP libraries (FtpWebRequest/FtpWebResponse) are absolutely untestable.  They have no interfaces, you can't mock them at all (though I've heard TypeMock may be capable of doing this) to TDD they are an immovable object.  I should point out my team has also committed to maintaining over 80% code coverage on things like libraries, APIs and services and for this library the FTP related code is currently about 50% of the code.

 

Even if I wanted to simply ignore this from coverage metrics, that would still leave a lot of code that will need to be written and likely maintained without any tests.

Now, you could, if you wanted to, simply wrap the .NET FTP classes and delegate all their members (or just the ones you needed) but to successfully TDD you will need to wrap and delegate three different classes (including the WebException class) and perform a little C# wizardry, not an entirely tall task (particularly if you have ReSharper) but an unattractive one at best.

After traversing down the wrapper route a little way I switched gears and figured the simplest solution would be, in fact, to put all the FTP responsibility behind a single interface and implementation class and then just write very simple "almost unit" integration tests against the implementation.  The integration tests could then be run quickly against a local FTP daemon even on the build server.  However I still didn't feel like setting up an FTP server under IIS on the build server (or on my local machine).  I wanted something quick, simple and small enough that I could include it in the project and check it in.

Whenever I work with nHibernate, I often write simple DB tests against a SQLite in memory database, so I figured there might be something similar I use for an FTP testing (at this point I feel it necessary to point of that if this was Linux this would have been a piece of cake).  After about 15 minutes on Google I found FTPDMIN a 65kb executable, no-frills FTP daemon.  Just for a few laughs here is what my integration tests look like:

[TestFixture]
public class FtpServiceIntegrationTests
{
    private Process _ftpd;
    private FtpService _ftpService;
    private string _filename;
    private string _server;
    private readonly byte[] _data = new byte[10];
    
    [TestFixtureSetUp]
    public void OneTimeSetup()
    {
        new Random().NextBytes(_data);
        var pi = new ProcessStartInfo("ftpdmin.exe", "./")
        {
            CreateNoWindow = true,
            UseShellExecute = false
        };
        _ftpd = Process.Start(pi);
        _ftpService = new FtpService(new NetworkCredential("me@localhost.com", ""));
        var address = Dns.GetHostAddresses(Dns.GetHostName())[0];
        _server = "ftp://" + address;
        _filename = "Test.txt";
    }
 
    [Test]
    public void CanUploadData()
    {
        _ftpService.Upload(new MemoryStream(_data), _server + "/" + _filename);
        Assert.That(_ftpService.FileExists(_server + "/" + _filename));
    }
 
    [Test]
    public void CanListFiles()
    {
        _ftpService.Upload(new MemoryStream(_data), _server + "/" + _filename);
        var files = _ftpService.ListFiles(_server);
        Assert.That(files.Any(f => f.ToLower() == _filename.ToLower()));
    }
 
    [Test]
    public void CanCreateFolders()
    {
        var randnum = new Random().Next(100);
        _ftpService.CreateFolder(_server + "/" + "Folder" + randnum);
        Assert.That(_ftpService.FolderExists(_server + "/" + "Folder" + randnum));
    }
 
    [Test]
    public void CanGetFileData()
    {
        _ftpService.Upload(new MemoryStream(_data), _server + "/" + _filename);
        var returnedData = new byte[_data.Length];
            _ftpService.Get(_server + "/" + _filename).Read(returnedData, 0, _data.Length);
            Assert.AreEqual(_data, returnedData);
    }
 
    [Test]
    public void CheckingForANonExistantFolderReturnsFalse()
    {
        Assert.IsFalse(_ftpService.FolderExists(_server + "/Folder/Test"));
    }
 
    [Test]
    public void CheckingForANonExistantFileReturnsFalse()
    {
        Assert.IsFalse(_ftpService.FileExists(_server + "/" + "File" + new Random().Next(101, 200)));
    }
 
    [TestFixtureTearDown]
    public void OneTimeTearDown()
    {
        _ftpd.Kill();
        _ftpd.Dispose();
    }

Tags: , , ,

TDD

How to poach an egg

by Chris Nicola 4. July 2010 17:04

Today I finally managed to make poached eggs properly.  Sadly, while I am generally a pretty good cook, poaching an egg without it falling apart in the pot of water always seemed to elude me, I could never quite get it perfect.  Today I found out why.

Apparently, the water must not actually be boiling, it should be a low simmer at the most.  The violent movement of the water was what was thwarting me, poached eggs need calm seas. I feel like a bit of an idiot for not realizing this earlier.

Finally, one of the simplest cooking techniques (outside of making toast perhaps) is mine!

Tags:

Food

Back to our regular scheduled program...

by Chris Nicola 25. June 2010 00:54

 

Well, not exactly.  I was really hoping not to do a blog post about why I have not been posting, it has become a bit of a cliché.  Still, it's what I've got on my mind right now so why not?

 

The problem isn't that I have nothing to post about, but it is partly that I don't have anything brief.  I have been doing a lot lately, CQRS, DDD, TDD, Silverlight, WCF (ugh!), some ALT.NET stuff (well going out for beers anyways).  I just recently got back from Africa, we are in the middle of a kitchen renovation (going disastrously, thanks for asking) and work has been fairly hectic last month.

In lieu of anything more interesting you can check out my Picasa album of Africa pics.

http://picasaweb.google.ca/chnicola/Africa?authkey=Gv1sRgCNPYt7KQ1dfE8wE#

http://picasaweb.google.ca/chnicola/Christopher?authkey=Gv1sRgCLeT-4WC4qXyxwE#

I am planning a couple of posts though, and this weekend I hope to get out at least one or two and post date them for the next couple of weeks.  I have a couple of code sample/tutorial style posts planned and I am eager to get them done so hopefully they get done soon to, but here is what I'm thinking about More...

Tags:

Goal setting: Measurements

by Chris Nicola 21. May 2010 07:56

Early this year I set out a list of goals and reviewed what I felt my goals for last year would have been had I bothered to take note of them.  However, set and forget is all to easy with goals and so I am going to also try to review them a few times this year (basically every quarter).  

The purpose of doing this isn't just to see how I'm doing or pat myself on the back, but to reivew the goals themselves and refresh them.  Goals can become stale, what is important to us one day may not be so important 3 months from now.  Just as in Agile having regular retrospective is important not just to keep on track but to ensure we are moving in the right direction. 

A brief word of warning: This is entirely for my own benefit, so if you feel like commenting on how uninteresting or pointless this post is to you... tell it to your shrinkTongue out. More...

Tags: ,

Agile

Chris Nicola... Blade Runner

by Chris Nicola 29. April 2010 07:58

Well I promised I'd follow up on this post however it will be my last post on blog spam I think (I don't want this to turn into a blog about dealing with spam).  So far, my experiment with confusing the bots has been fairly successful.  I’ve added a simple hidden form field disguised as the e-mail field.  Some javascript validation will block any submission where that field contains any input.  This scheme has managed to reduce the number of spam comments received from and average 37 comments a day to 21 (about 45%).  Even better is that it seems to have fooled the most successful bots at beating the Akismet and Typepad filters, as the amount of comments getting through the filters went down from 2 a day to less than 2 a week (either that or those filters have gotten better lately).  bladerunner-voight-kampff1

Overall it has been a resounding success, and has reduced the spam deluge to more of a trickle.  I still think I can still tweak the form trap to make it better, but I'm happy with the level of automated protection I've managed to achieve without resorting to annoying captcha style human verification or implementing a full fledged VK test.

Tags: , ,

Blogging

Virtualizing Stack Panel WPF!??? Part Duex

by Chris Nicola 21. April 2010 16:41

So, as I mentioned in an update to part one I did end up finding a solution to the problem.  It was a hybrid of all the other, largely broken solutions out there.  I should also mention I was not happy with this solution, it felt hacky and performed somewhat poorly, instead I took a different approach altogether to get the desired result for my users.  Nonetheless, despite not using this solution I think the resulting code is worth writing about and considering so here it is.

A couple of conclusion I came to from working on this and discussing it with others:

  1. The ability to bring an item into view should be built-in, not a hack or afterthought.  I can't understand how it was released this way.
  2. The VSP current design completely breaks the MVVM pattern, since virtualized items don't actually have a view and thus the view-model is left unbound to the UI (@kellyleahy and I discussed this at ALT.NET Seattle and he has some ideas to solve this that I may try to implement in a custom VSP implementation)

I do realize that WPF and SL development probably began before the MVVM pattern was considered fundamental, so that is probably part of the reason for this (and other) oversights.

You can download the solution code here.  It provides a static BringIntoView  extension method for the TreeView control.  Now lets look at the code in more detail. More...

Tags:

So you have to use Subversion? DONT PANIC

by Chris Nicola 17. April 2010 13:09

dontpanic Distributed source control (DSCM) using Git (or Hg) is truly a beautiful thing.  It's wonderful, it's revolutionary and it will free your mind.  But the reality is that subversion is still out there and you are probably going to come into contact with it again at some point.  The important thing to remember is DONT PANIC, git svn is here for you.

For those of you who are reading this and saying, "I've worked with SVN for years, it's been good to me, what's the big deal with Git?" Learning to use Git is going to make your workflow more agile, make you less timid about changing code and exactly as promised it will free your mind.  It may just save your code one day.  More...

Tags:

Coding

Welcome

My name is Chris Nicola and I am software developer/engineer in Vancouver, Canada.  

I am primarily a .NET'er but my interests range far and wide.  My currently interes include domain driven design, test driven design, command-query responsibility segregation, and agile software development practices.  

I am also an active member of ALT.NET and Agile Vancouver.

Vancouver ALT.NET

Recent Comments

Comment RSS

Calendar

<<  September 2010  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar