Showing posts with label Other. Show all posts
Showing posts with label Other. Show all posts

Sunday, April 13, 2008

The perils of Obfuscating your code

Suppose you have an enum type.

    internal enum SomeEnum       
{
SomeVeryDescriptiveName = 5
}

For some reason you want to use the name of the enum field as a string and not its value.
you can write:

Console
.WriteLine(SomeEnum.SomeVeryDescriptiveName);

The output will be:
"SomeVeryDescriptiveName"
This is exactly what you wanted and every thing works fine.

But when you build the release version it doesn't work.
So you debug it and of course under debug it works fine again.
Then you pull the heavy guns like the giants who walked on this earth long time ago taught you. Logging.
And than you find it:
When we build in release mode the assembly is obfuscated. This means that all internal and private names are mangled.
Since the enum is internal SomeEnum.SomeVeryDescriptiveName will become something like:
z.k and the output will be:
"k"
Thou shall not use strings!

Saturday, March 8, 2008

Typemock Isolator Vs. Rhino.Mocks

One of the things people keep asking is "so why should I pay for a tool that I can get for free?" in other words, what is so special that you'd actually want me to pay you for.

This of course, is because there is no clear comparison chart between typemock and other free and open source tools such as rhino mocks.

There are many ways to compare frameworks, but the first and easiest one would be feature by feature comparison. How fair\relevant is it? you be the judge. I'm putting this chart on this blog so that we can gather comments on what you think would constitute a fair and balanced comparison chart between the various mocking frameworks, and this is something to start with.

If you have objections, suggestions or any other type of feedback, feel free to put in a comment. ('y' = 'supported' , '-' = 'not supported')

(this chart relates to the enterprise version of Typemock Isolator. for a chart detailing the differenced between typemock versions and to understand what the features listed here mean, look over here.)

 

Feature Category Feature Detail Typemock Isolator Rhino.Mocks
.NET Framework support      
  1.1 y

yes - (only the 2.9.6 version )

  2.0 y y
  3.0-3.5 y y
Syntax      
  Record-Replay y y
  Expectation based y y
What can it mock?      
  public method y y
  properties y y
  events y y
  interface y y
  Abstract Classes y y
  void calls y y
Non-Classic Mocking Future Object instance y --
  Static methods y --
  Extensions Methods y --
  LINQ Queries y --
  Anonymous Objects y --
  Field set-get y --
  Constructors y --
Parameter Constraints      
  Argument matching y y
  Custom Callbacks y y
  Built in constraints y y
IDE Support      
  Highlight mocked methods in debugger y --
  Evaluate mock values safely in debugger y --
other features      
  strict\non strict mocks y y
  strongly typed calls y(except recorder.return() ) y
  Extensibility mechanism for tests y --
  support 'stub' keyword -- (stubs are supported but no keyword for it) y
  Runtime argument swapping y --
  partial mocks y y