Monday, November 20, 2006

Although I was on vacation for a week, I found the time to read Applying Domain Driven Design and Patterns by Jimmy Nilsson. I would highly recommend this book, but I would recommend that before you buy it, you go out and purchase and then read Patterns of Enterprise Application Architecture by Martin Fowler and Domain-Driven Design by Eric Evans (they are worth your hard earned money). There are a lot of concepts presented in Applying Domain Driven Design that are talked about in these books.

Having said that, the first section of the book Jimmy introduces you to topics such as Test Driven Development, Refactoring and Design patterns and how they aid the Domain Driven Design process. Personally, no matter how many times I read these topics, they are some of my favorites in software development and I will always re-read them when I see them in a book to get a different perspective on them.

I particularly enjoyed the sections on techniques for Querying, and different approaches to object relational mapping. Jimmy talks about the Identity Map, Unit of Work and Lazy/Eager Load patterns and the pros and cons of each patterns (Jimmy does a good job throughout the book distinguishing pros and cons of the different patterns).

After Jimmy has talked about ORM in an abstract way. He shows you how to practically use NHibernate. This chapter was a good introduction to NHibernate for me. Although being in the middle of the ocean and not having a computer to try it out was kind of painful.

Chapter 10 is almost entirely written by guest authors and introduces some design techniques. There are some good articles on Inversion of Control/Dependency Injection, Service Orientation and Aspect Orientation. After reading this chapter I would like to try and experiment a bit with Spring.net and some of the other IoC containers.

Conclusion

Jimmy does a good job in teaching about how to focus on the domain model while developing an application without worrying about the infrastructure of your app until the right time while teaching numerous domain driven concepts. I can see myself constantly coming back to this book in the future.

As Jimmy puts it in the epilogue the book is structured in a Domain Driven Designish way:

  1. First we try and collect the requirements and understand the problem.
  2. Next think about the approach to use when structuring the main logic (this may not even require a domain model).
  3. We need a certain style for the domain model, not only to avoid common traps, but also to create something really powerful. Try and settle the Ubiquitous Language.
  4. Think about the required infrastructure.
  5. Think about how to deal with presentation.
Monday, November 20, 2006 11:18:15 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

Thanks to everyone who offered their congrats on the recent engagement. We made it back safe to Edmonton, although I seem to be suffering from vertigo and I feel like i'm still in the eastern time zone (at least i'll be early for work tomorrow).

Here is a mini tour of my vacation, for the rest go check out the Flickr photo set and the Flickr map.

 

The first thing I did on the vacation was get engaged to Catherine:

DSCF0892

PB110050

The first stop of the cruise was Nassau, Bahamas.

DSCF0896

The picture below may be the Coding Hillbilly's house or it may be Chuck Norris' house. I'll leave it up to you to decide:

DSCF0902

We only had one day in Nassau so we went snorkeling off of Pearl Island.

DSCF0907

 

The next stop was St. Thomas. We decided to go to a small island off of St. Thomas called St. John which is a national park and my favorite part of the whole cruise. We went with my sister who works on the cruise ship.

PB140027

PB140036

 

The last stop of the cruise was Orient Beach in St. Maarten, Catherine's favorite stop on the cruise.

DSCF1098

DSCF1099

 

We then had a couple of days in Orlando, Florida so we went to Universal Studios where I had to save Catherine from getting eaten by Jaws and I got to see a Flux Capacitor.

DSCF1208

DSCF1211

Monday, November 20, 2006 11:14:25 PM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Wednesday, November 15, 2006

I am halfway through my vacation in the Caribbean and right now I am sitting on a beach in St. Maarten having some kind of Guava alcoholic beverage.

Last Saturday, I asked my girlfriend to marry me and she said yes! Pictures to come later.

Wednesday, November 15, 2006 4:42:47 PM (GMT Standard Time, UTC+00:00)  #    Comments [7]  | 
Sunday, November 05, 2006

There will be no spoilers in this post. I'm not that kind of guy.

Today Catherine and I went to see the movie Borat (Cultural Learnings of America for Make Benefit Glorious Nation of Kazakhstan). This movie was one of the funniest movies I have seen in a long time.

The way that Sacha Baron Cohen portays another culture coming into a new country, really shows how oblivious the western world is to other cultures. Kazakhstan is taking the movie in stride (they get it), but the brilliance of this movie is how it portrays some of the radical extremes in the United States using a character who is oblivious to absolutely everything.

So if you are like me and only see one movie a year (because you are playing too much buzkashi), go see Borat.

Fun
Sunday, November 05, 2006 6:00:44 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Wednesday, November 01, 2006

Navigating in the Solution Explorer

Ctrl + Alt + L: Open the Solution Explorer (the most important one).

Esc: Return focus to the coding window (hides the solution explorer).

Up Arrow: Move up between nodes.

Down Arrow: Move down between nodes.

Right Arrow: Expand current node.

Left Arrow: Collapse current node.

Solution Explorer Project Actions

Ctrl + Shift + A: Add a new item (project must be highlighted).

Shift + Alt + A: Add an existing item (project must be highlighted).

Alt + P + R: Add Reference to the current project.

Alt + P + E: Add Web Reference.

Alt + P + A: Set the current project as the starup project.

Alt + P + P: View the current project's properties.

 

If you have any others related to the solution explorer windows please post them in the comments.

Wednesday, November 01, 2006 12:01:29 AM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 

Esc: Closes any of the windows below and returns focus to the code.

Ctrl + Alt + S: Open the Server Explorer.

Ctrl + Alt + L: Open the Solution Explorer.

Ctrl + Shift + C: Open the Class View.

Ctrl + Alt + J: Open the Object Browser

F4: Open the Properties window.

Ctrl + Alt + X: Open the Toolbox.

Shift + Alt + Enter: Go fullscreen.

If you have any others related to viewing and opening windows please post them in the comments.

Wednesday, November 01, 2006 12:00:45 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 
Friday, October 27, 2006

I have started using Team System at work and I stumbled upon the built in functionality to generate a unit test for a private method. At first I thought it was sweet that you could test private methods but then after going for a walk, I have come to the conclusion that this is not a good feature.

Someone has probably complained about this before but is there a situation where you would use a private method that is not eventually called by a public or protected method that is itself testable? Shouldn't you test the public or protected method to see if your private method is called and returns what you are expecting? I am going to avoid using this functionality until I find a valid reason to use it.

Friday, October 27, 2006 6:42:55 AM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 
Tuesday, October 24, 2006

It took me 46 episodes to discover it but Geekdrome is an awesome podcast. From their site: "Two geeks debate movies, comics, music and video games while ripping each other new ones... or re-ripping each other fresh ones."

Over the past couple days I have found myself watching this over regular television.

Fun
Tuesday, October 24, 2006 4:43:14 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

This is a follow up to the short Rhino Mocks presentation I did tonight at EDMUG.

Remember, the purpose of a tool like Rhino Mocks is to test the interactions between 2 objects.

You can find the download for Rhino Mocks here: http://www.ayende.com/projects/rhino-mocks.aspx

The source code for the presentation is here: http://www.stevenrockarts.com/code/UserGroup.rar

I have also included the syntax to create mocks in VB.NET and C# in.NET 1.1 and 2.0 .

If you have any questions about Rhino Mocks at all, feel free to send me an email using the contact information on this page or leave a comment.

Tuesday, October 24, 2006 4:18:41 AM (GMT Standard Time, UTC+00:00)  #    Comments [0]  | 

One of my favorite record labels has to be NinjaTune. Not only do they have cool artists such as Bonobo, Kid Koala, Amon Tobin and Yppah on their label they also make their artist's music available for purchase in high quality MP3 DRM free! Why can't all music be like this?

[ Currently Playing : Transmission 94 (Parts 1 & 2) - Bonobo - Days To Come (07:57) ]

Tuesday, October 24, 2006 3:46:56 AM (GMT Standard Time, UTC+00:00)  #    Comments [2]  | 
Saturday, October 21, 2006

Many people are familiar with the handy Open Command Window Here powertoy for Windows but did you also know that there are Visual Studio Add-Ins that do the same thing right from inside VS.

If you are using Visual Studio 2005 check out Cool Commands 3.0 for Visual Studio and if you are using Visual Studio 2003 check out Solvent. To use them you right click on your project and select the Open Command Prompt here option and you get a command window in the same location as that project.

While I am on the subject of developer tools I should mention that I will be presenting on Rhino Mocks along with a bunch of other talented developers at the Edmonton .NET User Group October meeting this Monday.

Friday, October 20, 2006 11:46:22 PM (GMT Standard Time, UTC+00:00)  #    Comments [1]  | 
Sunday, October 08, 2006

A lot of complexity in programs comes from complex if-then-else statements. If it takes you a long time to read and understand an if-then-else statement you should take a look at the Decompose Conditional refactoring.

To show you how powerful this can be, from the example below choose which code you think is easier to understand:

Public Sub ProcessPayment() If _view.PaymentType = PaymentType.Cash Then 'payment type is cash Try _task.SaveCashPayment(_view.Amount) Catch ex As Exception _view.ShowMessage("There was a problem saving the payment.", False) End Try _view.CloseView() End If Else 'payment type is credit card If PreAuthorized(_view.Amount)) Then Try _task.SaveCreditCardPayment(_view.Amount) Catch ex As Exception _view.ShowMessage("There was a problem saving the payment.", False) End Try _view.CloseView() End If End If End Sub

Or this code:

Public Sub ProcessPayment() If PaymentTypeIsCash() Then SaveCashPayment() Else SaveCreditCardPayment() End If End Sub

In the first block of code, notice how it takes you a long time to figure out what the code is trying to accomplish while the second block of code reads like a couple of lines of comments.

Also, notice how the first block has a lot of code duplication. Once the SaveCashPayment and SaveCreditCardPayment are moved into their own methods it is a lot easier to recognize this duplication and refactor it

If there are other ways you can think of to refactor this code please post in the comments, I am always looking for ways to make code better.

Update: Check out Jean-Paul Boodhoo's response on how to further  refactor this code.

 

[ Currently Playing : Reign On - The Brian Jonestown Massacre - Bringing It All Back Home Again (4:31) ]

Sunday, October 08, 2006 5:10:59 AM (GMT Standard Time, UTC+00:00)  #    Comments [3]  | 

Theme design by Jelle Druyts

Pick a theme: