Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

Dave Sussman's .NET Blog

writerus drivelus

Code in books

Code in books has always been a dilema; what language should we use? For books targetted at a aspecific language it's no problem, but what of books aimed at a technology, such as ASP.NET books. The general consensus is that C# programmers can generally read VB better than VB programmers can read C#. It's a catch-all statement, and obviously doesn't cover everyone, but on the whole it's probably right. Certainly in the ASP.NET community I reckon it's more accurate.

So, the dilema is what to do with code samples. And we're talking samples within the book, not downloadable ones. Do you just sweeping ignore one language? For a generic technology book using on C# would limit your audience as VB people wouldn't buy it, while using VB would deter less people. It's good to see people voicing an opinion on this; a book that puts samples in both languages. While this is great, there are problems. First is I'd feel that if every code sample was in both language the book would feel really fragmented; it would break up the actual content too much. Also for larger samples, such as a page or two long, that would mean four pages of code. I'm not particularly keen on this, although I have to admit I've done it in the past. The other thing is that it increases the cost of the book; more samples means more pages means more costs. Those costs (editing, reviewing, printing) inevitably get passed on to the consumer.

So what's the solution? Well, I don't have one, but I'd sure like to hear your views. I don't dislike the multiple languages scenario, but it depends upon the book. Until we all have electronic books where you can just select a language option (a la MSDN) we're stuck with making a choice. What do you prefer?

Published Wednesday, April 28, 2004 10:25 AM by dsussman
Filed under: , ,

Comments

 

dsussman said:

Why not have the "in chapter" samples written in VB and then have an appendix with all the samples translated into C#? This would keep everyone happy and not fragment your book.
April 28, 2004 7:49 AM
 

dsussman said:

Interesting idea. I wonder if flipping to the back for a different language would annoy people too. It just seems that every solution has some kind of drawback.
April 28, 2004 7:54 AM
 

dsussman said:

we decided to go with both VB.NET and C# in this book (http://www.sitepoint.com/books/aspnet1/) purely because it's aimed at beginners - we didn't want to have to force them to choose a language before buying the book. I think it's worked quite well, as most of the samples are quite small, and it highlights the similarites and differences between the languages. However, as you point out Dave, the book is bigger and took longer to produce because of this - which has indeed resulted in a higher price, although I think it is worth it. If we do further (more advanced) ASP.NET books, I think it's likely that we will do separate C# and VB.NET versions, for the reasons that you have mentioned. Additionally, I don't think providing an appendix (or just a download) with the C# version of the code in a VB.NET would be sufficient for me.
May 2, 2004 10:53 PM
 

dsussman said:

I like the aPress approach: publish one version for C# and another for VB. In some cases, they get an expert in the other language to help with the re-coding. Bill Vaughn's work with ADO.NET is a prime example, and in the bargain, there was a synergy between him and his C# co-writer that led to some good performance tips.

As to C# developers generally reading VB better than the other way around, this is like any generalization--there are a lot of exceptions. I see them daily in the ASP.NET forums. It seems that a lot of total newbies to any language are deciding to start out in .NET with C#. I suspect that they think it's cool, or something. (If only then knew how literally C.O.O.L is is, eh?)
May 4, 2004 11:53 AM
 

TrackBack said:

Take Outs for 28 April 2004
April 29, 2004 12:28 AM
 

Aldactone. said:

Aldactone. Online pharmacy aldactone. Hyperkalemia caused by aldactone. Treating acne with aldactone. Length of action of aldactone. Kayexalate for hyperkalemia caused by aldactone.

July 30, 2008 2:40 AM
Anonymous comments are disabled