Wednesday, November 29, 2006

Vindication is best eaten cold....

An article sort of backing up what I was saying about not needing to learn C, and highlighting the bad points about C that I was alluding to. I guess my point was that we shouldn't need to worry about these things in 2006.

Monday, November 27, 2006

Build your own bit of history

The Altair kit helped kick start the computer revolution in the 70's. You can buy one and live(or if you're old enough relive) a bit of history.

Altair Kit

Why should you learn C?

Ok my previous post was not very constructive.

So I started off with the intention of posting a counter to my original argument. I was going to list the reasons why a programmer in 2006 should learn C. I was going to suggest that to be a C programmer you need to understand principles such as memory allocation and deallocation, pointers, creating string handling routines - basically all the things we dont need to worry about with languages like C# and Java.

Then I thought, why? Unless you intend to do embedded programming, really you DON'T need to know C. Even then you could probably use C# or Java, depending on the platform. C still has a place sure, but it's becoming like COBOL these days. Was great in the day, but has been superseded by newer, frankly easier to use languages.

Someone in the previous post suggested my arguments don't have enough substance, so I thought I would post some code examples of two basic programming functions in C and the equivalent in C# to highlight my issue with C. (My C is a little rusty so apologies if I have the function names wrong etc)

String Concatenation

char * ReturnStringProduct(char * str1, char * str 2)
if (str1 == null !! str2 == null)
return null;
char * product;
product = (char *)malloc((strlen(str1) + strlen(str2) + 1) * sizeof(char));
strcpy(str3, str1);
strcat(str3, str2);
return product;


private string ReturnStringProduct(string str1, string str2)
return str1 + str2;

Converting Int to a String

There is a function called itoa, but I believe that it isn't in the ANSI standard so found a routine that did this on the net

void strreverse(char* begin, char* end) {
char aux;
aux=*end, *end--=*begin, *begin++=aux;


void itoa(int value, char* str, int base) {

static char num[] = "0123456789abcdefghijklmnopqrstuvwxyz";

char* wstr=str;

int sign;

div_t res;

// Validate base

if (base<2 || base>35){ *wstr='\0'; return; }
// Take care of sign

if ((sign=value) < 0) value = -value;

// Conversion. Number is reversed.

do {
res = div(value,base);
*wstr++ = num[res.rem];
if(sign<0) *wstr++='-';
// Reverse string



Should All Programmers Learn C? I don't think so.

This list looks like it has been written by a 12 year old.

To say *every* programmer should learn C is complete idiocy. I can't think of a single reason why *every* programmer should learn C in 2006. In fact the only reason I can think of to use C would be for Device Drivers. I know probably 200 developers. How many write device drivers - none.

Even things like Micro-controllers have embedded JVM's these days.

A counter argument would be that things like JVM's, databases, Operating Systems are written in C. This may be true, but again how many people actually write these? Maybe 5-10% of all programmers.

Oh hold on. Games. They are predominately written in C++. Some could argue that is C, although comparing C++ with C is like comparing C# with C. Sure they may *look* the same but they are about as similar as a Daewoo and a Ferrari.

Anyway here is the list with my rebuttals:

1) C is lower level then other programming languages (C++, Java). Programming at a lower level allows you to further your understanding of computers, as a whole.

Bit of a hoary old chestnut that one. Sure you have to allocate/deallocate your own memory, and string handling is a bit ugly but other than pointers (and C++ has those too) C is not really that different.

2) Device drivers and operating systems are written exclusively in C. Now, you may never write a device driver or an operating system, but what if you are ever required to modify one?

That is completely false I'm afraid. Device drivers are written in C++ these days (remember C++ is no closer to C than C#). There is an OS (singularity) with the Kernel, OS and device drivers all written in C#. I have to concede that some parts are written in C.

3) What if you ever want to get a job programming microcontrollers? They are programmed in C. Are you going to limit your possible list of jobs because you didn't want to learn a new language?

Again a lot of microcontrollers are Java based so this argument falls down. The other part to the argument is non nonsensical. Just because you know C, doesn't mean you know anything about microcontrollers. Also I don't know how to fly a plane either. Am I limiting my possible list of jobs?

4) C programs are smaller and faster then any other program created in a different language. Sometimes your program needs that speed boost that only C can give it.

A complete fallacy. A program is as fast as its bottleneck and in most circumstances this is the person in front of the keyboard. Also this argument is like saying an Indy car can go 400km/h and an F1 car can only go 360km/h. Therefore an Indy car is faster....

5) If you have learned C, you can learn any modern programming language. The reason behind this is that all modern programming languages are based on C (Java, C++, C#, etc).

Most modern languages are far more than the syntax. .NET and Java have huge frameworks you need to learn that have nothing to do with the fact the a for loop looks the same in C, Java and C#

6) Because C has been around for many years, it has a large community and collective code base. This allows you to quickly and efficiently implement new algorithms or functions that have been programmed before.

Um have you not heard of google? I can't remember the last time I couldn't find a solution to a particular programming problem I have had. I program using C#, Delphi and C++

7) C is the language of the Open Source community. The Open Source poster child, Linux, was coded in C. If you know C, you can participate in and contribute to numerous Open Source communities like Source Forge.

Can't argue with that. Also the poster couldn't argue with the fact that there are just as many Java, or C# or Delphi open source projects

8) C is the only language that teaches you what pointers really are. C# and Java skip the subject completely. It is pointers that give C its power.

And it's pointers that give C it's largest problem. I'd rather let Gurus write a compiler or Framework for me that takes away the need to worry about the nuts and bolts, and lets me get on with writing the application.

9) C is still the most commonly required language for programming jobs. It is well worth your time to get C under your belt.

Well this is arguable too. There is estimated to be more COBOL code in the world. Does that mean we should all learn COBOL too?

10) Anything that has a microprocessor in it has support for C. From your microwave to your cell phone, C powers technology.

Yip and there are usually other options too. I can program my Cellphone in Visual Basic if I want to....

Dont get me wrong. In certain circumstances C is the best fit, and I cut my teeth in the late 80's with C. But to say that every programmer should learn it is a little overstating things IMHO.

Friday, November 24, 2006

Building the Perfect Beast

This is a great article. I agree completely with Joel (usually do). I think this completely sums up the difference between programmers, developers, software engineers (geeks) and designers. A designer would have an off button, and we as developers tend to completely over engineer things and have every possible option we can think of.

I have being recently working with designers building websites. They think differently. It's a fact. And it's a good thing I think. Designers don't understand the short comings of CSS and HTML, and really that doesn't matter. We as programmers should find ways to implement their design where absolutely possible.

This should definitely apply to Software Applications too. UI should be fun and importantly, easy to use. It hardly ever is though. Why? Because most software UI is designed by the guy who writes it and never uses it. I hear users complain the software they use being useless. Usually it's not, but the UI and ease of use suck, so the user equates that to the software as a whole.

The other thing we need to do is to stop developing applications with the expert in mind. Most of the applications I use show all the options available to all users. Most users don't care about 80% of the stuff you can do in Word for example, when all they want to do is write a letter, so why should they see it. The ribbon bar is going some way I guess but we are a long way off building the perfect beast.

I think plugin schemes should be used more. Software shouldn't be all things to all people out of the box. I use Excel a lot but only for doing basic number crunching. Why can't I get Excel Basic, and if the day ever arose when I needed Graphs, I could purchase the Excel Charting plugin. You could charge $99 for Excel base and then say $50 for plugins. Not only could it potentially lower the bloat of modern software, but it could stop Piracy as users would have no reason not to pay.

Sometimes simpler is better....

Wednesday, November 22, 2006

Debugging Compact Framework Apps on Vista

My trials and tribulations developing on Vista continues. As you may or may not know, Vista has a standard applet called "Windows Mobile Device Center" (another great name from the MS marketing department who get paid per word), instead of Active Sync.

This is great for Joe Schmuck who wants to plug in their Pocket PC or whatever. However if you are a developer like me it is a PITA. Visual Studio 2005 expects to see Active Sync, so when you try to debug/deploy it cant find AS so it throws a wobbly. A 30 minute intensive trawl on Google found the solution so here goes:

Basically because VS wants Active Sync, we must trick it into thinking it is still there. So open RegEdit and go to "HKLM | SOFTWARE | Microsoft | Windows CE Services".

If there is a key in there called MajorVersion, change it to 4 (mine was 6) and MinorVersion to 0. If they aren't there add them - they are DWORDS.

Restart VS and Roberts your mothers brother you should be able to deploy/debug to your PPC device.

Monday, November 20, 2006

What is your bloglebrity status?

I am a D-List blogger, but only miss out on being C-List by one link. Go on someone link me and let me move up the list ;-)

Article here

Vista Debugging IIS 7.0

Vista is a bit of a PITA for developing on. Because programs aren't run as admin by default, things like remote debugging and attach to process don't have the required permissions.

If you are opening an existing site in VS2005 and trying to debug by attaching to a process, you need to do the following: Tip/Trick here

Sunday, November 19, 2006

Vista and SQL Express

For those of you using Vista and SQL Express you should read this
Blog post

Basically Vista doesn' give full admin rights to your user, and SQL Express kinda assumes you are. The post explains well.

Downloading SP2 of SQLExpress will also fix, but it is only CTP at the moment.

Saturday, November 18, 2006


I have finally made it into the top 10 list on On Blog list! Thanks to those that have helped me get me to where I am today, and above all else, thanks to the Office floor for all it's support. Virtual choccie fish to anyone who can answer where that rather obscure quote originated from.

Hint, you would need to have played 8bit games in the 80's.....

Vista first Impressions

I downloaded Vista Ultimate off MSDN yesterday. I have just finished installing now and have been playing with it for the last 20 minutes or so. I couldn't get the Betas to work for me, so I am a Vista noob.

I upgraded from XP, rather than starting fresh. It installed/upgraded without a hiccup on my Dell Inspiron 9400 Lappie. I only have the Intel onboard graphics, so things could be a little better there, but I have 2Gb Ram and 2Ghz Duo Core, so no shortage of grunt to run things. It runs about as fast as XP. Somethings take a little longer to load, some take less. Internet seems a little faster, although it is getting pretty late (12am) so that is probably as much a factor.

The warnings when trying to run Sysadmin type apps are a little annoying. The sidebar gadgets are great and have downloaded a few extra's. Once either yahoo messenger or Gaim becomes available as a gadget that will be even better.

I guess the major change is the Aero interface. I must say I like it a lot. Seeing as I have fairly lowly graphics, my system is probably not doing it justice. Having said that it is still (IMHO) more of a programmers take on how good UI should be, rather than a designers idea. KDE and OSX are still better, with XGL on KDE showing genuine ingenuity. One thing I wish MS would "borrow" from X Windows is the virtual desktop system. It is the main thing missing.

Overall though I think Vista is a worthy successor to XP and I rate it so far as a 7/10. Well worth upgrading to.

Tuesday, November 14, 2006


I get NZ Computer World delivered weekly. It's a so so industry rag to be honest. It has very little local content, with most of the articles coming from the US sister publication. It's a little disappointing to me they don't use more local writers to produce articles. There is a strong I.T. community in NZ and many of these people produce blogs and are good writers whom could do as good a job as a US expert.

These sort of weekly publications are becoming less and less relevant in the age of the blog, but hey it's a tax right off and some of the articles are good.

Anyway, I have noticed that in the last few weeks they have been pushing the phrase I.C.T. like crazy. It stands for Information and Communications Technology apparently, instead of just Information Technology which is the current standard. Call me old fashioned but isn't "Information and Communications" a redundant statement? What is communication without information? Waffle perhaps? Hmmmm. Journalists. Waffle. Yeah I guess I shouldn't be surprised. (Those who can: do. Those who can't: write (Yes I do see the irony there)).

BTW anyone who is really involved with "IT" would rather die than call themselves ICT professionals. I much prefer any of Techie, Developer, Geek or even Computer Guy. ICT sounds like something a politician invented.</rantMode>

Saturday, November 11, 2006

Box Model Hack

I used to be blissfully unaware of things such as the Box Model Hack.

As primarily a Windows App developer, and sometimes ASP.NET developer I didn't need to know about the intricacies of CSS and standards compliant XHTML. I have been doing a lot more Web Apps/Sites of late and have unfortunately come across the "wonders" of IE's interpretation of how HTML should be rendered. I now understand the hate and vitriol web coders have for IE. All I can say is download FireFox and use it. The more people using Firefox the better in my opinion.

Two reasons:
1 - it's a better more secure browser
2- it renders HTML the way it should be rendered

I'll get back to my CSS file now and try and get the site I'm coding to look the same in all browsers. That aint easy ;-(