Tech and a few other things RSS 2.0
# Wednesday, November 11, 2009
If Scott Hanselman lives and die's by unit tests, why don't we all just fall in line? It seems the nerd community, has an uncanny ability to adopt silly things quickly. Things like xkcd.com or the idea of ninja's. I have yet to laugh at one xkcd or understand how ninja's are relative in any shape or form, because of this I felt I needed to read up on unit tests, specifically for C#, to find out if it's just hype or this is something development shops with a strong QA team really need to look at.

I read two books that covered the topic of unit testing. The first book was Foundations of Programming (recommended by Scottie H. himself and is free) and the second is Pragmatic Unit Testing In C# with NUnit. Both of them start off with the same old song and dance on how you might have up front costs of introducing unit tests to your code, but the stability these tests provide over the duration of your codes lifetime will cause such dramatic cost savings for the company, it would be foolish not to explore the idea. What a compelling sales pitch, a pitch salesmen, for just about any technology, have used since the beginning of technology in businesses. I'll cut all the used car salesman tactics out and state the most intriguing argument to unit test. It increases code stability and it's easy.

The next question I asked myself: What do I exactly test in the code-base I am working on? In Pragmatic Unit Testing (PUT) they give us an acronym to use in order to answer this question. BICEP.


BICEP, breaks down as such.

Boundary Tests
Inversion Tests
Cross Check Tests
Error Tests
Performance Tests

These are the 5 major aspects one should test, according to PUT and it provides unit testers with a place to start. The next major topic in discussing how to test code is decoupling one piece of code to another. Does your code talk to a middleware? How do you test if middleware is not done creating your service to consume or if middleware is down? In steps NUnit Mocks, NMock2, and DotNetMock. These 3 mock frameworks provide the developer with the ability to feed your tests predefined values, values decided by you. Without going into how to use these mock frameworks, I believe that outside of a few isolated situations they should not be used. The entire purpose of testing your code is to test that you are getting information back that fits the criteria you are looking for. If this information, that is beyond your control, changes on whatever level for whatever reason, you as a developer need to know. Putting in mock objects hides this.

Since I work for a web shop, the topic of web UI unit tests interested me. PUT recommend using Selenium. This makes sense because it still uses the nunit style of testing keeping all your tests to one testing style. Selenium seems a bit cumbersome in comparison to WaitN or iMacro, but I feel keeping all your testing in the same style outweighs the cons of not using Selenium. The more desperate testing sources you introduce, the more confusing it is for an outsider to step in and see the whole picture when learning the code, especially when it's not contained in a single solution.

Finally, I recommend reading both of the books mentioned, but lets be honest most of us care so little about unit testing we'll be lucky to read all of 1 of these books let alone all of both. If this is the case I recommend PUT, while the first few chapters read like the high school teacher striving to gain his students social acceptance, it's an easy read and you can jump into the book at nearly any chapter and get the exact information you are looking for on unit testing. This is something I wish all programming books could achieve.
Wednesday, November 11, 2009 3:12:32 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
.Net | readings | Unit Testing
# Monday, September 28, 2009
Error Readout:
1st Error:
this class is not key value coding-compliant for the key managedObjectContext

2nd Error:
NSImageCell's object value must be an NSImage

Fix:
1st Error:
There is one prominent reason you could get this answer. You didn't spell your property correctly when you were binding it to....well....whatever you want to bind it to, in my case it was an Array Controller.

My problem however had nothing to do with this. When I created a new project after I upgraded to xCode 3.2 I forgot to check one very import checkbox, Create document-based application (Note: it was not a check box in older version of xCode it was a full icon selection upon creating a project). By not checking this I created a big variety of problems for myself. One of the errors occurring when I didn't check the Create document-based application, was the error this class is not key value coding-compliant for the key managedObjectContext.

2nd Error:
This error is very clear in it's issue. I was creating an entity with a property of native type binary and the compiler wanted NSImage. Grrr but I should be able to pass an image as a binary object, I would say to myself as I had urges to break my laptop and anything else in reach over my knee. My fix again was to simply create a project and remember to click Create document-based application. I know this is not your typical fix, but in case someone else runs into this issue the same way I did I hope they find this and it will be a quick and easy resolution.

Explanation:
All of this pain could have been resolved from the very beginning had I known to click Create document-based application. It was a silly little mistake that cost me a few hours. In my defense however I was under the impression of not checking Create document-based because in Hillegass's book he states that for this exercise we will not be using NSDocument, but NSPersistentDocument instead. It turns out this still means you have to check Create document-based application.

I will state that I should have known something was wrong when I didn't have a MyDocument.xib in the Resource folder after I created the project.

I've attached an image, mainly because blog posts are more fun when there is an image, but also because it shows where this one simple little check box changed my life for a hot minute.



Monday, September 28, 2009 10:55:19 AM (Central Standard Time, UTC-06:00)  #    Comments [5] - Trackback
Mac OS X | Objective C | Snow Leopard
# Friday, September 25, 2009
Error Readout:
HTTP Error 404 - File Not Found
HTTP Error 404- File or Directory not found

Fix:
Enable a Pre-existing Web Service Extension in IIS 6.0

To permit IIS to serve content that requires a specific ISAPI or CGI extension that is already listed in the Web service extensions list, follow these steps:
  1. Open IIS Manager, expand the master server node (that is, the Servername node), and then select the Web service extensions node.
  2. In the right pane of IIS Manager, right-click the extension that you want to enable. In this example, this is Active Server Pages.
  3. Click to select the Allow check box.
Microsoft Link: http://support.microsoft.com/kb/315122

Explanation:
Apparently there was no easy Google search for this stupidly easy fix. (UPDATE: I'm wrong Google the title of this blog entry and a Microsoft fix is the first result) Consequently, I spent more time than I would like on trying to fix it.

Here is how it went down. I recive a HTTP Error 404 - File Not Found error on a page I was browsing to from IIS 6.0. How could this be I ask myself, the page does exists, I know because I see it in IIS 6.0, I right click the file and I select browse. WTF. Upon a little investigation I found out what was wrong and I found a Microsoft website furthers my fix. Soooo  easy! Anyways moving on, going to go drink a beer and forget this time was lost in which I will never get back.



Friday, September 25, 2009 2:22:50 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
IIS 6.0 | Windows
# Thursday, September 17, 2009

Error Readout:

unable to read unknown load command 0x80000022

Fix:
Upgrade to xCode 3.2 with the 10.6 libraries.

Explanation:
This error doesn't do anything to your application except provide some really annoying output to your Debugger Console. File under annoying. You can get xCode 3.2 DOWNLOAD HERE for free at the apple website. It will require you to create a login.
Thursday, September 17, 2009 8:01:43 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Mac | Mac OS X | Objective C
# Sunday, August 30, 2009
Snow Leopard has only been out since Friday, but a few people got the OS upgrade early and blogged all the good stuff. Knowing this, I'm still going to blog about the new OS from Apple.

I'll cover the price, the security upgrade, the cool new features, the size reduction and make a fun little video demonstrating some of the features in Snow Leopard.

$29 dollars. The low price is largely because Snow Leopard is more of an upgrade than a whole new OS. It offers only a few new flashy features that mac users have come to expect. Most of its added features are in unseen functionality such as Grand Central Dispatch, that most will never see or care about. Just knowing their computer runs faster is good enough. Examining these aspects Apple marketing said $29 bucks is a fair price. I agree, skip a few drinks this weekend and you have your new upgrade.

Security has always been a big aspect enthusiast place on Apple vs. Windows. Sadly even with this new upgrade, Snow Leopard is not as secure Windows 7. Windows 7 has some new security functionality, such as Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP). Elinor Mills wrote a great article on it here. The real question about Max OS X security: does Apple need to have the latest security practices incorporated into their OS? If their OS isn't being targeted, yet, why put a large costly focus on having the newest security practices when it doesn't reduce any potential threats on their OS. This is a small advantage Apple has by having 5% market share next to Windows world domination market share.
SIDE NOTE: This will most likely be changing with future generations, have you seen a college lecture hall these days, it looks like a glowing apple orchard.

Finally the upgrade has the potential to reduce the size of the OS's footprint on your hard drive up to half in some cases. Curiosity has me wondering how they did such dramatic size reductions while still adding functionality.



Sunday, August 30, 2009 2:10:00 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Mac | Mac OS X | Snow Leopard
Navigation
About the author/Disclaimer
        

My name is Ben Coffman. I like to build things: programs, programming teams, programming departments and maybe one day a company with lots of programmers. When I turn the internet off I focus on my family, random hobbies, and sharing moments in life.

Blogs I follow:

1. 2andahalfd.com

2. Jeff Lamarche

3. Scott Hanselman

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Ben Coffman

Archive
<November 2009>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345
All Content © 2012,

Sign In