I’ve been using Hyper-V for a couple weeks and have been pleasantly surprised at how much benefit it’s brought me. What I love best is how I can start up a VM on my server box, add a network card and then log into it using remote desktop on another box. It's seemless and easy, not something I expected from just sitting down and using a server component.
Some benefits I’ve noticed in my daily routine:
Multitasking
Certain large tools only run in certain environments and it’s not possible to run them at the same time. With a virtual machine, I can run both simultaneously on the same physical box.
Long Operation Pausing
Some programs I have to run can take a few days to complete. It’s a pain to have to have a machine monopolized while it runs. But now I can run the operation on a virtual machine and if I need to use the physical machine for something else I simply save the virtual machine’s state. (While the virtual machine isn’t as fast, the operation usually finishes overnight anyway.)
Debugging Different OSes
Testers have been using virtualization to test our changes on different operating systems for a while now. Instead of having four separate machines (or one with multiple OS’s installed), you have one with many virtual machines.
I realize now that there’s the same benefits for developers: investigating OS specific bugs is a complete pain usually involving having a tester give you access to their machine. Now having a virtual machine server, I simply startup the desired OS image and remote debug the problem.
(Side note: It was totally awesome when I noticed out of the blue I was getting Areo effects running through remote desktop to a virtualized Vista machine.)
Application Hosting
Many times people will want to try out a change I've made for themselves. Usually this involves sending them all the bits and they have to have a spare machine to install it on. Now I start up “ChrisDemo” and let people remotely log in.
This week’s geek level: Frighteningly High
Attend a meeting where people are talking about bugs, pick one and demo a fix before the meeting is over.
Booya.
I don’t know how many times I’ve thought to myself that I knew it all. Many times I’ve coded something that I was absolutely sure was correct only to find out I was drastically wrong.
What’s wrong with this code?
class Object
{
public:
Object()
: m_pdata( new BYTE[100] )
{
}
~Object()
{
delete[] m_pdata;
}
private:
BYTE *m_pdata;
};
class Interface
{
public:
static Object* AllocateObject() { return new Object(); }
static void DeleteObject( void* pObject )
{ delete pObject; }
};
...
void Function()
{
Object* pObject = Interface::AllocateObject();
// do something
Interface::DeleteObject( pObject );
}
Answer
It will leak memory. DeleteObject takes in a void* which when deleted will not call the destructor for the Object class and m_pdata leaks.
I made this mistake when I added a new type of object that needed to be allocated from an interface. Then I tried to consolidate the “Delete” functions into a single one (read: "make better"). I didn’t see it when I coded because the classes I tested it with had trivial destructors and freeing the memory was enough. It wasn’t until testers tried more complicated scenarios did the bug manifest itself (read: "made totally worse").
Why do I like working here? Because everyone is like a kid in a candy shop when we get new equipment.
This week plastic bags are scattered around offices like wrapping paper torn from carefully wrapped gifts. People are excited and smiling when they walk by with their newest prized possession.
I’ve already configured my new toy and checked in code which improves build times using its new capabilities. Supposedly these have support for some hardware virtualization as well.
Mmm, geekiness.
Step 1 - Find a problem that plagues everyone but everyone just kind of puts up with it because that's the way things are and fix it.
Step 2 - ???
Step 3 - Profit!
Today we had a bit of a network outage in our building. It was there, there and there some more. Then it was gone, gone, gone! Since most geek socializing happens over some kind of instant messenger or Facebook wall, this is a major disruption in our otherwise movie-star like popularity.
Also, there’s the work thing.
Next to electricity, a network connection is the life blood of a developer. User accounts are on domains which have to be accessed to log into machines, you need to make connections to source control servers and most communication is through electronic mail. Unfortunately, the Outlook guys haven’t gotten around to implementing smoke signals yet.
When the network is down, everything comes to a halt. Which is then as good an excuse as any to party in the hallways.
The Microsoft hallway party comes in a variety of stages:
- Congregate in the hallway
- Bring beverages
- Bring food
- Find out who has some kind of gaming console
- Hook it up to a projector in a conference room.
- Discover you can connect to Xbox Live
- Suggest we start some Halo 3 matches and pwn some n00bs!!
- Sudden sinking feeling that this means you can probably check your email again.
Alas, my Smash Brothers skills exhausted, it looks like it’s time to go back to work.
For those of you at RIT, be sure to stop by the career fair on Wednesday. I’ll be the guy gloating over how awesome his job is compared to the guys in the next booth.
Are you a good developer? It’s not just the code you’ve checked in, it’s the code that you’ve allowed to be checked in too.
When someone sends you code for review, it is your duty to make sure it’s up to the quality bar set for your team. Compromise on this will and you will set yourself back farther in the future than the time it would take the sender to fix the code in the first place.
Be insistent. I have argued with developers more senior than I am on how a particular change should be made and the weaknesses in what they have sent out for review . This has landed me some particularly pointed emails. It's tough love. Not everyone will deal with criticism well so be prepared for a boxing match sometimes.
But let me say that the worst that can happen in a code review is the other developer forwarding your email to your manager and complaining about how you were such a jerk when it came to reviewing their code. “Chris insisted on this and that and wasted a bunch of my time. By golly, back in my day…”
Now review how this is a huge win for you: your manager has proof that you were thorough and didn’t stand down when faced with the choice to compromise quality or save time.
Most importantly, you have prevented the code base from degenerating. Bad coding is infectious: newer developers will base their code on what’s already checked in. Bad designs propagate into newer features, sloppy coding standards lead to a growing sloppy code base and quick hacks suddenly become standard practice for achieving behavior. It is ten times harder to back out a faulty coding standard that was seeded from a bad check in than it is to prevent it from being checked in in the first place.
By refusing to compromise, you will make a name for yourself as a good code reviewer. People will avoid sending you code for fear of retribution but their managers will insist that it get reviewed by you. Suddenly you’re an important person, and right out of college.
Any large company will have a variety of positions opened at any one time. This means that when you fly out and interview, you may be assigned to the team that needs head count the most. Or the team that the recruiter thinks you’re a best fit for. Or the team that the recruiter’s dart happened to hit.
I don’t know if any of these things are actually true, but what can happen is that you show up and interview with a team you have little interest in. The first time I interviewed here at Microsoft, I ended up talking to two teams that made me shudder as soon as the recruiter mentioned them. I’m sure some people were born to do backend SQL server work, but others are born to be awesome PowerPoint graphics developers.
Needless to say my interviews didn’t go very well, and I wasn’t offered an internship.
Later that year when I applied for fulltime, I made sure to emphasize to my recruiter ahead of time that I was interested in graphics. I ended up interviewing for Visio and a new secret project called “IGX” (later to be named SmartArt).
Oh the bliss. One interviewer showed me a screenshot of the new Office 12 rendering engine and how it was going to have all these great 3D features. “Man, that must be a pain to develop a user interface for” I commented, noting that moving a camera in 3D space with a mouse is neither intuitive or easy to get good results. His face lit up “Yah, it is!”
If I hadn’t found a team near my interest, I wouldn’t have nailed the interview and I wouldn’t have a job in an area that I love so much.
When you get an interview for a large company, ask who you will be interviewing with. You may get boiler plate “Oh, we don’t know until the day of, blah blah”. Push back and list your interests and ask if any of them can be met. If you know of a specific product you want to work on, be sure to mention it. If you just have this insatiable itch to work on Internet Explorer and you impress this upon a Microsoft recruiter before you fly out, the chances are infinitely better that you’ll get an interview there than leaving it to the day of.
While waiting for my latest change to compile, I discovered the “preview” option for TV episodes on Xbox Live is a great way to find out more about a series. I don’t really keep track of when new stuff is on, in general I’ll rent a TV series on DVD instead of waiting for it to show up on cable. Using Xbox Live in this way is 10x faster than digging through the Internet trying to find out what shows are interesting and video clips of said shows.
Now on the interesting list:
· The West Wing
· Jericho
· MacGyver
Now unfortunately on the “going to skip” list:
· Pimp My Ride (why is this under “Drama”?)
· The Surreal Life
· I Hate My 30s
It’s important that as a new developer you do not succumb to a mind numbing repetitive task.
One, you’ll look like an idiot when someone else does the same thing with a script or a tool but in 1/100th the time.
Two, you could have tons of time to slack off if you’d only used the tools at hand!
Things that are very handy that you should know:
Regular Expressions – Find and replace complex patterns of text. Many IDE’s, such as Visual Studio have an implementation you can use.
A scripting language, such as Perl – Take some kind of input, process it (using regular expressions), spit something out.
Excel – Generate number sequences from formulas and sorting data.
These things have saved me countless hours. I had to generate a templated class with a bunch of repeated typenames from T1 through T120. I wrote a quick Perl script to do my bidding for me:
$i = 120
printf( " template< " );
for( $j = 1; $j <= $i; $j++ )
{
printf( "typename T%d", $j);
if( $j != $i )
{
printf( ", " );
}
}
printf( ">\n");
What’s great about regular expressions and scripts is that if it turns out you have to change the formatting or the number of values you want to write out, it’s a simple change.
Plus it’s fun to write throw away code that only has to work once.
An Intern Story
When I worked as an intern for a nameless blue company, another intern was given the [fun] task of porting a database to a newer version. The work came down to taking this huge definition text file and making it work with the new system.
The changes were mainly comments now used slashes instead of apostrophes and some keyword differences.
For two days he chugged along hitting backspace and / repeatedly.
When I had finished my project, I was asked to help him. I copied the entire file into Word, did a couple of find/replaces and was done.
“Chris, the savior of the database!” they cheered [in my head].
Of course, now neither of us had anything to do for the rest of the week.
A Microsoft Story
We have some code which gets auto-generated based on some input data files. If you add new data, but don’t update certain helper headers, you’ll get a list of linker errors like the following:
Unresolved external GenClass1::s_id in gen.obj
Unresolved external GenClass24::s_id in gen.obj
Unresolved external TempClass1::s_id in gen.obj
Unresolved external GenClass8::s_id in gen.obj
Unresolved external GenStruct4::s_id in gen.obj
... (600 more lines)
So we have a handy dandy macro which will define the IDs for these classes:
DEFINE_ID( GenClass );
I could have spent all day copying and pasting the class names in. Or I could load the error output into Visual Studio and use its great find and replace tool which allows for regular expressions:
Find .*external and replace with DEFINED\_ID\(
Find \:\:s_id.* and replace with \)\;
The result:
DEFINE_ID( GenClass1 );
DEFINE_ID( GenClass24 );
DEFINE_ID( TempClass1 );
DEFINE_ID( GenClass8 );
DEFINE_ID( GenStruct4 );
... (600 more lines of code
I didn't have to write)
Tada! [........It’s the final countdown…]
As a new hire, you will mess up. But don’t sweat it, it's to be expected. You will learn more from a mistaked because you will be forced to find a solution when someone points it out.
Indeed your success as a new hire isn’t a question of how few mistakes you will make, but what you do to resolve those mistakes and prevent them from happening again.
I’ve learned a great deal about how to avoid common regressions or build breaks in the Office code base. It had been about 6 months since I’d caused the build lab to trip on one of my changes (and in the mean time I’d fixed numerous other build problems).
Of course, there’s always a new level of problem that you can cause. In fact, the longer you work, the more obscure the problem you cause will be (since you're so well versed in preventing more obvious problems).
Last week, I caused a problem.
The Problem
Two weeks ago, I checked in a change that looked like the following:
class Helper
#ifndef Project2
: public INewInterface
#endif
{
...
};
The idea is that INewInterface is not defined in Project2 , so I #define it out. We build two separate lib binaries, one that is linked by Project1 and one for Project2. There are several other places that do this exact same thing with INewInterface, so at first glance, this should work.
It compiled, it linked, I shipped it.
The problem that I didn’t see is that the definition for the Helper class lives in a seperate shared library. Which means that we get one binary that both Project1 and Project2 link against.
Now the problem is that Project2 expects the size of the Helper class to be one thing but in the compiled code it’s another. Miraculously (or disastrously) this links without error (for reasons I’m still not sure of)
The Result
Last Friday a bunch of dreary eyed people from Project2 came into my office bearing a post it note with a number on it; my change list number. It had taken them nearly two weeks to track down the problem that I caused. "TWO WEEKS!!" their eyes said.
It had some weird behavior: you’d step across a specific function call and all of sudden all the member variables of Helper get messed up. It's like the fundamental laws of the coding universe were thrown out the window.
In the end, someone went through all the recent changes and came across my code.
The Solution
So what did I do now?
Aside from dying a little inside since I had killed the productivity of practically an entire team, I went through my build process for the things that could be improved:
- Headers built into shared libraries are in the same folder as those that aren’t, we should separate them out.
- Change our “build verification test” script to run changes against Project2 by default.
- Brief our team on the dangers of changing this shared code and its headers.
- Talked to those involved and asked how they traced the bug back to my change.
- Wrote a blog post detailing my harrowing experience so others could learn as well.
The end result is our changes are now less likely to cause such a regression and future devs who are less aware of the project dependencies do not make the same mistake I did.
Things_learned_from_messing_up++;
Something to be prepared for when accepting any new far away job is the culture shock. While I’m sure it’s more of a thing for people who leave their country, it can still happen when changing states.
One thing that got me about Redmond was the snow. I grew up in Colorado and went to school in New York so I’m a big fan of snow. Sledding, being snowed in, attacking snow goons, the works! But Redmond, sadly, gets about one dusting of snow a year.
Unfortunately, my "shock" didn’t stop there. As it turns out, whenever there’s a hinting of snow, Redmond drivers will throw caution into the wind…
…and replace it with extreme, relentless paranoia. Not only will people drive like their grandmother’s, they will go so far as to pull over and put their blinkers on to wait out what in their eyes must be the storm of the century.
I patiently* drove home today behind a car at 10 MPH, counting the pairs of blinking hazard lights on the running, unhazarded cars that dotted the side of the road. After two and a half years, it’s safe to say I was still culture shocked.
So just be prepared. Culture shock can come out of nowhere, make a slow turn into your lane and never let up on the brakes.
*Read, “patiently”
While on vacation, there were many holiday moments that were highlighted by their streaks of geekdom. Such as my mother going into tears after seeing LOLCATs for the first time or me hooking up a router so my brother could play Xbox live (and now has a way higher Halo 3 rank in the two weeks I was there verses the months I’ve had the game).
But none compares to the Mac incident.
My mother loves to point out how she uses a Mac and not a PC when I’m around. Even though I work in Microsoft Office, I get asked why I didn’t add some feature to Windows Vista that Leopard has (not to mention the temporal difference in release dates).
None the less, it’s quote “easier to use”. So along comes the time when we need to burn a CD. After trying to get the free software that comes with my dad’s PC to work and failing, we decided to try the Mac.
The CD slides into the side of the screen and up pops a message about a blank CD and if we’d like to burn to it. A few clicks later and the CD is burning. “Well I’ll be!” I thought, “that was darn easy”. We leave the room for a while and come back to check if it’s done. “Operation Complete” it exclaims! I couldn’t see their expressions, but I’m sure there was a smug look of “Try that on for size, PC guy.”
Then comes 45 minutes of my parents trying to get the CD to eject from the drive being there’s no eject button on the side of the machine. Look in Finder, no CD drive, can’t find the icon on the desktop. Finally they manage to bring the burning software back up, but the Eject button is disabled. Some internet searches later points to the eject button on the keyboard. A quick press of this button that's been there the whole time and....nothing.
Reboot holding the eject button on the keyboard, reboot holding the mouse down, reboot doing both, do a dance to appease the Mac gods and then hit the eject button. Nothing comes out of the CD drive.
They leave the room, dejected and heartbroken that their so easy to use Mac has let them down.
I peek over and see a freshly burned CD-R laying on the desk next to the side of the Mac right below the vertical slit that is the CD drive. I walk out of the room and present the CD to shocked faces.
“How did you get it out?”
“Magic”
Since starting work, I’ve been exposed to a bunch of different pillars of software requirements. These can include security, performance, localizability, etc.
One big one that is hard to see (no pun intended) is accessibility. How does a blind user use the product? Can a color blind or “high contrast” user use the product? Exposure to this has changed how I view just about any software application, including games.
Many games are playable by those who are deaf using subtitles, and some are playable by those who are color blind. I’m not sure how people who are completely blind play video games, as a lot of work goes into screen readers on an operating system to enable software for the blind, but I don’t think such software exists for PC games or console systems.
Color Blind Issues
For color bind users, there are some interesting engineering puzzles to solve for games that are dependent upon matching colored items.
Take for instance, Zuma:

You must shoot and combine colored balls to win the game. How do you tell which balls to shoot at if they were all colored the same? Above, of the first five balls, which are the same color? (Answer)
Zuma is an interesting example because the balls roll, so even though there's a different texture per color, it's not a perfect fix. Unless all balls rolled in the same phase, two balls of the same color can end up looking significantly different from each other. Plus there’s the “powerup” balls which always have the same symbol no matter what their color (see the “pause” ball above?)
Another example is Mutant Storm Empire where combos are rewarded on shooting all the guys of the same color first:

How would you go about making this game accessible to a color blind user?
“Color Blind” Mode
Some games do have a state for color blind users. For example, Astropop has a symbol mode you can turn on to differentiate the colored blocks.
Boom Boom Rocket can show the button symbol along with the button color:

Future Gaming Accessibility
I have yet to find a game which explicitly had settings for users who require a “high contrast” or “large type” setting to play. Not all games are designed with these users in mind, some companies may not see the user base as a high priority or the game play simply doesn’t work.
Casual games however tend to target a variety of audiences (all of the above are Xbox Live Arcade games) and so we may see future games which try to be playable by a larger audience. My guess is the console will need to lead the way and support these kind of things in the dash before game makers being to implement them as well.