Posts

Showing posts from 2008

Software Design Speak

I went to SD Best in Boston, and I have been thinking a lot about what made some of those sessions. While I continue to gather my thoughts about that experience, here is something to keep you entertained: Often I say things to my coworkers about software design that are the result of a lot of research and time spent in contemplation. The problem is that I usually just give a 1 or 2 sentence summary of the idea and expect my coworkers to just get it. Or at least they could just assume I am right and we can move forward from there (too bad that doesn't ever happen). I think that the biggest problem I have communicating my thoughts and ideas is one of nomenclature. We use a lot of terms that are heavily overloaded and can have a lot of definitions. I think it will help if I define some terms as I understand them based on my study. I have shared this with my coworkers and invited them to comment and add their own definitions. So far, there are no takers. I'm pretty sure none of the...

Paired Programming - Who? What? When? Where? Why? and How? . . .

Cheese Pairing for this Post: blue stilton [ugh. much like the meeting, this cheese leaves me irritated and with a slight taste of vomit in my mouth that I can't seem to shake for the rest of the day] So the other day at work, we had a meeting to discuss Paired Programming. The Outlook invite said something about "Improving Paired Programming," but from the time we started, it felt a lot more like "Bitching about Paired Programming." At one point, while we were listing a few things we like about it, one of our managers actually said, "Let's stop giving text book answers and talk about the real world." As I am a huge fan of the technique, I have to vent/rant a little and get my opinions out there. What (is Paired Programming) ? Just so we are on the same page, allow me to assert some preconditions for the follow discussion. When I say paired programming, I am talking about 2 developers, 1 computer, 1 story/bug/issue to work on. I prefer to h...

Live Templates . . .

Cheese Pairing for this Post: Beecher's One-Year Aged Flagship Cheddar [mmm. that's tasty] Live templates in ReSharper are an excellent time saving tool. They allow you to put code that you use over and over into a shortcut that you don't have to retype it all the time or maintain it in files external to Visual Studio. I have a few that I've created to make my life easier. test [Test] public void $TESTNAME$() { $END$ } rhino [Test] public void $TESTNAME$() { $END$ using (mocks.Record()) { } using (mocks.Playback()) { } } tostring public override string ToString() { MemoryStream memoryStream = new MemoryStream(); XmlSerializer xmlSerializer = new XmlSerializer(GetType()); XmlTextWriter xmlTextWriter = new XmlTextWriter(memoryStream, Encoding.UTF7) { Formatting = Formatting.Indented, Indentation = 1, ...

ReSharper Code Cleanup . . .

Cheese Pairing for this Post: Jarlsberg [my favorite emmentaler; jarlsberg is excellent for snacking or sandwiches] ReSharper will automatically clean and organize your code for you according to your specifications. The default specs are great; however, I find that I like to put my methods, field, etc in a slightly different order. Here is the config that I use. The only enhancement I still want to add is sorting auto properties before properties that have a backing member rather than intermixed. I haven't figured out how to accomplish that yet, so if anyone knows, please post the answer in the comments, thanks. Without further ado: <? xml version ="1.0" encoding ="utf-8" ? > < Patterns xmlns ="urn:shemas-jetbrains-com:member-reordering-patterns" > <!--Do not reorder COM interfaces--> < Pattern >< Match >< And Weight ="100" >< Kind Is ="interface" />< HasAttribute CLRName =...

Qualities of a Good Unit Test . . .

Cheese Pairing for this Post: sm oked gouda [this is something great for every day consumption; try some on toast] So I was looking through some of the documents I have used for presentations in the office and I thought this was an interesting one: Atomic A unit test should only test a small piece of functionality. A litmus test is to ask if any part of the unit test could stand alone in a separate unit test. Another feedback loop for your unit testing quality is the amount of time you spend with the debugger. If your unit tests are coarse, a test failure is more difficult to find. If the unit test exercises a small amount of code, the test failure cause can usually be spotted very quickly. Order Independent & Isolated There should never be an order dependency, intentional or not, between unit tests. Problems arise when one unit test leaves some kind of dirty data lying around. Testing against a database or some sort of static cache is a common culprit. Put evil, stateful things be...

Transactions . . .

Image
Cheese Pairing for this Post: 1-year-old, Cave-Aged Gruyere [this is a great one that you can really enjoy every once in a while under the right circumstances] So, this week a user story was assigned to me that said something like, "Make sure that we don't save and of the Order data if we can't save ALL the Order data." Immediately, I thought, "Sounds like time to add some transactional support to our (custom) repositories." So there I am adding some tests to the repositories solution that assert that I have some infrastructure in place to track all of the database connections, etc, when one of my co-workers says, "Why don't you just use TransactionScope?" This was new to me, so here is what I learned: TransactionScope is a class built on the Microsoft Distributed Transaction Coordinator. It basically wraps up all that hard work of tracking and committing or rolling back transactions across multiple connections into an easy to use interfac...

Getting started . . .

OK, now that that is out of the way, lets talk about code. I work in C# using Visual Studio.NET 2008 w/ ReSharper . After working with ReSharper for the last year, I honestly can't imagine working without it, hence the inclusion as part of my IDE. Why don't I throw some buzzwords at you and then try to justify them: DDD , TDD, Agile, XP, IoC, RhinoMocks , nUnit, WatiN, Patterns, Patterns, Patterns... The list could go on. Years ago, I would have defined myself (as a coder) using the names of technologies (XML, HTML, T-SQL). Now I talk more about tools and methods than technologies. I mostly work in ASP.NET targeting the .NET 3.5 framework these days at work, though at home, in my free time, I tend to be more desktop focused. Well, this isn't a resume, now is it? I should just talk about the things that really interest me...

Setting the mood . . .

I work in a shop that practices paired programming on all production code. While I quite enjoy this style and encourage it, I occasionally feel the need to check out from the team and get into a coding zone of my own. I find that heavy metal and punk rock help set up the correct mood for me fairly well. Here is the Pandora station I generally listen to: Code Machine .