Rhino Mocks

Planning the Next Rhino Mock

It has been a week since I have been given the “keys” to the Rhino Mocks framework and it has been an eye opening experience, to say the least. It was great to receive encouragement and interest from so many of you. It has empowered me to do even more while at the same time added a little more pressure to not screw up (let’s see how that works). Not wanting to waste a minute, I cracked my knuckles and dove into the code base. I have been in the code base before but this time there was something different to the way I looked at it… from the perspective of change.

Admittedly there is some hesitation to critique the code base (as some of you may be aware of [grin]). It is clear, however, that the code base has been built upon over time; adding new functionality and features on top of the original implementation. A framework that can survive over time (and versions of the CLR) in this way is impressive. With that being said, it is also an unfortunate reality.

So… on to the plan…

First and foremost, the code base needs to be simplified resulting in a reduced number of extensions and “alternatives.” It is time to pick one: Record/Replay or Arrange/Act/Assert. My preference is with Arrange/Act/Assert (or AAA) as it produces unit tests that are easier to read and comprehend.

This will take some work as the AAA approach is actually built on top of the Record/Replay functionality (which is not surprising given its history). There will need to be an effort in which the Record/Replay is internalized and eventually abstracted away as state machine with key touch points exposed in which the AAA layer interacts with. Baby steps… baby steps…

Secondly, the initial .Net Framework versions to be targeted will be 3.5, 4.0 and 4.5. This is important to note as the existing code contains older constructs to support 2.0 (and 1.1 possibly) as well as preprocessor directives to omit functionality. These older constructs can (and should) be swapped out with newer ones that better target these “initial” .Net Framework versions.

Rather than depending on preprocessor directives, psake can be utilized to target different versions. If you haven’t heard or used psake, I strongly suggest you take a look. It is currently being used to generate the AssemblyInfo.cs files on the fly, run ILMerge and execute unit tests. It can also be leveraged to target different .Net Framework versions to the point where certain projects can be included or excluded from a build. It may even be able to be leveraged to support a Mono build (given a separate code set potentially).

This (initial) plan is somewhat dramatic but important to create a better foundation to build upon. Not wanting to get too far ahead of myself, it is time to internalize Record/Replay…

If you have any feedback or input, let me know here or in the mailing list for Rhino Mocks.

Advertisements
Standard

10 thoughts on “Planning the Next Rhino Mock

  1. Pingback: Dew Drop – May 29, 2013 (#1,556) | Alvin Ashcraft's Morning Dew

  2. Pingback: The Morning Brew - Chris Alcock » The Morning Brew #1366

  3. Just wondering if you have a plan to combat the seemingly fading interest in Rhino Mock vs similar products and mocking in general? I am a fan of Rhino Mock and have had to defend it on many occasions. Anyway, I agree that AAA is the way to go. Since I am not contributing to an Open Source project at the moment, I’d like to know more about your plan to see if there is anything I can do to help.

    • mmeisinger says:

      The term “combat” seems a little harsh but… understood. The differences between Rhino Mocks and other dynamic mocking frameworks are minimal and almost follow a “style” preference. There are some differences, however, that many misunderstand or simply have no interest in using. I hope to reduce the complexity in order to expose those differences.

      The perceived “fading interest” has more to do with education. I hope that we can all become better teachers regarding why, when and how mocking frameworks and unit testing can help a developer (nearly) every day. If Rhino Mocks becomes someone’s preferred mocking framework, great. If *we* can bring others to become champions for unit testing… fantastic!

  4. I used the term combat because I have seen many debates about mocking frameworks that seemed combative.

    At any rate, will there be a new website for Rhino Mocks where the differences can be cataloged and people new to Rhino Mocks, mocking frameworks or unit tests can be educated?

    If there is anything I can do to help, please let me know.

    • mmeisinger says:

      Agreed. I’ve seen those conversations too.

      Yes, there will be a website for Rhino Mocks. I am hoping to leverage it for documentation, examples and “how to” articles. It will also be where nightly builds and drops can be found.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s