The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Are C# programmers masochists?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Paul Vick

Posts: 783
Nickname: paulv
Registered: Aug, 2003

Paul Vick is a Tech Lead on Visual Basic at Microsoft Corp.
Are C# programmers masochists? Posted: Feb 10, 2005 11:12 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Paul Vick.
Original Post: Are C# programmers masochists?
Feed Title: Panopticon Central
Feed URL: /error.aspx?aspxerrorpath=/rss.aspx
Feed Description: a blog on Visual Basic, .NET and other stuff
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Paul Vick
Latest Posts From Panopticon Central

Advertisement

OK, normally I try to be pretty even handed about the whole “VB vs. C#” thing since we’re all one big happy family, but sometimes I just gotta wonder... Scott Wiltamuth (he’s the product unit manager for C#) was talking on his blog about the recent Office System Developer Conference and said:

Given VBA's long history with Office, one might expect VB .NET to be the primary language among .NET developers using Office as a platform.  But I've seen a lot of anecdotal evidence that C# usage of Visual Studio Tools for Office (aka VSTO) is high.  I'll try to get some solid data on this and share it here.

Which raises the question: are C# programmers just masochists? I’ve always kind of suspected, what with the case sensitivity, the cryptic syntax, the lack of declarative event handling, and so on. But it seems to me that programming against Office is one of those places where VB has got it over C# hands-down. Sitting on my desk are some chapters of a book that I’m doing technical reviews for. The book is about using Office from managed code, and several of the chapters (maybe the whole book, I haven’t gotten that far) are written in C#. So as I’ve read through the chapters, I just keep circling things and writing in the margin things like “this limitation doesn’t appy to VB” and “this code is simpler in VB.”

For example, VB supports optional parameters, named parameters and passing expressions to reference parameters, whereas C# doesn’t. So when printing, code that in VB looks like:

Doc.PrintOut(Copies := 2, Collate := true)

Becomes in C#:

object copies = 2;
object collate = true;
Doc.PrintOut(ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref copies,
ref missing, ref missing, ref missing, ref collate,
ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing);

There are other various little gotchas sprinkled throughout Office (like the fact that C# can’t bind to Word’s Close event and VB can, although I think VSTO finesses this a bit), which raises the question: why would you use C# instead of VB to automate Office unless you were a bit of a masochist?

OK, OK, OK, I’ll admit it – I’m only half serious here. I don’t really think that C# programmers are masochists who whip themselves on the back every night chanting “I will initialize all of my variables, I will initialize all of my variables” and wear their “I Am Strongly Typed” hairshirts under their clothes during the day. In fact, I have it on good authority that many C# programmers are normal, well-adjusted members of society. But that doesn’t mean I can’t razz them a bit every once in a while…

Read: Are C# programmers masochists?

Topic: JTeam Previous Topic   Next Topic Topic: SortKeys suck

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use