Fog Creek Software
g
Discussion Board




Becoming a C programmer

I work for a software company who's product is written in ANSI C.  I'm the web IT / internal / line-of-business developer, and basically have realized that there is no way I can stay at this place for much longer without getting out of the IT side of things (they are too understaffed)

Although I'm a capable programmer in VB,.NET, Java, PHP, SQL, etc.. I haven't done much with C.  But it would appear that there is an opening for me in the product development side of things if I can get up to speed with it.

I've written a couple of little C programs and so far, so good.  I think it's something I should be able to learn fairly quickly.  I'm basically able to get a library, and make a program without too many problems.

My question: with all the talk about C being a dead language, Is it worth it to make a career move predicated on that language?  Also, what sort of topics would be useful for an experienced programmer to learn so that I can be productive in C without necessarily being an expert?

Greg Sabaras
Thursday, March 18, 2004

If you don't forsee a shrinking market for your company's product, and you know that the fact it's implemented in C is absolutely critical to the success of the product (besides company knowledge of the industry domain) you might give it a try. Can you tell us more about your company or its product?

Li-fan Chen
Thursday, March 18, 2004

>>with all the talk about C being a dead language

What talk about C being a dead language? While it isn't being used as much (percentage wise) as it once was, it is far from dead...

RocketJeff
Thursday, March 18, 2004

Another thing you can consider is to go to another company that sells the same exact product (but aren't implementing it using c). Your non-compete shouldn't hurt too bad because basically you don't know how your current company's software was developed--you are just the inhouse webbie--and hence didn't learn any proprietary knowledge that would limit your choice of future employers.

Li-fan Chen
Thursday, March 18, 2004

I'm not gonna mention anything about the product /  company except to say that we are a small but growing player in a solid industry.

I would bet that the competition is doing everything in C/C++ - let's just say that speed and reliability are important, and most of the products in  this sector are well-established (10 years or more)

The way I see it, this is my chance to get out of IT and into product development.  Since I'm already an employee, they know me and my work ethic, and I think I stand a much better chance of getting in.

Greg Sabaras
Thursday, March 18, 2004

C is not a dead language, its still the most widely used language in the world.

Yes, you can be productive without knowing every detail. But you will need to know most of it. C is such a simple language compared to others, that there is not so much to learn really. it's the nuances that take time I suppose. For example, arrays and pointers are not the same thing but not knowing that doesn't cause trouble for most C programmers who think otherwise.

C developer
Thursday, March 18, 2004

My current project uses C, so I hope it's not dead yet.  It's an embedded system, the sort of thing where C is still used.  If you want to work in business applications, there might not be much demand for C programmers, but I am not familiar with that type of work.

C is a rather simpe procedural language.  The topics I would recommend if you want to become a better C developer would be:
- Understand pointers
- Understand memory allocation (heap vs. stack)
- Learn machine architecture
- Learn algorithms

mackinac
Thursday, March 18, 2004


The C syntax is easy.  It's the regression bugs and blown pointers that kill you.

I'd recommend learning a lot about pointer mathmatics, design patterns, stacks/queues/lists/trees, refactoring, and automated unit tests.

Keep your functions small.  Avoid bloat.  Make sure you can determine exactly what a function is doing by name and comments alone.

If you can, i'd recommend C++/STL over C - you can have the same syntax, but your data structures are abstracted.

Matt H.
Thursday, March 18, 2004

> I would bet that the competition is doing everything in C/C++

Perhaps that helps to tell you whether or not C is dead.

There are people who will say that it's better to learn C++ before learning C; but I do believe that C is a subset of C++, and that you can't be a good C++ programmer if you don't know C ... so learning C is a step towards learning C++.

> Also, what sort of topics would be useful for an experienced programmer to learn so that I can be productive in C without necessarily being an expert?

The syntax; pointer manipulation (including the meaning and use of pointer-to-pointer like "int **p"); standard library functions (like strcpy); memory management (malloc and free, stack-based variables, and global variables); specific non-standard libraries used by your application (including perhaps the O/S API); programming tools (editor, compiler and makefiles, debugger, profiler, run-time bug detectors); and general project-management/lifecycle/team experience.

Christopher Wells
Thursday, March 18, 2004

The most important thing is to keep your code boy scout clean. Whatever you write, make it absolutely a dream to come back and maintain it. Make it so much fun to write that you and your coworkers want to come back and read more of it. If you want a great job doing development, at least treat yourself to that or it won't be a fun job. C is utterly ridiculously fast--so most gurus are careful to advice against unnecessary code confusion due to over optimization of code. Write clear code, document properly, schedule feature adds and bug fixes in a humanly achievable fashion and you should have a great job, regardless of the languge you choose.

Li-fan Chen
Thursday, March 18, 2004

I totally second what Matt H is saying.

Li-fan Chen
Thursday, March 18, 2004

C is not easy to learn, mainly because of the subtleties regarding pointers which are obvious if you "get it", but not so obvious that simple and difficult to diagnose bugs are made by even relatively experienced programmers (how about the function that returns a pointer to a stack-allocated variable).

In your position with the other skills you mention, I wouldn't bother: you'll likely get fed up of maintaining existing apps and there are likely to be much fewer greenfield C projects than .NET, PHP etc.

anon
Thursday, March 18, 2004

I specifically asked the lead dev about design pattterns and pointer math, and he said "don't worry about any of that".

The product is a million lines of ANSI C and 100k lines of C++

My specific concern is being productive withour being an expert.  I would think that my current salary & experience as a web dev would probably translate to an entry level SW engineer at this shop.

Greg Sabaras
Thursday, March 18, 2004

I tend to come down fairly black and white on this - either you're a good programmer or you're not.

If you are then c is "just another language" to learn to read and write. Yes, there's rather more to it than that when it comes to being "expert" but in terms of being able to contribute I would hope you'd be up to speed reasonably fast.

Best advice is to get a copy of K&R and read it through a time or two (its a short book!).

If/when you start on the project you want to go bug hunting, whilst it can be very frustrating its also true that finding and fixing gives one a nice buzz (especially in someone else's code) - more importantly it should teach you a lot about both the language and the product in a relatively short time.

Murph
Thursday, March 18, 2004

"The product is a million lines of ANSI C and 100k lines of C++"

Most likely, then, the C++ code is where you would spend most of your time, as it probably wraps the code written in C.

Do you have access any of this code?  It is likely that you would mostly be calling functions/methods in the existing code base.  It's probably more important that you understand the design of the libraries and APIs specific to your product than learning a lot about "ground up" C/C++ issues.  Pointers, memory management, etc. has probably already been encapsulated and abstracted in a code base of this size, and you will just need to know how to call it appropriately.

If good abstractions/encapsulations aren't in place yet, you're company's product is probably in trouble :).

(And yeah, I know, leaky abstractions and all that, but he can learn the thornier issues as he goes along and as need requires.)

Jim Rankin
Thursday, March 18, 2004

If you're walking into this as some kind of hobby you wont make it. On the surface C is easy. I mean, how hard can it be? It's a relatively simple language. But one minute you're cruising down the highway and the next you're in the tall weeds with C. It's a place that a newbie will not extract himself from without a mentor to help pull him out. C is one of the easiest languages to royally screw up in. You can even take down the operating system in some cases. It's also a language that can have some wicked memory errors that will burn a newbie.

If you don't have a mentor to see you through the bad times then learning C on the job is a bad idea, IMNSHO, unless you are already proficient in other languages. You can very easily make things worse. The strange thing about programming is that some people write code and the project gets closer to being completed, and other people write code and the project is worse off for their effort. It would have been better if they just sat on their hands for the day.

But if you're working for a company that's willing to let you learn on the job and the company is also willing to let an experienced programmer mentor you, then I guess it's in your best interest to take the position.

Lou Vanek
Thursday, March 18, 2004

Other ways to find your way out of the reeds.

Expert C Programming: Deep C Secrets by Peter van der Linden

C Traps and Pitfalls: Andrew Koenig

Danil
Friday, March 19, 2004

Still the best way to learn C is to pick up the K&R book.  It's about 60% thinner than most "Learn C in a week" books, and is still the standard for clarity.

Learning C is very useful.  I'd wager that more than 75% of all C++ code out there is essentially C + a couple of additional features (better variable scoping, simple classes), so C gets you very far toward understanding the bulk of C++ code.  Then if you want to learn about full-bore C++, it's not too much of a chore.

Junkster
Tuesday, March 23, 2004

C is only simple in the same way that chess is simple.  I taught my brother to play chess in an hour when he was 6. He knew all the rules, but it took him another 10 years to become effective in competitions.

Knowing C syntax is simple.  Becoming truly effective at it is another matter.  Ironically, the simplicity of the syntax makes it complex to read and write.  Compared to other languages, you have to write lots to do a little.

On the plus side, its difficulty drives away the pseudo-programmers whose entry into the field was learning VB in 21 days.  If you become good at C, you will be very marketable to the companies that use it.  It will take years to get there, as it is not just about the syntax -- it is also about machine architecture and dealing with the pointer-to-pointer messes and spaghetti that other C programmers (often proudly!) create.

NoName
Tuesday, March 23, 2004

*  Recent Topics

*  Fog Creek Home