Archive for the ‘.Net’ Category
Learning TypeMock.Net
We need to implement a better unit testing strategy at work but unfortunately we have code that is not written to be unit tested. Our unit test rely on the state of our database and this has caused so many issues that I’m hesitant to even run them.
To fix the issue I have started working with TypeMock.Net an AOP mocking tool. TypeMock will intercept calls to objects that are called by the code you are testing without actually creating or executing the object. I’m still fuzzy on the details but I plan on using this tool to help me test some pretty untestable code.
David Hayden [MVP C#] : Validation Application Block – Integrating It Into Your Business Layer
Now that we have this cool Validation Application Block we want to use it with all our business objects. This should immediately send up a red flag that there will probably be some common functionality among all these business objects in how they use the Validation Application Block. Hence some type of layer supertype ( business base class ) will probably be necessary to contain common functionality to remove code redundancy.
Source: David Hayden [MVP C#] : Validation Application Block – Integrating It Into Your Business Layer
David Hayden presents another great article, this time on the newest addition to the MS EntLib: Validation Application Block.
I go back and forth on the EntLib as a whole. Parts are great, other parts are overkill. I love the Data Access Block and use it in tandem with my other data access frameworks (ActiveRecord, NHibernate, etc). The UI block though, WTF!
David’s article is a good read. Go forth and read.
What’s in a Name?
I have had the joy of reviewing other peoples code lately and I must say that for the most part there is a total lack of attention to detail. Extensive use of copy paste coding, but the one thing that bugs me the most is the naming convention used.
Can you believe that there are still developers that preface there variables with obj?! Is that not just crazy? Of course it is an object, we work in an OOP language.
Everyone should stop reading tips and tricks sites and start reading books on how to program.
Switched Back to ReSharper
I uninstalled CodeRush and re-installed ReSharper. CodeRush just wasn’t doing anything for me productivity wise. I felt that I spent more time fighting it then working with it.
Maybe I just feel more comfortable with ReSharper. I feel that with it I don’t have to memorize as many key combinations.
I’ll give it another month and see what I think then.
Building a build server with CC.NET
So I have started implementing CruiseControl.Net at work and I have to say it is pretty fun. I’ve built a bunch on Nant scripts to build our SOA middle tier, installed CC.Net and setup the first project.
What I am struggling with now is getting VSS to update the source files. I think I am just missing something small but for some reason I can’t get the files to update.
Update
I finally had to create NAnt scripts to update the actual source. The VSS task in CC.Net only monitors the VSS DB for changes, it does not actually down load the latest source. At least as far as I could tell it does not.
Next is to get the VSS labeled. CC.Net will label the source but it is not descriptive enough so it will be a trip back to the NAnt scripts.
Resharper vs CodeRush
So I used Resharper for a long time and I really liked it. There were a few things I didn’t like, especially the time added to a project load. And every once in a while it would lock up. But the features I liked were very useful: Find all usages, simple keyboard shortcuts, code reformatting. But the two most useful things it did was 1) to but a bar along the right side of the screen with orange or red lines for were the code had problems, and 2) clean up the using statements.
I have been using CodeRush/Refactor Pro for about a month now and really like it as well. I wish it did some of the things that ReSharper did and I wished the refactoring worked more like ReSharper. But I like the polish a lot better and I like the way it shows how blocks of code are related. One of the best features I notices so far is the showing cyclomatic complexity of each method. The code completion is a bit complicated and I haven’t spent enough time figuring it out. It is more flexible than ReSharpers.
Another thing I do not like about CodeRush is the subscription scheme they are switching to. I can see where they would need a continuous money stream to keep the business going. But how am I going to justify paying the CodeRush tax each year when I got the ReSharper upgrade for free?
So, I like both products. I tried running both at the same time in VS 2003 but after 15 minutes it locked up. The tend to step on each other a lot so I need to figure out how to get them to play nice together.
Resources for Packaging and Deploying .NET Compact Framework-based applications
Resources for Packaging and Deploying .NET Compact Framework-based applications
Jono Shares some sources for packaging and deploying .NET CF apps.
CF Form Disposal
The December 2004 issue of MSDN contains an article on developing CF apps. Part of the article advocates the disposing of forms as soon as you are done using them in order to conserve memory. I disagree with this.
I have found that caching forms improves the performance of a CF application. It takes a long time to load a form in CF so why should I make the user wait every time he has to reopen the same form? If the speed of creating forms was not an issue then I would be OK with disposing of them when done.
There is a Form Stack code block floating around the web that I have been using successfully to cache forms. This works up to a point but it has limitations as well. I am working on a hashtable cache for forms and will extend it to include panels. I think that performance would be even more improved if instead of caching entire forms we cache the panels.