Geeks drive girls out of computer science

December 17th, 2009

My wife linked me to this article about a cultural study done on certain masculine aspects of things which often surround computer science.

http://www.msnbc.msn.com/id/34437233/ns/technology_and_science-science/

She (my wife) brought it up in the context of cables and cords lying around and I’d guess that extends to the unused laptop, mouse or keyboard. She is a very neat person. I am less so, but she keeps me in check. This is good.

The article talks about the physical environment of a computer science classroom or office. I don’t know what classrooms this study is looking at. I can only assume that they are primary and secondary classrooms because the college classrooms in which I teach and in which I attended are the same boring sterile classrooms in which all subjects are taught.

I can comment on offices. The quote from the article is a quote by the lead researching Sapna Cheryan from the University of Washington. She says “… the image that immediately pops into many of their minds is of the computer geek surrounded by such things as computer games, science-fiction memorabilia and junk food.”

I’d like to address each of things. There are no computer games on my desk at home nor at work. At home, I share a desk with my wife, occasionally there is a game left out. They are hers. I have her Rollercoaster Tycoon CD in my backpack right now, because she left it in my disk drive. I do not play video games. It is a choice. I used to play a few video games. I think that when Starcraft 2 comes out, I’ll probably play that video game.

I have some science fiction memorabilia stuffed in drawers at home. A hat from the cast of the original Stargate movie. A signed Richard Dean Anderson photograph. Both of these were gifts from people who knew that I love Stargate. I don’t leave them out. I don’t talk about them. In fact, if any of my coworkers read this, both items will probably be a surprise to them, and they will probably make fun of me greatly for each of them.

Junk food is bad. I’d probably eat lots of junk food if I didn’t have my wife to take care of me and she didn’t constantly remind me about good nutrition and encourage me by talking to me about the food industry, summarizing books for me and watching movies with me such as Supersize Me and Food Inc. I bring my lunch to work almost every day rather than eat out. As I write this many of my coworkers are out at the monthly Ann Arbor “Nerd Lunch”. I try to eat healthy.

I try to eat healthy to the point that food preparation is something that I can talk at length about. Last night I made cottage cheese. I bake all my own bread. I’ve not bought bread from a store in over 6 years. I make my own chicken stock. I make a lot of things that are often bought. I do not consider any of these things add to my computer geek. If anything I’m a non-geek. These things are also traditionally non-masculine activities. Although more recently I think they are more niche hobbies than feminine activities.

What is the point? I guess I’m trying to say, look deeper. Yes, on the surface there is a video game, bad-sci-fi, junk food culture to computer science, but as soon as you peel back the first layer there is a variety and depth as wide as any other profession.

Pandion “Free Software” can go to hell

December 15th, 2009

I’m not entirely sure that it is what installed Ask Toolbar on my system without asking me, but I am 100% entirely sure that it is what changed my browser start page without asking me.

EVIL EVIL EVIL

Pandion IM software from http://pandion.im/ should be avoided.

It doesn’t matter that it is GPL and free as in speech. It is evil.

I still like wired networks

December 13th, 2009

I needed to archive 472MB of photos onto the home file server so that my wife could access them.

Over wifi, I got an estimate of 35minutes. Yes this is horribly slow, even for a 54Mbit “G” speed network.

So I plugged in the CAT5 cable, I disabled wifi on my laptop and I pressed refresh in windows explorer so that SMB2 was now talking on the wired network.

I performed the exact same drag and drop to copy the files and it was done in 5 seconds, almost faster than I could expand the Windows 7 copy dialog and see the transfer rate of > 50MBytes/second.

Learning WPF… For real this time.

December 11th, 2009

I’ve been diving into WPF, again.

WPF is different now and will be even more different in 4.0. The WPF Toolkit is not an “option” in 3.5, it is a requirement. Just like I wouldn’t want to write .NET Code without certain 3rd party libraries (castle, elevate, etc..), I would not want to write WPF without the toolkit.

WPF in .NET 4.0 includes many things from the WPF Toolkit. The one thing that makes Winforms developers like me feel right at home is DataGrid, but the WPF DataGrid is not DataGridView for WPF. I keep running into surprises.

The latest surprise had to do with a prototype I was building. In Winforms, I often just databind a DataGridView to any IList<T>, and let magic do the rest for me. After all, it is just a prototype.

I tried to do the same thing with WPF DataGrid and I was met with a surprise. Surprise! Don’t do that. As soon as I changed from a IList<T> to an ObservableCollection<T> the binding worked. AutoGenerateColumns=”True” makes it very easy to prototype.

TFS is the new SourceSafe in cost

October 11th, 2009

from :
http://blogs.msdn.com/bharry/archive/2009/10/01/tfs-2010-for-sourcesafe-users.aspx

this quote stuck out :

There are 3 main areas that we’ve focused on in 2010 to make TFS attractive to smaller teams:

1. Price – We’re not quite ready to announce the pricing and licensing for 2010 yet but I can tell you that it will be at least as easy and cost effective to get as SourceSafe has been.  Stay tuned for more info on this.

If this is true (and I don’t think it is) it will greatly change the face of .net development organizations over the next few years.

Restoring a Desktop Image to a VMware Virtual Machine with Windows Home Server

October 9th, 2009
  1. Copy the restorecd.iso from \\homeserver\Software\Home PC Restore CD to your VMware server.
  2. Configure a new VMware virtual machine with an appropriately sized disk, a network adapter (I prefer bridged) and a CD ROM Drive pointed to said restorecd.iso from step 1. Do not start the VM at the last step.
  3. Find the vmx file created in step 2. Add a line ethernet0.virtualDev= “e1000”.  This the required trick step since Windows Home Server doesn’t have a driver for the LANCE network chip which vmware normally emulates.
  4. Boot the Virtual Machine and follow the prompts.

The Ugliest Code I’ve Written in a While

September 14th, 2009

  1. private EventHandler<MyEventArgs> NameObscured1(IMyForm form)

  2. {

  3.             return new EventHandler<NameObscured2>((sender, eventArgs) =>

  4. {

  5.                 form.TabControl.Enabled = false;

  6.                 IAsyncResult iar = null;

  7.                 Action bg = null;

  8.                 bg = new Action ( () => {

  9.                     NameObscured3((s) => {

  10.                         form.StatusLabel.Owner.Invoke(new Action(() => {

  11.                             form.StatusLabel.Text= s;

  12.                             form.StatusProgressBar.Value +=2;

  13. }));

  14.                         return false;

  15. });

  16.                     NameObscured4(sender, eventArgs);

  17. });

  18.                 Action enableForm = () => { form.TabControl.Enabled = true; form.StatusProgressBar.Value = 0; };

  19.                 AsyncCallback callback = (_) => { form.TabControl.Invoke(enableForm); bg.EndInvoke(iar); };

  20.                 iar  = bg.BeginInvoke(callback, null);

  21. });

  22. }

The question is… How can I make this more readable, and is it worth spending the time to do so?

Nesting lambdas to 4 deep cannot be a good idea, but honestly, factoring each one out to a method might actually make this code LESS readable IMO. In this case, it is just a damned shame that some things can be done cross threads in a Windows Forms application.

I’m guessing this is a sign that I am too tightly coupled and should have some kind of mediator which will then Invoke property updates on the correct thread, but I don’t have that now.

Moral of the story: don’t write nasty nested lambdas like me.

Professional Programmers have a Responsibility

September 13th, 2009

…To themselves and to the industry.

On a private mailing list I recently read a message which included this paragraph – this paragraph is totally off topic to the topic of the mailing list.

Author name has been excluded to protect the unprofessional programmer. (license breaker facilitator)

I’ve been working professionally as a programmer for nearly 20 years and I’ve rarely seen businesses that pay for Enterprise licenses, much less an "Enterprise" license that is only good for one Developer.  There will be tons of license abuse at this price point within businesses. Heck, most of the places I have worked at outfit their Developers with Visual Studio they got from one copy of the MSDN.

My response is this:

It is your professional responsibility as a programmer to point out to these businesses that they are breaking a EULA and if the software make found out they would likely be on the hook for hundreds of thousands of dollars in fees.

These types of business should be buying a copy of MSDN for each developer — that is how it is licensed. Or they should be investigating other options. And there ARE other options, whether it is Express editions, or a program like bizspark or open source such as SharpDevelop.

There is more than one way to linq that

June 28th, 2009

Eric Gunnerson has a post in which he responds to Justin Etheredge regarding “Is Programming A Generic Skill?

I’ll just say that I agree with them both. There are differences between ability, proficiency and mastery.

A Java programmer can jump into C# and be an able C# programmer immediately. It will take time to become proficient and even more time to develop mastery.

I am proof of this with python. I’ve been an able python programmer for over 10 years now(actually closer to 15), but I never spent enough time in python to call myself proficient and I’m certainly far from a master.

But the thing that Eric said which triggered me to write this is not the generic skill discussion with Justin, it is instead a remark that Eric said about Perl, “… because of TMTOWTDI”.

C# is very much becoming afflicted with There is More Than One Way To Do It. It certainly is both the language and library.

Consider LINQ. LINQ to Objects is a new way to do something which everyone has done differently in the past. When new programmers are exposed to linq, I often hear the question “When do I use linq?” The answer I give is typically “whenever you would use a for loop or foreach loop and if you can’t, figure out how you can".

If we throw away the ‘idiomatic code” to which Eric refers, then a giant bucket of TMTOWTDI is thrown in our face. Do we use properties or fields, events or delegate fields?

For public interfaces, FxCop helps a great deal with guidelines for these things and helping to learn the idioms of the language and framework, but for other things, you are left to yourself. That is why reading others source code is so important. (see the weekly course code)

Expand into libraries and TMTOWTDI explodes. From MSFT alone there is Remoting, Web Services (asmx), WSE, WCF, RIA Services, ASHX, ASP.NET Data Services, all of which have some overlap. Then for data access there is ADO.NET, Linq2Sql, Entity Framework. Even within ADO.NET alone, TMTOWTDI. Do you use a reader? Table Adapter with DataSets? Strongly Typed DataSets?

Open to non MSFT and TMTOWTDI explodes again, to the point where I won’t bother listing anything. There is too much.

I think that library TMTOWTDI will always exist. Even Python has SqlObject, SqlAlchemy and ORM as parts of other frameworks like Zope and Django. But language TMTOWTDI is reasonably well mitigated in Python. This is stated in a single line in PEP20 – The Zen of Python

There should be one—preferably only one –obvious way to do it.

C#, perhaps because it was not a goal and because of its C/Java/Delphi roots, has never had that. There has always been TMTOWTDI in C#.

How useful are your error messages?

June 18th, 2009

F.cs(334,8): error CS0539: ‘I.M’ in explicit interface declaration is not a member of interface
F.cs(20,15): error CS0535: ‘C’ does not implement interface member ‘I.M(out string)’

This is a fun example of a poor error message, and I don’t mean because I named my file F, my interface I, my method M and my class C.

Its poor because the underlying code looks like this:

interface I { bool M(out string); }

class C:I { void M(out string); }

Sure, this is obvious now what is going on, I have void, but I should have bool, but my error message doesn’t include that when it shows the type signature.  Now consider what happens when interface I is in an assembly which is given to me. I do not have its source, and there is no documentation. My means of finding the signature of this method are three fold:

  1. lean on visual studio press F12 to go to reference of the interface and VS shows me type signatures
  2. use reflector
  3. monodis mylibrary | grep MethodName

I usually use #1, which is probably why I’ve never seen how horrible this compiler error message is until today. Today, I used #3.

* monodis is from Mono