Taking it to the next level…

April 15, 2004 at 9:21 pm

Josh writes:


I’ve been working professionally with C# for about 2 years now and am just blown away by the things I can do with it. Lately though, I’ve felt like I’ve plateaud at this beginner to intermediate level. Every book I look at is either “Hello, World” or beyond my level of expertise, I feel like I’m always one step behind the game and my code is becoming stale.


That’s a very interesting question. I’m not longer a professional programmer (though I was for a little over a decade), so you’ll also want to listen to the comments that others are sure to write.


If you haven’t read them, there are a couple of books that I’d definitely recommend.


Code Complete
The Pragmatic Programmer


Both of these are currently on my bookshelf (actually, they would be if somebody hadn’t walked off with my copy of Code Complete).


To expose yourself to some new ideas, I’d also suggest:


Refactoring: Improving the Design of Existing Code
Extreme Programming Adventures in C#
Test-Driven Development in Microsoft .NET


Whether you agree with these approaches or not, they are certainly thought-provoking.


The best programmers that I’ve known always have a few side projects going on, where they’re exploring new areas, new environments, etc. If you’ve never done network programming, try writing some socket code, or play around with remoting, or DirectX. Play around with tools, like a profiler, or measure the performance of different options. Get a book on .NET IL and spend some time under the covers (Richter’s book is a good guide here).


Finally – and this may seem like weird advice from a C# guy – spend some time writing some code in a language such as Perl. Scripting languages lead to a different mindset that can be useful in language.

Pragmatic Unit Testing in C# with NUnit

April 13, 2004 at 7:59 am

I got this reference from http://www.theserverside.net, but since they require login to get to the link, I’ll instead refer you to the book page


I took a look one of the sample chapters, and I thought it looked pretty good, except for the fact that the first interface in the chapter is named “Environment” (the others are fine). 

A new career choice

April 2, 2004 at 11:12 am

Let’s see:



  • Never been convicted of a felony

  • US born

  • 40 years or older

  • Resident for the last 40 years.

I can run for president!



Darn. I just checked Wikipedia, and found out that you only have to be 35. I’ve been wasting the last 5 years.

How to run a blog…

February 12, 2004 at 9:52 am

I was having a discussion with Joe a few days ago, and he asked me what he should do when people make comments that ask questions.


My current approach is to look at the question and try to decide whether I should do a new posting on the topic, or whether I should just add a comment, but I realized that I don’t know whether most people go back to the comments to look for answers or not.


If you have an opinion on what you think works well, feel free to comment about comments in the comments section of this post on commenting on comments.

Excellence in Technical writing

February 9, 2004 at 9:33 pm

I was reading the manual for my iRiver a few days ago. There are lots of details and acronyms in the digital music world, and it’s sometimes hard to figure things out – especially if you aren’t very technical. For example, the player will display an icon telling you what format of file you’re listening, but not everybody knows what an OGG format is.


The folks at iRiver have taken that into consideration, and they’ve included this handy graphic:


 



Now that’s helpful.

How do you look for code?

December 4, 2003 at 12:27 pm


Another question, this time from one of the other PMs on the team:

The C# team is trying to understand how you look for code when stuck or trying to
learn some new technology. Currently the solution we provide is in the documentation
– you can find among other things –

  • Walkthroughs on the product
  • Documentation for each method
  • How to articles that target specific tasks
  • Code snippets
  • Working pieces of code that we ship in the product that do a specific task.

How do you try to find code for a task that you don’t know how to write? Is the Help
content in VS organized well and is it adequate? What would you change to help
people ramp up on new code, tasks, or the capabilities of the tool faster? What annoys
you about the samples we provide today?

 


Don’t write code like this…

October 21, 2003 at 7:22 pm

I’ve just finished doing a security review of my MSDN columns, and as part of that,
I needed to add some security to an add-in architecture, so the add-in architecture
won’t run antisocial code. The approach taken by .NET security is reminiscent of ACLs,
which means (at least to me) that it’s confusing and I need to read the code 5 or
6 times before I understand it. Along the way, I got a chunk of code from somebody
on the .NET security team, which I’ll reproduce here:

private NamedPermissionSet FindNamedPermissionSet(string name)
{
	IEnumerator policyEnumerator = SecurityManager.PolicyHierarchy();

	while (policyEnumerator.MoveNext())
	{
		PolicyLevel currentLevel = (PolicyLevel)policyEnumerator.Current;

		if (currentLevel.Label == "Machine")
		{
			IList namedPermissions = currentLevel.NamedPermissionSets;
			IEnumerator namedPermission = namedPermissions.GetEnumerator();

			while (namedPermission.MoveNext())
			{
				if (((NamedPermissionSet)namedPermission.Current).Name == name)
				{
					return ((NamedPermissionSet)namedPermission.Current);
				}
			}
		}
	}
	return null;
}
    

Ugly, isn’t it?

The root of the problem is that PolicyHierarchy returns an IEnumerator instead of
an object that supports IENumerable.  This means that I can’t use foreach on
it, and have to write the traversal myself. This decision also means that, without
a collection returned, there’s no place to hang a useful method like “LookupLabel()”
on, so all users are stuck writing the search code themselves (or encapsulating it
off into a separate method).

PolicyLevel.NamedPermissionSets uses a different approach, that of returning an IList,
which is better than an enumerator, as I could use foreach on the IList, but the person
who wrote this sample didn’t because they didn’t know about foreach. If they had,
they would have done the right thing.  

We need to not do this.

 

Learning to speak in public

October 17, 2003 at 11:29 am

I enjoy giving presentations – there’s something about being up in front of a crowd
that is very powerful, especially when they’re laughing.

But I wasn’t always like that. In fact, throughout high school and college, I avoided
those sorts of situations as much as possible. When I got out of school and started
working (at Boeing Computer Services, doing engineering graphics), I decided that
being able to speak in public was a skill I wanted to have. Boeing sponsored a Toastmaster’s chapter,
but that seemed like an artificial situation (I told myself). To be honest, it
was probably more that deciding to do something like that is a big move,
so I put it off.

One day, a fellow motorcyclist who I had taken a motorcycle safety course
from suggested that I become an instructor for MSF.
That seemed like a great idea – I could learn to speak, teach people to ride better,
and make a little spending money (very little, it turns out). So, I sent in an application
and was accepted to the 1990 instructor class.

Though the format has changed since then, at the time the course ran for 8 days straight.
You started with 6 days of covering the beginning
rider course
 in excruciating detail. For the classroom sections, you walk
through what you need to present and do short practice sections of presentation. For
the range (ie riding) sections, you learn how to present an exercise, how to demo
an exercise, where to stand, what appropriate coaching is, how to get the students
to do what you want, and how to keep track of time. You’ll spend 8 hours a day on
this, plus 4 hours at night studying.

Then, on Friday night, an unsuspecting class of students shows up to be taught by
the instructor candidates, with your chief instructors there only to observe (and
to rescue you if you really screw up).

The result is not pretty.

The classroom sessions go pretty well – the curriculum is very good, and even if you
just read the talking points and show the videos, the students will do well. The range,
however, is another matter.

MSF courses teach skills in progressions – the students learn one skill, and then
the next exercise builds on that skill. A cornerstone of that approach is that students
need to actually *learn* a skill before they go to the next exercise. Unfortunately,
it requires skilled instructors to ensure that, and we were far from skilled. We chose
exercises to lead by lot, and I drew exercise 11, which is titled, “Shifting and turning
on different curves(3) and shifting and making sharp turns”. It requires the students
to put together actions smoothly and in the right order on an intimidating course.
It’s very, very useful in a well-taught class, but for me, it turned into the exercise
from hell. To get a passing grade as an instructor, the students need to achieve the
point of the exercise, and the combination of them not getting good instruction and
my inability to keep them in the right path of travel meant that it was pretty much
a foregone conclusion that I would not get a passing grade on that exercise. Luckily,
I had passed my first classroom section, and I only had one more range exercise to
teach, “stopping in the shortest distance”, which is pretty much impossible to foul
up as an instructor. So, I passed the course, though it was incredibly intense. That’s
to make the real courses seem easy.

After a while, I started teaching the classroom section by myself. The courses only
have 12 people in them, so the size isn’t that intimidating, but you have to be “on”
the during the whole course. Over time, I got so that I really enjoyed teaching the
courses, though I had to give them up recently because of other time committments.

Onto C# Land. The original C# team was part of the VC++ team, and we had 4 devs, 5
testers, and one PM working on the compiler, plus Anders and a couple of other people
on the design team. After we announced C#, there was a ton of call for talks on the
subject, and limited resources, so I started doing talks (one of the nicethings about
MS is that I was able to do talks even though I was a QA lead, not a PM). In one quarter,
I did 23 talks on C#, and found that I was a bit of a ham when I got up in front of
people.

If there’s a point to this story, it’s that if you want to get good at something,
you need to just do it. But try not to start in a the “Rock Star”-talk-to-3000-people-at-PDC
mode.

Naked at Work…

October 15, 2003 at 2:45 pm

This is not the newest manifestation of the “Dress Casual” trend.

Naked
at Work (And Other Fears):
How to Stay Sane When Your Job Drives You Crazy

Is a book that I’ve been reading. It’s a self help book, but not the “do these things
to make yourself better” vein. More in the “this is why the world seems to be the
way that it is”.

I picked this up at the library because I liked the title, and I was happy to find
that it has a fair amount of wisdom in it. For example, just because we think about
ourselves all the time does not mean that other people think about us all the time.
That means if our boss sounds grumpy when he meets us in the hall, it’s much more
likely that he’s not grumpy about us, but about other, more important things in his
life.

The big surprise for this book – based on my assumption that the title was dreamed
up by the publisher to sell more books – was that it is genuinely funny. Paul Hellman
has a style that is not unlike Dave Barry’s, and in my book, that’s a pretty good
place to be. Here’s an example of an anecdote from the book:

Anecdote #20: Traffic Item in the paper: A union debate whether to block rush
hour traffic to “draw public attention to worker’ gripes.” Is there a connection between
rush hour traffic and workers’ gripes? I think yes! I’m a worker, and one of my main
gripes is — rush hour traffic. Maybe the union’s motto should be, “We’re not going
anywhere and neither are you.” But I doubt the public would react favorably: “This
traffic is driving me NUTS!!! And yet — it’s also increasing my sympathy for workers’
gripes!” Anyway, it doesn’t really matter. You can’t block rush hour traffic. It’s
already blocked! That’s the whole point of rush hour traffic. If the union really
wants public support, they should figure out a way to unblock it.

Read this, or get ready to peel some onions…

October 10, 2003 at 5:26 pm

A nice post