2010/02/02

Name That Caption Contest

Tom LaRock, yes THE Tom LaRock, is running a Name That Caption Contest over on DBASurvivor.com. The winner gets a copy of his book by the same name (catchy, eh?).

So I'll be posting my captions here starting with a rather obvious:

  • I felt a great disturbance in the data center... as if millions of SPIDs suddenly cried out in terror and were suddenly silenced

2010/01/18

Spitting out the KoolAid

85% code coverage
5000 unit test passing
Red. Green. Refactor.

We've all heard the TDD folks spewing comments like this on blogs, twitter, or facebook. Quite frankly, I've had enough. I've been on agile teams (little 'a' agile as there is a difference) and yes it works much better than the good 'ole waterfall methodology. However, TDD is NOT a requirement of being an agile team. Actually, I've seen where having your tests up front and coding to the tests can make you less able to make changes to your project.

If you're not driving your design from tests, what is driving your design?

How about the business requirements and chosen technologies? If you start limiting your design decisions by their testability, you can miss out on some great emerging technologies (try finding anything on unit testing app fabric (velocity/caching).

Making TDD your meal ticket.

I'd say learn new features available in your current language, learn a new language, refresh basic OOP design principles, learn about database design (or UI, or web service, or security, blah, blah, blah). There is always something new to learn methodologies are included but you really shouldn't limit yourself.

Write less code.

I call bull$#!%. So the red/green/refactor can potentially limit you to only writing exactly the methods you need but there is the rub. You have to continually make sure you are not future coding or you lose the "write less" mentality. For starters the "less" code has the addition of the test code. Also, I see many technologies, tools, and patterns being bundled to the project by the TDD evangelists. Mocks, Dependency Injection, Object/Relational Mapping, Inversion of Control all tend to added "bonuses" to the end product. So you take your desired functionality and you wrap all these layers of fluff around them. Each tech and tool requires bending your project to the way the tool needs and typically add new files/projects to be added to the end solution (interfaces, repositories, factories, .hbm.xml, .castle, and on and on). Sounds to me like the promise of "less" leads to more.

Assuming everything else works, does this do its job?

Sounds great doesn't it? We break down our code into these tiny bits and we put a loader over here, a translator over there, we dumb down the classes to base object so we can reuse them in other projects (which NEVER happens). We put the domain classes in one project, put the interfaces in another, have another project for the business logic (because our objects don't know how to do anything with itself). And since we have mocking set up, we stub out the calls of all the inter-connections so we don't actually have to see the parts work together.

Who cares if Billy plays nice when he's at the park? He gets along so well with his imaginary friends.

So I shouldn't test my code?

I'm not saying that. There are very good reasons to do testing. Items behind a service call is a good candidate for putting up some tests. By its nature, the service call is disconnected so slamming the call with numerous inputs is straight forward and easier than a testing UI. Additionally, items with a great deal of logic branching or computations do well. Also, anything that has surfaced as a bug more than once. More importantly, UI testing (automated or manually) covers more of what matters... what the user experiences. It doesn't matter if your Is_it_a_dog tests pass because it has 4 legs and barks. What happens when the user is looking for a cow? TDD evangelists whould say you would make tests for a cow as needed. What about a horse? A turtle? A lorikeet? We know that the test suite has now become the pig.

Seeing the forest through the trees.

So we have now bloated up our number of tests to cover all these scenarios while adding no real functionality. We've changed the tests and the real code to meet new business requirements or add functionality. And yet through it all, the TDD tribe will stick to the tests until one crucial point. When a development team is confronted with 200 development hours and only 150 available hours they will try to push the timeframe back or shrink the feature count. When neither of these are possible due to contractual or regulatory requirements, they say screw the testing and start slinging bits in every way possible. If TDD was so much of a time savings, why do you see teams abandon in what should be its golden hour?

TDD isn't coding with seatbelts. You're tests don't keep you from making mistakes. You'll still misinterpret requirements (and have to change it in at least one additional place). You'll never get enough fringe cases to match your users day-to-day interaction. Testing the individual units makes no guarantee that the system, as a whole, works together as needed. So in many cases, TDD is purely a mastorbatory exercise.

I am currently working to remove many of these practices out of my current project because they have done nothing but degrade system performance and added confusion to the project. I'll take a rich domain objects with a real inhertence model that know how to load, save, and translate themselves. Then I know that I can do more with less code and I can make changes to the objects when the requirements change without jumping through some 30 different base, controlling, and god classes after re-working dozens, hundreds, or thousands of tests.

If TDD is working for you, great. If not, don't feel bad. It's not the silver bullet that it has been touted as.

2009/11/05

SQL Server 2008 R2 Running on “Big Iron”

PASS Summit info on SQL 2008 running on my dream Server (192 cores). Summed up by Glenn Berry.

2009/08/17

With FAIL

If you've had the pleasure of working in VB.Net (kill self). If your lazy like me. You've probably used a WITH statement to shorthand calls to properties and methods.

For those who haven't, a WITH statement can be implemented as below:


With myObject = New SomeObject()
.Property1 = "foo"
.Property2 = "bar"
.Execute()
End With


Simple enough, right. Now enter Linq...

Linq queries (Linq2SQL, Linq2nHibernate, Linq2XML) add a great deal of functions to items derived from IEnumereable (Querayable objects, Lists, etc). The main method I was using on my project was the .Where() extension method.

I'll just mention that I prefer the Extension method/Lambda syntax in C# over that of vb. Primarily because I am lazy and "=>" is two keystrokes versus "Function(x)". Now here is where my laziness caught up with me.

I was implementing a simple search function that would take in a search criteria class. The class had a few properties and a list. The properties mapped to various fields on a customer class the list maps to a view that I've associated as a child class to the customer class in my dbml. All criteria are optional on the search to allow for insanely as hoc querying.

So as I enter the .Search(criteria As SearchCriteria) method I tossed in a With statement (due to the laziness). Basically as follows:


Public Function Search(criteria As SearchCriteria) As List(Of Customer)
With criteria
Dim results = Repository(Of Customer).GetTable()
If Not(String.IsNullOrEmpty(.Name)) Then
results = results.Where(Function(r) r.Name.Contains(.Name))
End If

If (.CustomerId IsNot Nothing) Then
results = results.Where(Function(r) r.Id = .CustomerId)
End If

...Continue a dozen more times ...

End With
Return results
End Sub



So I step through debugging on this method and I see that the .Where's are filtering down the results as I'd expect. However when I leave the sub, a NullReferenceException is thrown from the internals of Linq2SQL... FAIL.

Thinking I may have screwed up something with the .Where's, even though a watch shows that it's good, I switch up how I do the where to
results = From r In results Where r.Id = .CustomerId
I step through, expand the watch, and it looks good. Continue running to end of method... FAIL. Again a NRE from the internals of Linq2SQL.

After cursing at length, dumping all the objects out of my dbml and re-creating. Still FAIL. Then it dawns on me. Linq2SQL queries, like all Linq queries don't execute when most people would expect. This is a good thing. You can append numerous Where statements, Orders, etc and the you don't have a call to the database until you actually go to retrieve a value (a ToList() or ToArray() will cause this as will binding the list to a webform object). Of course when I expand the watch on results it executed the underlying queries. So where did the phantom NRE come from?

Apparently, using a With statement does some kind of voodoo with memory addressing. So my .CustomerId is not the same as criteria.CustomerID. When the results were returned, we were outside the With so the framework had no idea where these .Whatevers were coming from. *sigh* So much for being lazy.

I remove the With statement and everything just works... Kill Self. That is about a day of writing, cursing, rewriting, cursing, smoking, re-rewriting, cursing that I won't get back. So that is my tale of shame, I am not proud.

2009/07/23

From Tables to Objects

Jeremiah Peschka had a great ORM presentation at CONDG tonight and has uploaded incase you missed anything.

2009/07/09

Brent Ozar - What I want vs what I can afford

Brent Ozar follows up his top 10 questions for Senior DBAs with an explaination of why he isn't able to fill positions with Paul Randal.

Brent Ozar - 10 questions to ask senior DBAs

Brent Ozar goes through his top 10 questions for Senior DBAs.

2009/07/07

Twikini for Windows Mobile

Trinket Software has released version 1.1 of Twikini. I've run a few of the beta versions of Twikini with only one issue (requiring hard reset) that was resolved in the next version.

Twikini is a pretty outstanding bit of software for your Windows Mobile device. It has a much sexier UI than my other favorite client, TinyTwitter. It also runs noticeably faster. The UI is more intuitive than Pocketwit.

For most of my Tweeting needs, Twikini more than fits. I still use TinyTwitter for viewing individual timelines but since Twitter has been ignoring the #fixreplies, I see my usage of TinyTwitter falling and Twikini filling that void.

So take a look at that sweet UI and head over to http://www.trinketsoftware.com/Twikini and get a demo version to kick the tires.

2009/01/13

Open letter of recommendation: Arnulfo Wing

A good friend and a wonderful colleague of mine, Arnulfo Wing. Has found himself in the position of looking for new opportunities. I have worked with Arnulfo for about a year through Quick Solutions and for many months on my current project. Arnulfo has many characteristics that made him a valuable addition to the project. He was the BizTalk resource for a fairly complex rules implementation. The project of moving the rules out of BizTalk and into something the client felt more comfortable managing was no easy task. It took about 7 months and had up to 4 developers working on the C#-based solution.

Through our many conversations, Arnulfo showed his depth of knowledge of the system. Both within BizTalk and the application that BizTalk supported. He also showed a great desire to help others understand what many look to as a "black box". He was instrumental in extracting the rules, orchestrations, literally every piece of information pertinent to the project out of the BizTalk instances so that development wouldn't have to start on the new rules engine with a blank slate.

Arnulfo also showed genuine interest in what was happening in other parts of the solution. Though BizTalk was his primary responsibility, he was available to assist in troubleshooting, design questions, and ensuring delivery.

Arnulfo has a thirst for knowledge of new technologies and methodologies. I've seen him at many area user groups. Talked to him about local conferences. He is more than "Just BizTalk". Given his ability to grok very complex systems, his excellent people skills, his depth and breath of knowledge, and his client-facing demeanor, I can see Arnulfo being able to fill many positions. These include Developer, Team Lead, and Architect.

Arnulfo's blog is available at http://arnulfowing.blogspot.com/. There you can see some of the experience he has accumulated from Hyper V corrupt drives to setting TFS to run on multiple servers... and of course, there's BizTalk.

2008/10/23

Sprint WinMo Roundup

Over the last couple months I’ve been trying to find a new phone to replace my old and busted Sanyo VI2300 (read no-cam, flip-out brick). The rest of this blog is to help others who are looking to get into some new hotness that is available. Since I am a .Net develop and the time I have spent with any Apple product has been annoying at best, I was looking to upgrade to a Windows Mobile device.

The first go round I picked up a Samsung ACE (SPH-i325). This was a nice, sleek phone running Windows Mobile 6. Thinner than a pack of playing cards and had an easy-to-use thumbboard. The response on this phone was fast. It had a microSD slot for additional storage. The phone also sported two features that I instantly fell in love with Automatic Speech Recognition and Automatic Profiling. The phone also supported international calling via GSM networks using either the provided or a pre-paid SIM card (something I didn’t use). A pretty good phone for about $100. But the phone did have shortcomings. After playing around with Live Search and Google Maps, the lack of an integrated GPS radio really stood out as a deal breaker, especially after finding no upgrade path to Windows Mobile 6.1.

Round two went to an HTC Mogul (PPC6800). This phone was a brick. But it had a HUGE touch screen and a slide out QWERTY keyboard. It also had the much desired GPS and upgrade possibility to Windows Mobile 6.1. The phone also had a microSD slot. But it was lacking my new loves ASR and Automatic Profiling. Additionally, the ROM seemed a little sluggish. There are plenty of 3rd party ROMS and tools to get an ALMOST automatically switch to vibrate mode during meetings. For nearly $300, I’d want to be ecstatic about my phone. Not permanently searching to find ways to add the functionality that the ACE had.

At this point, you might ask “What’s the big deal with ASR and Auto Profiling?” ASR should be on EVERY phone, PERIOD. ASR is more than the voice recognition on many phones where you have to record a dumb tag (Call Joe Smith Mobile, for example). You then assign the tag to the action you want the voice tag to perform. ASR is so much better. ASR has some built-in actions (Call, Open, Play, etc). So you can put in a new contact (Joe Smith) and then instantly have the ability to speak “Call Joe Smith Mobile” and it just works. No pre-recording; you just speak. Additionally, the Ringer Profiles with Automatic Profiling should be on ANY phone that has calendaring applications. Automatic Profiling puts your phone into vibrate during scheduled meetings. This is especially important if your team has a rule of “your phone rings during meetings; you buy donuts”.

Finally, we come to my current hotness. The HTC Touch Diamond (MP6950) is a true iPhone killer. It’s a thin phone with a big, beautiful touch screen. It has a built-in GPS radio. Comes with Windows Mobile 6.1 pre-loaded and has both ASR and Automatic Profiling. Also the TouchFlo3Dtm UI is frickin sweet. The different touch keyboards available make input easy with stylus or by touch via Compact QWERTY. Additionally, there are accelerometers to determine if the phone is in portrait or landscape orientation. The phone comes with 4GB of internal storage. It is the greatest combination of features I’ve seen in a phone and it is the best phone Sprint has available. So much awesome is packed into this tiny form factor I don’t think I put it down for the first week.

I know that HTC is about to release the Touch Pro with all the goodness of the Touch Diamond with a slide out keyboard headphone jack (the diamond has a dongle for this) and a microSDHC slot for something like 32GB of additional storage. I think I’m good with the Diamond and have had enough of the headaches associated with returning phones for exchange. I don’t think the HTC models can be beat. The Touch Pro is great for those that like the slide out keyboard. The Touch HD is to have a camera to beat anything on the market. But if you can’t wait, you can’t go wrong with the Diamond.