Friday, April 30, 2004

Jay and Properties...

Eric Gunnerson and a host of others debate the virtue of properties in C#: Jay and Properties... Here's my take on the properties implementation in C#: I generally would agree with Ryan about assumed private members being a bad thing. But I also like what I think Thomas is hinting at - what if a simple
public property string Name;
was equivalent to something like
private string ___name;
public string Name
  get { return ___name; }
  set { ___name = value; }
BUT if you declared Name using get & set, nothing would be automagically linked up? Of course is there really any difference between that and a public field? (original post that spawned the debate: jaybaz_MS's Weblog: Properties? Not my bag, baby. In general I have to say I agree with Jay, and am thinking I'll be using fewer "simple properties" from now on...)

Google's IPO Filing

Why can't all companies release their legal forms in this manner? SEC Form S-1 Haven't got time to read all 100 pages at work, but my overall impression is this: Google strongly wishes to offer these initial shares to common people - i.e. their users, and have approached the IPO accordingly - the shares themselves will be offered up in a public auction, and the prospectus detailing the offer is written in plain English.

While waiting for Gmail, part 2

Anyone willing to bet on whether Gmail will be publicly released before Google's IPO? Seems like that would give the company a few gigabytes' worth of 'free' publicity...

Windows Forms: Redux: Safe, Even Simpler Multithreading in Windows Forms 2.0

Michael Weinhardt writes about the new BackgroundWorker component in Windows Forms 2.0. This sounds an awful lot like a vastly more general version of the 2nd component I mention below, which means my component will become unnecessary. No surprise there. Wonder if I'll actually build the component before Whidbey comes out?

Tuesday, April 27, 2004

Components I'd Like To Build

but for various reason haven't done yet #1. A CodeSmith template to generate WebService stub methods for public BLL classes - user points the template to a class and a webmethod is created for every public method in the class. #2. A CodeSmith template to create a client side component that exposes EndInvoke methods from a webservice as events that can be attached to using the property grid - user selects a webreference and gets the component code #3. A generic CodeSmith template to wrap other CodeSmith templates and save the output to a file #4. A generic Component designer control, that would allow the user to add any component from his solution to the design surface without having to add the component to the toolbox. In other words, it would work the same way as when adding a typed dataset to the design surface.

Labels: ,

New Features in VB.NET Whidbey - and why I chose C#

ONDotNet has an introduction to the changes coming to VB.NET in Whidbey/VS 2005/.NET 2.0: New Features in VB.NET Whidbey, Part 1 [Apr. 26, 2004] This is why I chose C# 2 1/2 years ago:
"Another new keyword in VB.NET is To. For example:
'---new "To" keyword
Dim num(5) As Integer
Dim num(0 To 5) As Integer ' same as above
The To keyword serves cosmetic purposes only; it does not allow you to change the lower bound of an array:
Dim num1(1 to 5) as Integer   ' not allowed
Using the To keyword helps to make your code more readable; beginning VB.NET programmers (especially C++ and Java programmers) often did not realize that the number of array members is always one more than the index specified in the array declaration."
While I'm all for making code more readable, adding a completely useless keyword because newbie programmers couldn't get 0-based indexing shows a too high emphasis on making coding accessible to newbies, rather than trying to make bread and butter stuff easier for people who already know what they're doing.

Monday, April 26, 2004

Spare a thought for the next guy

Mr Ed has some lessons for would be do-it-yourself phone installers and programmers alike: Hacknot...

Wednesday, April 21, 2004

Yes, I am a mindless sheep

Don't know where this started - I got it from Steve Eichert - go blame him:
"When you are learning a new language, your initial reaction may be to ignore comments, but those at the beginning are just as important as later ones." C# Design Patterns
Grab the nearest book. Open the book to page 23. Find the fifth sentence. Post the text of the sentence in your journal along with these instructions

Friday, April 16, 2004

How to fold shirts...

...and skirts too. Amazingly quick and simple; learn how by watching this short clip (6MB) Seriously. You should watch it. All 2 of you who may ever read this.

Thursday, April 15, 2004

Handling WebService Exceptions When Invoking a Webmethod Asynchronously

From the "duh, of course, but I forgot it" department: When catching a SoapException thrown by a WebMethod that you called asyncronously, you have to pass the exception back to the UI thread through a delegate if you want to, say, display a message to the user:
/// <summary>A delegate used to pass the data from the asynch webservice call back to the UI thread</summary>
private delegate void SaveDel(ContactDS cDS);
/// <summary>Delegate used to pass any exception back to the UI thread</summary>
private delegate void AsynchErrorDel(Exception exc);

/// <summary>
/// Call-back method running on the Asynchronous WS thread.
/// </summary>
/// <param name="ar">Represents the status of the asynchronous operation</param>
private void SaveContact(IAsyncResult ar)
		//Get the contact record count from the EndInvoke WS method
		ContactDS cDS = new ContactBll().EndSaveContact(ar);
		//Pass the record count to the UI thread by invoking the UpdateStatus method through the SaveDel delegate
		this.Invoke(new SaveDel(UpdateStatus), new object[]{cDS});
	catch (Exception exc)
		//if something went wrog during the call, pass the exception back to the UI thread
		this.Invoke(new AsynchErrorDel(HandleAsynchError), new object[]{exc});
This really is no different from any other asynch call - you shouldn't update the UI from a background worker thread.


ReSharper is a great-going-on-exceptional add-in for VS 2003. If you're not using it already, you're missing out. I've only been along for the ride for the last 10 builds but have seen a marked improvement in features set and stability.

Labels: ,

Making me hugry

Downloaded these yesterday from Crispin Porter + Bogusky, and they're making me hungry for a Whopper... champion copy wrapper Maybe not watching as many commercials on TV (post TiVo), I'm now more susceptible to them...

Random Sampling in T-SQL

More statistics than I really wanted to start my day with: Random Sampling in T-SQL


Wednesday, April 14, 2004

While waiting for GMail...

All the hype about GMail makes me appreciate Lookout even more... It's still a 0.89 version, but so far has been more stable than Outlook itself.

Subservient Chicken

I was wondering how Crispin Porter + Bogusky was going to spend all the Burger King money. Well here's one way to have it your way: Subservient Chicken. Go tell it to lay an egg.

Tuesday, April 13, 2004

The one where I expose my ignorance to the masses

Why aren't reference types polymorphic? I believe this FAQ was prompted by an e-mail I sent Mr. Gunnerson a few days earlier. Or maybe it was just one of the last straws. Anyway his email response and the FAQ entry didn't make complete sense to me until I read Jon Skeet's excellent article Parameter passing in C#...