Thursday, August 25, 2011

Code Coverage Tools

Code coverage allows us to see what lines of code have been executed. There are multiple ways of getting the code to be executed, but the most common way is unit tests. Your unit tests pass parameters into the methods, and as the lines are hit, they’re marked as covered. Clearly, this is not a good indicator of how solid your unit tests are, but there aren’t many other ways better that I can think of. You can also run the application to see what code is being executed, but this is less common.

I looked at NCover, TestDriven.Net, and DotCover. NCover was (may still be) the industry standard a few years ago and now went commercial. TestDriven.Net uses an open source version of NCover, and is viewed more as an add on into Visual Studio. DotCover behaves like an addition for ReSharper. All three work with most continuous integration servers.

NCover is really neat in that it offers a lot of reports and analysis on your code. It is neat to see the percentage of coverage change over time (Hopefully always rising). What I don’t like it is a standalone application, requiring a separate project. When am I ever going to look at code coverage when I’m not developing?

TestDriven.Net is the one I’m most familiar with. To me, if you take away the reporting from NCover, and add in some Visual Studio add-ins, you get TD.Net Additionally, it allows you to debug your unit tests, and easily select what fixtures/tests you want to run.

DotCover is relatively new, and I really like it. It is outstanding for TDD as it allows you to quickly execute tests repeatedly. The code higlighting is right in Visual Studio which I love, and it lists exactly what tests are hitting your lines. There have been issues with getting an accurate measurement from DotCover, but I didn’t experience them. I’ve had more issues with my unit Test Session, which is solved by closing the session and starting it again (which is relatively painless, and was an issue with Resharper).

I like having the tool built into Visual Studio, so I can run tests quickly after changes. Additionally, nCover is more expensive, and robust than what I need. TestDriven.Net is solid, but it just doesn’t have the features that DotCover does. Plus it is built in to ReSharper’s unit testing tools which I love, so it makes it even better for me. There are a few things to consider that I haven't gone into detail here, but everything points to DotCover being the way to go for me.

Wednesday, July 20, 2011

Google Web Fonts

It has been a long time since I've really done any true design work. I recently started doing some on a project, and I came across Google Fonts. I have to say that I'm blown away with the possibilities. Google Web Fonts is a web font service, that allows you to embed a font with your page. Amazing! A few years ago, we were stuck with just your standard Arial, Times New Roman and Verdana font faces. Now we can hit an API, download the font to the client's machine, and use that font instantly in any modern browser.

So here's how Google Web Fonts works. Navigate to their site, and search around for your font. There may not be a ton to choose from, but still many options. Click on "Quick Use" for that font. Select the options you want (such as font weight). Scroll down, and you'll see the link to the style sheet that you'll need to put in your page. It'll look something like this:

<link href="http://fonts.googleapis.com/css?family=%3Cspan%3EMerriweather:900&v2%3C/span%3E" rel="stylesheet" type="text/css">

Then, like use the font-family rule for any tag, and you'll be set:

h3 {font-family: 'Merriweather', serif;}

You can download the font and install it on your machine as well, which is nice as well. The service is free, and most fonts work across all browsers. The service is fast and incredibly easy to use.

I've come across a handful that don't work in in IE. I wasn't alone in my findings. Other people have suggested other font services as well, so Google isn't alone. But it shows me how far we've come in a few years ago. I'm surprised it isn't used more. I'm no expert on fonts, but these are really neat services.

Saturday, July 16, 2011

Pro Asp.net MVC 3 Framework - Chapter 2: Getting Ready

Remember how I said I don't really know too much about the server, and how things work on it? At work, I've always had a dedicated team to handle it. I've never head to worry about getting TFS set up from scratch, allowing others to hit a database on a server, or any sort of networking task. I just never have had to do it. When I do things on my local machine, I really don't need to do those things either.

Even things like getting my own machine set up I've struggled with in the past. But hey, everyone has weaknesses and I've gotten better with it. There are so many options in getting your SqlServer and VS installation, that one wrong option can waste hours of your time.

That's what this Chapter focused on. Getting your machine setup. These chapters are always painful but necessary. This book is 5 days old, and already the directions aren't 100% clear because of updates that were released. I did have to install SP1 for Visual Studio, and the MVC3 framework as I was only on 2. AS I write this out, the updates are going on. Not much else to talk about in this chapter.

Pro ASP.NET MVC 3 Framework - Chapter 1: What's The Big Idea?

The first chapter went into detail about the history of Microsoft Technologies (and a few others) and how they've impacted web development. The book talked about the HTTP request, and what happens after there, which was good for me as it has always been a weak point. I've understood the page lifecycle, but never fully understood what is going on in the server.

It is important to know it because it is a key change from a set of Web forms to an MVC application. The routing is a big key in asp.net MVC applications for a variety of reasons. Personally, I hate long hard to read URLs. They look unprofessional and are awful for SEO. The book continued to talk about how your file structure doesn't really have to match the path in a URL. You can move your files around and be totally fine. I never thought about this with my previous MVC applications (As they were just tutorials), but that saves me a huge headache. Whenever you're in an agile environment with a young application, you will change how files are structured. This saves me a huge head ache because the URLs would change and that means bookmarks break and so on.

Other little things were mentioned in this chapter about how Ruby on Rails had an impact in getting MVC out the door by Microsoft, what MVC really is in a programming sense, testing, cleaner HTML and a few other things that I was already aware of. Until I read it here, I didn't realize how much of a change Microsoft has made by going open source and using third party tools like jQuery. I guess I just don't stop to look at the big picture sometimes, and that is what this chapter did, and it did a fair job at it.

Pro ASP.NET MVC 3 Framework - Introduction


I heard about this book a lot before I ordered it, and I ordered it on its release date. I had attended a developer meeting recently on MVC, and this book was recommended for continued learning.

A friend had recently learned about MVC, became thrilled with it, and wanted to learn more. He picked the book out on his own, and I asked if he wanted to go through it together. I've been looking to start reading more, and I always felt better reading with a group of people simply because it is easier to discuss if you have problems, more thought from other minds, and it helps keep you motivated.

So why was I willing to pick it up? I want to improve my knowledge of MVC. I did a few tutorials on it a while back, but I had no real training on it. It is the way the web will be going for the .Net side of things for the next few years, and I would like to keep my skills current.

Sunday, July 10, 2011

HTML5 and Css 3 : Chapter 1 - An Overview of HTML5 and CSS3

The heart of web development is HTML and CSS. You can chose other technologies, but in some way or another, you need HTML in your web site. Asp.net renders tags such as as an HTML tag. This chapter goes into an introduction of changes to the markup.

Depricated tags such as font, u, frameset, and ul. In theory, a lot of these shouldn't have been used with the addition of CSS to our toolbelts. But they're gone, and they're going to be replaced. None are too surprising, but still we need to be aware that they're gone and not use them.

Hogan goes into a little bit of a warning that the specs on these technologies are not final, so we need to be aware that they may change. However, I don't think that'll be a problem with the target audience. Anyone implementing these technologies will monitor the spec and be prepared for changes. He also took a jab or two at Internet Explorer. IE has been known to not be up to par with other browsers of its era, and they've got the greatest market share, which means we have to prepare for them. Work arounds need to be in place so that our site is still usable for those on older browsers.

For a first chapter, I enjoyed this one. Too often in first chapters I find myself saying, "just go!" I didn't feel that way at all here. There was just the right amount of technical information as well as introduction to the technologies to keep the reader from becoming overwhelmed or losing their interest.

HTML5 and CSS3: Develop with Tomorrow's Standards Today - Introduction

I have been hesitant to start going into HTML 5 because the spec is not finalized. It is difficult for me to start learning something that I may not even be able to use in the future. Whether you agree with it or not, there is going to be some serious movement from Microsoft to start using HTML 5 over technologies like Silverlight. Additionally, after seeing the great things that have been built in HTML 5, it is kind of hard to not get excited about it. This was the reason for me looking into HTML 5. This specific title seemed like a solid choice for me as well. I've enjoyed every book in the Pragmatic series, and even though I describe myself as weak in the JavaScript field, I feel that I am a good target for the book. The book is also very short, and talks about the solutions for browsers that may not support some of the new features which is important for me.

I'm excited to see how things like geolocation, alternative solutions to cookies, and just other design aspects that will be implemented into the specs of HTML 5 and CSS 3. I'm hoping that this title will be a good introduction into the possibilities of the two technologies, as well as give me direction on where to go from here.