CodeRush Vs Resharper–Week 3

2. May 2012

So I have been trying to give each tool a look to make sure that I am using the best for me. So here is the meat.

 

This is 3 weeks in.

Responsiveness – My computer overall is slower running CodeRush, but the memory usage is lower. I am sure this is just a lack of configuration understanding on my part, but the CodeRush option screen is like a monkey looking at the shuttle control board right now. So many knobs and buttons for tweaking.

Productive help – I am used to resharper so I keep missing things like the solution insert with Alt-Ins or just using the tool instead of the mix of Visual studio commands and CodeRush. The one that bugs me the most is the reference and using import. I used to use Alt.Enter Enter and be done now it is manually add reference, use the Ctrl-. to add the using. I have to constantly switch between the Ctrl-~ and Ctrl-. for commands.

UPDATE – Rory Becker just pointed me to the ImportNamespace plugin and yep, That solved this one, but also added a section

Extensibility – The plugin ecosystem around CodeRush is much more prolific than that around resharper. I’ll have to see if most of my problems have already been solved.

 

 

Templating – CodeRush wins hands down with context aware templating. The templates are great, and they speed things up. I extensively used Resharper templates so the one big win here is having a single template that reacts differently based on references and language. This is incredibly helpful.

Overall – Using CodeRush still feels like a chore right now, but I am going to give it a couple more weeks and see if it grows on me. The visual stuff is mad distracting and the next thing I will be hunting how to turn off. My Resharper bias comes from 6 years of heavy power using, so I don’t want to call this one just yet.

 

P.S. Customer Service – CodeRush wins this hands down. Better website for product and license management, built in license management just with a login, and they responded to a bug with a fixed build within 24 hours. Resharper however took UPDATE 8 not 13 days to get my license key to me after a hard drive crash. ( This was partly my fault for not emailling sooner and trying to use the phone contact. Once I emailed they turned it around in 5 minutes). I emailed again a bit later to get my licenses for the other products I use and got them back in 7 days (March 21st to 28th). CodeRush is winning this battle, and this is the main reason I am still using it.

Resharper, Productivity

Windows Phone–Boy did you change my mind

9. April 2012

I was a huge BlackBerry user and then Tim Rayburn had me using an iPhone. I was impressed by the phone.

Thursday I went and pre-ordered my Nokia Lumina 900 after Keith Elder gave me a 10 minute windows phone demo at MVP summit. All I can say is Wow!! The 10 minute demo was enough for me to buy the phone, and I can never go back now. The setup was seamless with all my accounts, the people hub is fabulous. The ease of use and just overall feel of the phone is what has impressed me the most.

The applications don’t feel like separate environments and it is great. They feel like natural extensions of the current environment.

The phone also integrated with my windows box, my Xbox and my home server effortlessly. I now have an XBox Companion remote, a powerpoint remote, and a media remote all from my phone.

The screen and graphics are great. The speed of the phone was also impressive. I understand the smoked by windows phone campaign now.

Entity Framework 4.1 Experts Cookbook

30. March 2012

This week I got to knock an item off my bucket list. I got published!

http://www.packtpub.com/entity-framework-4-1-experts-test-driven-development-architecture-cookbook/book#overview

This book is a very Improving still book. Test driven and Architecture centric approaches to Entity Framework. It is not the introduction, but more the here is how we have seen success in the real world.

It includes hands on recipes for learning how to:

  • Manage database queries
  • Leverage the full power of LINQ
  • Test the data access layer
  • Design an extensible data access layer
  • Map any object model to a relational database
  • Create clean integration tests
  • Test queries in memory
  • Compose even the most complex query scenarios
  • Create and seed test databases from code
  • Use stored procedures without losing the power of object oriented development

 

This was the culmination of 6 months of work by Tim Rayburn and myself. I learned a lot in those 6 months. Little lessons like “You cannot write a chapter a night”, or “Your spelling REALLY needs work”.

I truly hope you enjoy it and it helps in your coding.

AgileDotNet Houston

28. March 2012

AgileDotNet - Houston is here! Improving Enterprises in conjunction with Microsoft will, once again, bring together the world of .NET development with the world of Agile methods for an exciting experience of discovery, learning, and community.


Don't miss this 1-day packed full of fresh Agile and Microsoft technology and tools information. Get great savings when you REGISTER NOW using the Code: DEVLIN


Where: Minute Maid Park (http://houston.astros.mlb.com/hou/ballpark/index.jsp)
When: Friday, April 20th, 2012
Time: 7:30am – 5:00pm; after party 5:30pm – end of the Astros game
Register Now: http://www.agiledotnet.com/ (registrants receive a FREE CODE Magazine subscription, a chance to win a trip to Vegas)

Please forward this to others you think can help spread the word!

AgileDotNet is Coming!!! Are you registered?

19. January 2012

AgileDotNet is a .NET centered agile conference that covers a wide band of topics ranging from leadership and adoption techniques to tools and development practices. It is a must see for every person interested in Agile, from the new comer trying to figure out what it is, to the experienced pro looking for some best practices.

I am speaking on Database Development for Agile teams, and there are a swath of great speakers on many other great topics!

Full details can be found here -- http://www.agiledotnet.com/

Hope to See you there!

 

AgileDotNet is brought to you by:

Improving Enterprises Microsoft

Community

How to constrain mocks for use with Complex Types

19. January 2012

Here are some tests to illustrate how to leverage RhinoMocks constraints. Notice that it is easier to get a passing test on failing code with a stub. The Strict mock will enforce the expectations at the time of the call, where the stub will only throw an exception on an AssertWasCalled. Due to this I would recommend that you explicitly do your setup and use strict mocks, or make sure to have the discipline to test those assertions.

 

With the method Matches() ,you can use any predicate or method call that returns a boolean. You cannot however use a lambda with a method body aka () =>{}. This will not compile.

[TestClass]

public class Tests

{

[TestMethod]
        public void Should_Allow_Constraint()
        {
            //Arrange
            var mock = MockRepository.GenerateStrictMock<ITestExerciser>();
            mock.Expect(x => x.DoSomething(Arg<List<ITest>>.Matches(c => c.First() is Test))).Return("TestPass");
            var tester = new Tester(mock);
            //Act
            var result = tester.DoIt();

            //Assert
            mock.VerifyAllExpectations();
            Assert.AreEqual("TestPass",result);
        }

        [TestMethod]
        public void Should_Enforce_Constraint_On_Strict_Mock()
        {
            //Arrange
            var mock = MockRepository.GenerateStrictMock<ITestExerciser>();
            mock.Expect(x => x.DoSomething(Arg<List<ITest>>.Matches(c => c.Any(t=> t is Test)))).Return("TestPass");
            var tester = new Tester(mock);
            //Act
            var result = tester.DoItWrong();

            //Assert
            mock.VerifyAllExpectations();
            Assert.AreEqual("TestPass", result);
        }

        [TestMethod]
        public void Should_Allow_Manual_Enforce_Constraint_On_Stub()
        {
            //Arrange
            var mock = MockRepository.GenerateStub<ITestExerciser>();
            mock.Expect(x => x.DoSomething(Arg<List<ITest>>.Matches(c => TestSomething(c)))).Return("TestPass");
            var tester = new Tester(mock);
            //Act
            var result = tester.DoItWrong();

            //Assert
            mock.AssertWasCalled(x => x.DoSomething(Arg<List<ITest>>.Matches(c => c.Any(t => t is Test))));
            Assert.AreEqual("TestPass", result);
        }

        private bool TestSomething(List<ITest> tests)
        {
            return true;
        }
    }

    public class Tester
    {
        private ITestExerciser _testExerciser;

        public Tester(ITestExerciser testExerciser)
        {
            _testExerciser = testExerciser;
        }

        public object DoIt()
        {
            return _testExerciser.DoSomething(new List<ITest>() {new Test()});
        }

        public object DoItWrong()
        {
            return _testExerciser.DoSomething(new List<ITest>() { new TestBase() });
        }
    }

    public class TestExerciser : ITestExerciser
    {
        public object DoSomething(List<ITest> args)
        {
            return null;
        }
    }

    public interface ITestExerciser
    {
        object DoSomething(List<ITest> args);
    }

    public class Test : TestBase
    {
       
    }

    public class TestBase : ITest
    {
        public int Id { get; set; }
    }

    public interface ITest
    {
        int Id { get; set; }
    }

C#, C# Helpful Functions, Testing, Unit Testing, RhinoMocks

Concurrency and Locking in Entity Framework

29. December 2011

So I was talking to a friend this afternoon and the question of how Entity Framework handles locking came up. It is important to know that no pessimistic locking exists in Entity framework. Save Changes uses implementation of DbTransaction for current store provider. It means that default transaction isolation level is set to default value for the database server. In SQL Server it is Read Committed.

Make sure you look at how the tables are defined when it comes to lock levels and how the server you are using is configured.

 

Here are the details that I pointed him to.

http://msdn.microsoft.com/en-us/library/ms184286.aspx

http://msdn.microsoft.com/en-us/library/bb738618.aspx

 

Enjoy.

Tulsa Tech Fest 2011

10. October 2011

Thank you to everyone who attended my talks, it was great. We had a great time. The talk on data access architecture had great feedback and interaction. If you came here looking for code the link is below. Enjoy.

http://db.tt/O5ajHj7N

Houston DNUG Presentation

9. September 2011

Great crowd at the Houston DNUG tonight!! Over 110 in attendance.

Great Questions from the group during the talk. I especially like the follow ups. Thank you all for attending. Below is a link to the code you saw tonight.

http://db.tt/oJFvvrf

Here are those EF links

http://archive.msdn.microsoft.com/EFExtensions

http://www.codeproject.com/KB/database/CodeFirstStoredProcedures.aspx

For everyone interested in how to specify unique constraints that are not keys, please check this out.

http://stackoverflow.com/questions/4413084/unique-constraint-in-entity-framework-code-first

This is very similar to how we talked about adding cascade delete to foreign keys.

Thanks again, look forward to seeing you all at Houston TechFest!

Entity Framework, Community, Data Access

Dallas TechFest 2011–Awesome Conference!

15. August 2011

This was a great conference. Tim Rayburn puts on one great show and the free sushi after party!!

 

 

For those that are hunting my presentation zips for code here they are.

Thank you all for attending, two packed rooms and some great questions.

Now for the Guy that I don’t know with the great question about single user mode, you were right! Here is the stack overflow link for that answer.

http://stackoverflow.com/questions/5288996/database-in-use-error-with-entity-framework-4-code-first

 

Architecture and EF not the odd couple

http://db.tt/m4teLVI

EF Code First Goodness

http://db.tt/Du99mJm