Kuro5hin.org: technology and culture, from the trenches
create account | help/FAQ | contact | links | search | IRC | site news
[ Everything | Diaries | Technology | Science | Culture | Politics | Media | News | Internet | Op-Ed | Fiction | Meta | MLP ]
We need your support: buy an ad | premium membership

CPAN, but why not CCAN?

By jlr in Technology
Fri Jun 08, 2001 at 09:39:14 AM EST
Tags: Internet (all tags)

I have been following discussions under the Review: Writing Solid Code article, most of which has focused on C/C++ programming technique ... a black art to some.

I'm sure most are familiar with CPAN: the Comprehensive PERL Archive Network. Since I first explored the archive I've wondered why a similar collection doesn't exist for C/C++. Wouldn't a CCAN (Comprehensive C/C++ Archive Network) produce better C/C++ programmers and be beneficial to the community as a whole?

If someone wants to learn PERL we can hand them a copy of the Camel or Llama books and direct them to CPAN. Certainly not the end of their journey, but a damn good start.

Where could one go for similar information on C/C++ (collectively C hereafter). Definitely K&R's The C Programming Language as a primer, but what about Internet resources? Why hasn't a CPAN-type website for C sprung up yet? Is C too enigmatic? Is the "execution" of the language too subtle? It's almost chicken-and-egg-like: you need to know (at least some of) the language before really knowing what information to seek.

Couldn't such a site go a long way to produce better programmers? Given the number of vital systems/applications based on the language, isn't it of utmost importance for C programmers to not simply be "native speakers" but "poets" (comparison to art is only half-intentional ;^))? Every time I read programming-type discussion on K5, Advogato, etc. I become a better programmer. Imagine the effect a CCAN could have.

How do most people learn C? School? Books? Peers? In the "Review: Writing Solid Code" article, someone suggested reading existing code as a method of learning. I agree. I do it all the time. It makes me a better programmer. However, it has the effect of subconsciously passing the author's (potentially) bad habits to junior developers. So should we only read well-formed code? Certainly not.

Perhaps here a CCAN could help. The archive could contain pointers to "good reads" in source code: projects that employ good design and execution. Maybe even a moderation-type system similar to K5 or /., but that might be going too far! :^) Either way, the information is somewhere on the Internet, just not consolidated, presented, and blatantly indexed in such a nice package like CPAN.

Is a CCAN possible? Does one already exist?


Voxel dot net
o Managed Hosting
o VoxCAST Content Delivery
o Raw Infrastructure


Related Links
o Review: Writing Solid Code
o Camel
o Llama
o Also by jlr

Display: Sort:
CPAN, but why not CCAN? | 36 comments (36 topical, editorial, 0 hidden)
It's still available (none / 0) (#1)
by John Milton on Fri Jun 08, 2001 at 01:31:53 AM EST

You better go register the domain real quick. Cpan.org is still there. You wouldn't want streetlawyer to steal it.

"When we consider that woman are treated as property, it is degrading to women that we should Treat our children as property to be disposed of as we see fit." -Elizabeth Cady Stanton

perl modules/C libraries (4.40 / 5) (#2)
by enterfornone on Fri Jun 08, 2001 at 01:37:19 AM EST

CPAN isn't just a learning tool. It's an almost canonical archive of every Perl module in existance. If you need to do something general in Perl chances are someone has a module to do it, and you will probably find it on CPAN.

In the C world so much time is spent duplicating existing libraries because people don't realise some obscure library exists. Were there a central repository for C this would be far less of an issue.

That is where the real value of CCAN would lie.

efn 26/m/syd
Will sponsor new accounts for porn.
CPAN vs SWAG (4.33 / 6) (#3)
by rwg on Fri Jun 08, 2001 at 01:54:26 AM EST

C/C++ doesn't need a CPAN-alike, it needs a SWAG-alike.

CPAN is a comprehensive repository of all modules Perl. SWAG was a collection of code fragments designed to teach others how to write code that did something useful in Pascal. It even had a slick DOS-based "reader" for viewing the code samples.

Ah, the memories...

SWAG (none / 0) (#33)
by tarpan on Fri Jun 15, 2001 at 07:50:15 PM EST

Yeah... swag was sweet.. Countless of small snippets of code i've stol.. ehh.. borrowed from swag.

If you wondered how you would do something in pascal you went to swag and looked and found it :)

[ Parent ]
ack! (3.00 / 2) (#4)
by Estanislao Martínez on Fri Jun 08, 2001 at 01:56:54 AM EST

If someone wants to learn PERL we can hand them a copy of the Camel or Llama books and direct them to CPAN.

Oh, no, no, no. You certainly don't hand them the Camel.


And K&R? (4.00 / 1) (#5)
by elenchos on Fri Jun 08, 2001 at 02:04:40 AM EST

Using that as a "primer" for C/C++ sounds like a somewhat unique approach to me. Better than Stroustrup, I guess. But then reading K5 and /. hasn't made me a better programmer at all, just a better flamewarrior and troll. So perhaps I'm unqualified to comment...

The Brain, within its Groove
Runs evenly -- and true --
But let a Splinter swerve --
'Twere easier for You --
--Emily Dickinson, #556
[ Parent ]

K&R (none / 0) (#6)
by enterfornone on Fri Jun 08, 2001 at 02:14:09 AM EST

I've seen lots of C++ that looks like the author has used K&R as a primer.

efn 26/m/syd
Will sponsor new accounts for porn.
[ Parent ]
I'm confused. (none / 0) (#8)
by elenchos on Fri Jun 08, 2001 at 02:39:34 AM EST

A "primer" was originally a prayer book, or a reader for children. From that it came to mean a book of "first principles." The idea is that it is the foundation book, the first one you read. So while K&R, or Stroustrup (or Knuth for that matter) contain first principles, they are not really the thing for newbies to start out with. Unless you're trying to weed people out.

But you referred to books in which "the author has used K&R as a primer." Do you mean the author of an introductory text used K&R as a reference or source book in writing a different book for newbies? That would make sense, but I've never heard "primer" used in that sense.

In either case, I'm still left wondering what this article is trying to say.

The Brain, within its Groove
Runs evenly -- and true --
But let a Splinter swerve --
'Twere easier for You --
--Emily Dickinson, #556
[ Parent ]

newbie texts (none / 0) (#17)
by jlr on Fri Jun 08, 2001 at 12:40:57 PM EST

they are not really the thing for newbies to start out with

To be honest, I'm not sure what I would start newbies out with -- especially C/C++ newbies. Programming is much more than just the acquisition of a language. Just like speaking is not soley about the use of a natural language. Programmers need to have "thoughts" they wish to express before any language will be of use to them. The ideal newbie text would do both.

Perhaps CCAN could serve both purposes: a source for learning materials and a free-market of ideas.

I believe the process of educating programmers has changed since the time C was released (obviously). Around that period I would imagine K&R served both purposes, as would-be programmers were already technical people: mathematicians, engineers, etc. They could be expected to learn from a higher level text.

Today newbie programmers set out to become programmers, with little or no prior technical experience (this is not a flame towards new programmers). Therefore introductory texts are required to take a step back ... we need introductory-introductory texts. :^)

But you referred to books in which "the author has used K&R as a primer." Do you mean the author of an introductory text used K&R

I think he means C++ code that looks a lot like C, as influenced by K&R.

[ Parent ]
Thank you god (none / 0) (#24)
by Luke Francl on Sun Jun 10, 2001 at 03:35:56 PM EST

Someone who agrees with me, finally. I think the Camel book is horrible, for all the reasons you outline in your diary. Everytime I read one of those "humorous" footnotes, I want to smack the authors. The authors trip over themselves countless times trying to make the text "clever" (and from what I know of Tom Christiansen, this does not suprise me). It's a decent reference if you already know Perl! It's worthless as a learning tool. And for the most part, the Llama book is totally worthless if you're just trying to get something done, because it is too basic.

My criticism Programming Perl book is here.

P.S.: If you are still holding off on Mastering Regular Expressions, get it. It's a very good book, and while the examples are in Perl, they're well-explained and mostly-applicatble to other programming languages (as most scripting languages support Perl5 regular expressions).

[ Parent ]

Camel good? (none / 0) (#31)
by wfaulk on Tue Jun 12, 2001 at 12:35:51 PM EST

While I would have agreed with you 100% on any of the previous versions of the Camel book, the new version is vastly superior in many respects. They still openly contradict themselves, but there is much, much, more tutorial-like information in addition to the manual that was pretty much the only part of previous versions. It is a greatly improved book.

[ Parent ]
I'll have to check it out (none / 0) (#34)
by Luke Francl on Tue Jun 19, 2001 at 01:14:35 AM EST

Cool...I'll have to check it out. Too bad I already own the second edition...

[ Parent ]
Tsk, tsk (none / 0) (#35)
by RadiantMatrix on Wed Jul 04, 2001 at 01:32:57 PM EST

Firstly, I learned Perl from the Camel book. Second, I can identify with your annoyance at the authors' attempts to be "cute", but to each thier own.

As far as openly contradicting themselves: Perl is like that. Perl was designed to be, and has evolved precicely like, a spoken language. That brings many advantages, but it also comes with all the inefficiencies that natural languages have.

IMO, Perl is easily classified like any natural language: it is extremely useful and expressive, but you have to take the time to learn it thouroughly.

never put off until tomorrow what can be done the day after.
Express Yourself

[ Parent ]

Please learn more about what you are posting about (3.50 / 12) (#7)
by Carnage4Life on Fri Jun 08, 2001 at 02:22:22 AM EST

What are you talking about? CPAN is an archive of Perl modules (a good one) which is similar to C++ Boost which is an online repository of C++ libraries.

As for good books to learn C++ from there are the C++ Primer, Essential C++, The C++ Standard Library : A Tutorial and Reference, and The C++ Programming Language Special Edition.

no way (4.00 / 3) (#15)
by Ender Ryan on Fri Jun 08, 2001 at 11:18:32 AM EST

Boost.org isn't even close to the type of resource that CPAN is. THAT is what the author was referring to, the immense size and usefullness of CPAN that is just incredible.

If the author TRULY didn't know what he was talking about, then please, by all means point out a C resource that is as massive and useful as CPAN.

Please? I could really use one ; )

Exposing vast conspiracies! Experts at everything even outside our expertise! Liberators of the world from the oppression of the evil USian Empire!

We are Kuro5hin!

[ Parent ]

Remember FIDOnet? (none / 0) (#9)
by Inoshiro on Fri Jun 08, 2001 at 03:23:06 AM EST

I was 1:140/137 for a year or so (1996). One of the echoes I read (but was seldom able to follow), was the International C echo. At the time I was still new to such concepts as endianness :)

Every year, the main moderator of the echo would produce an archive of all the educational C fragments that had been posted. This was called the C Snippets (there was also an ASM snippets collection, and 'SWAG' for the Pascal weenies), and it still exists today -- thanks to Bob Stout :)

[ イノシロ ]
SWAG was invaluable to me. (none / 0) (#26)
by Requiem on Sun Jun 10, 2001 at 09:40:05 PM EST

As much as C people like to harp on Pascal, it actually wasn't a bad language. I remember at the time, people were telling me, "Screw Pascal, learn C." Well, BASIC was my first language, and I'd hate to think of the damage I'd have done had I gone straight into C. Pointers and pointers to pointers and functions and so forth may be useful if you're used to visualizing that sort of thing, and powerful if you're good enough not to blow your foot off, but I've always found it to be weird and unnecessary in this day and age. Abstraction is a good thing. Garbage collection is a good thing. Manual memory allocation is a bad, bad thing.

I've got FPK-Pascal on an old computer, and write the odd Pascal proglet. If I'm writing something DOS-specific, it's a good language. If not...well...Python with hooks to C libraries is a lot better than pure C.

Pascal was, and always has been, a teaching language. It was the language of choice for a lot of DOS-and-BBS stuff (if it's good enough for LORD, it's good enough for me!), and I found learning it to be incredibly useful. And, oddly enough, all these years later, the syntax is firmly in my mind. I can't say the same for C, which I code in from time to time, or Java, which I haven't used in a year or so.

PS Games Garden Rulz ;)

[ Parent ]
Pascal? (none / 0) (#27)
by greycat on Mon Jun 11, 2001 at 10:10:03 AM EST

As much as C people like to harp on Pascal, it actually wasn't a bad language.

Yeah, who needs to open a file by name, anyway?

(Your pascal compiler may have had the ability to open a file by name. If so, you were using a vendor-specific langauge extension. Hence, all serious Pascal code is non-portable. Therefore the language is doomed.)

[ Parent ]
I agree. But... (none / 0) (#29)
by Requiem on Mon Jun 11, 2001 at 11:21:12 PM EST

Hence, all serious Pascal code is non-portable.

Yeah, but when I refer to Pascal as "not a bad language", I meant as a teaching language. I wouldn't use it to build anything of a lot of significance, but I wouldn't hesitate to recommend it to anyone as a first language.

[ Parent ]

Teaching language (none / 0) (#28)
by jlr on Mon Jun 11, 2001 at 12:10:26 PM EST

I agree. It was a good teaching language. I first learned it in high school. Later, when I started college, Pascal was the language of choice for freshmen programming courses.

Pascal is still used as an "example" language. Many books on compiler design use a Pascal-like langauge to teach parsing and code generation techniques. Even my copy of "Computer Graphics: Principles and Practice" is entirely Pascal (though there is a C version). Also, a lot of pseudo-code has a Pascaly feel.

I must admit that most of this is nostalgia. Pascal is not a good systems programming language (in fact, wasn't it designed as a "teaching" language?), though its influence is still around. I look upon my days of hacking Pyroto Mountain and Genesis BBS fondly! :)

[ Parent ]
You may be interested in... (none / 0) (#36)
by RadiantMatrix on Wed Jul 04, 2001 at 01:39:25 PM EST

Two things might interest you (I am also a bit of a Pascal fan): firstly, if you are fluent with Pascal, Delphi should be an easy move. Secondly, FreePascal is available for Linux, Win32, and DOS (at least) and is a reasonable simulation of Borland's TP compiler.

I still occasionally write system scripts in Pascal.

never put off until tomorrow what can be done the day after.
Express Yourself

[ Parent ]

boost.org (none / 0) (#10)
by your_desired_username on Fri Jun 08, 2001 at 08:51:52 AM EST

And for books, try _Accelerated C++_, by Andrew Koenig ( and I think another author whose name I forget ).

Benevolent Monopoly + Open Source (4.50 / 2) (#11)
by interiot on Fri Jun 08, 2001 at 09:49:31 AM EST

If you look at existing C/C++ code archives, you'll notice two things.

First, the sites are small and scattered relative to CPAN. CPAN dominated the market soon enough that they became the defacto place to store perl modules. And they haven't pulled any shit that would threaten that position.

Second, C/C++ code archives will often have a field that describes compiler compatibility. Perl doesn't need this, partly because the Larry Wall has been a benevolent dictator and hasn't given people reasons to fork the code.

Another reason compiler compatibility need not be mentioned is that the code is open source, so ports to other OS's can use the same parser and interpreter. Also, when perl became popular, instead of rushing to implement their own versions to capitalize on the craze, groups contributed to the original perl code, thereby enhancing the usefulness of CPAN rather than eroding it.

SNIPPETS and boost.org (4.50 / 4) (#12)
by Sunir on Fri Jun 08, 2001 at 10:02:35 AM EST

SNIPPETS was created by Bob Stout, a guru of the International C Echo (C_ECHO) on FidoNet. While SNIPPETS underwent several years of drift as its maintainer got busy and FidoNet went away, it's now coming back strong with a new release.

boost.org was created by members of the C++ standards committee Library Working Group as an effort to continue the work in creating language libraries despite the freeze on development after ratification. Many improvements to the standard library will likely be coming from the collected works on boost.org. boost.org is generally cited as the semi-official source for good smart pointers. Essentially, though, boost is the CPAN of C++.

"Look! You're free! Go, and be free!" and everyone hated it for that. --r

doh! (none / 0) (#13)
by Sunir on Fri Jun 08, 2001 at 10:04:44 AM EST

I messed up the search. Reading over the messages again, I see those links were already posted. Apologies times ten.

"Look! You're free! Go, and be free!" and everyone hated it for that. --r
[ Parent ]

Newsgroup and FAQ (none / 0) (#14)
by pfaffben on Fri Jun 08, 2001 at 10:50:33 AM EST

The best resource for C programmers out there, in my opinion, is the newsgroup `comp.lang.c'. You can find world-class C programmers hanging out there ready to answer any question about C in detail. And then there's the C FAQ, which is the best single document on C programming issues.

Disclaimer: I am a regular on comp.lang.c.

hey Ben (none / 0) (#18)
by mikpos on Fri Jun 08, 2001 at 01:38:09 PM EST

I was going to say the same thing. comp.lang.c is essential for developing good C habits and losing bad ones. Just don't go on there asking about the non-existent language C/C++.

[ Parent ]
Also we need a CJAN! (3.50 / 2) (#16)
by AGTiny on Fri Jun 08, 2001 at 12:00:37 PM EST

One of the big things that scares me about Java (we are about to port tons of Perl to Java), is that there doesn't seem to be a central repository of great libraries out there to use. The big question no one but me seems to be asking is what do we do when we can't find a comparable module/class in Java that did what one of our many CPAN perl modules does easily. Will we have to spend countless weeks writing this stuff ourselves?

The problem with Java seems to be that the community in general does not believe in open-source. Since Sun can keep their code hidden behind closed doors, everyone else feels they can/should as well. So if I wanted to find, say, and FTP client library for Java, it's not as easy as search.cpan.org, find Net::FTP, write 10 lines of code.. I would probably have to reimplement the FTP protocol myself :(

large class library helps (3.00 / 1) (#19)
by Moss Collum on Fri Jun 08, 2001 at 06:25:07 PM EST

To begin with: I agree wholeheartedly. I've been writing Java lately, and I'm sure I've rewritten things that are already out there, if only I could have found them.

That said, the lack of a large community archive of Java code is balanced out somewhat by the substantial standard class library, and by the many additional libraries available from Sun. On the other hand, when I looked just now, I wasn't able to find an FTP client library in there (can java.net.URLConnection handle ftp? I'm not sure.)

Also, it's worth noting that part of the reason for the lack of free sofware for Java is a view held by many in the free software community that, because of Sun's proprietary ways, Java is best avoided altogether.

This is a .sig.
Now there are two of them.
There are two _____.

[ Parent ]
Java and OS (3.00 / 1) (#20)
by lachoy on Fri Jun 08, 2001 at 08:18:56 PM EST

There are lots of people who are into both Java and open source -- and produce the code to show it! Just to name a couple:

The Jakarta Apache project has a number of tools. Most are for web apps, but some (like Ant) are general purpose.

JBoss is a GPL-ed Java 2 Enterprise Edition (J2EE) EJB container and more.

Enhydra is an open source Java application server that includes some nifty XML utilities.

Sourceforge has tons of OS Java projects, and it's a rare day goes by on freshmeat without a handful of them.

The open source Java stuff is definitely out there, but since there's no CJAN you need to poke around for it. IMO, there's no CJAN because there's no vacuum -- Sun is the central authority on Java and while it would be cool if they encouraged open-source libraries, I'm not holding my breath.


M-x auto-bs-mode
[ Parent ]
CJAN possibly in the works (2.00 / 1) (#21)
by donaldp on Fri Jun 08, 2001 at 09:44:28 PM EST


The need for such a service has been identified. Developers at jakarta(.apache.org) have discussed it in detail a few times and a few prototypes have been built but as yet nothing has come of it. Hopefully sometime in the future it will get done

[ Parent ]
Giant Java Tree almost a CJAN (none / 0) (#25)
by markpasc on Sun Jun 10, 2001 at 05:44:12 PM EST

There is Giant Java Tree, which is exactly a CJAN except for one major flaw: if you want an FTP library, you can't look for the Java equivalent of "Net::FTP", since everything's in whatever package the author decided to put it in.

GJT would be a CJAN if someone had the time and energy to move all the FTP libraries to the, for example, org.gjt.net.ftp package (which might involve picking a One True GJT FTP library, or defining a One True GJT FTP library interface that all the provided FTP libraries had to implement).

I have gotten several useful classes from GJT, but it's not as easy as search.cpan.org for "Net::FTP".

[ Parent ]
perl and c++ (2.66 / 3) (#22)
by prostoalex on Sat Jun 09, 2001 at 05:00:20 AM EST

Well, here's my 2 cents on why there is a central archive for Perl and there is none for C++

C++ was developed to be a compiled language and thus closed sourse to allow the independent software vendors ISVs ship their products without the fear that someone would have a look at their code, unless they use disassembly tool. And since shering the code was not encouraged at the beginning, C++ does not have the roots of the open-source movement.

My C++ is different from your C++. Whether you write your code on Linux or Windows box, whether you use Borland or Microsoft compiler, whether you make use of STL or not, whether you have some pre-compiled ISV packages - it all creates a unique environment, and the code that you have might work on your machine, but might give zillions of compile-time errors on mine.

There is never such thing as completeness in C++. With Perl once you get the module you can be quite sure for module to stay the same. C++ and especially C is all about tweaking and optimizing the code, using the refactoring techniques, etc.

Not that it's a bad thing, though, many times I wish I could look into the header file and get the package that another person has written, to use on my machine and in my code.

perl and c++ (1.00 / 1) (#30)
by pjc50 on Tue Jun 12, 2001 at 07:59:12 AM EST

I think you're confused about the early history of C and C++. Early commercial UNIX systems - and many modern ones - came with C source as a necessary and useful part of the product. And C++ would not have got anywhere had stoustroup not given away source to his compiler.

And as for completeness ... C is NOT about tweaking the code or refactoring. Not in any serious software developement, at least. It's about designing your interfaces and memory management, then keeping them the same if at all possible because the cost of changing them is enourmous. Leave optimisation and "tweaking" to the compiler, and focus on the algorithm.

[ Parent ]
.a and .so in ports trees (none / 0) (#23)
by abo on Sat Jun 09, 2001 at 08:33:50 AM EST

If we're talking about large code snippets like (shared) libraries, then a sensible thing to do would probably be to put as many libraries as possible into various ports trees, and make sure the ports are searchable, so that one can find the library, if it exists. And for you rpm fans, essentially the same thing can be done for those.

Actually, come to think of it, SourceForge comes pretty close...

But a different system is needed if you mean smaller code fragments. Then there should probably be some repository for .c/.h file pair. Maybe SourceForge will implement it?
-- Köp BRUX!

Shared libraries for C (none / 0) (#32)
by strlen on Fri Jun 15, 2001 at 10:29:01 AM EST

.. Are not very hard to find, so I doubt there's need for CCAN. Freshmeat, actually already takes care of that purpose. And also majority of open source application will also have several shared libraries to go along with them. Also, if you look at CPAN you may find that many of Perl libraries are just ports of similar C libraries: Perl-MySQL, Perl-Gtk, etc..

[T]he strongest man in the world is he who stands most alone. - Henrik Ibsen.
CPAN, but why not CCAN? | 36 comments (36 topical, 0 editorial, 0 hidden)
Display: Sort:


All trademarks and copyrights on this page are owned by their respective companies. The Rest © 2000 - Present Kuro5hin.org Inc.
See our legalese page for copyright policies. Please also read our Privacy Policy.
Kuro5hin.org is powered by Free Software, including Apache, Perl, and Linux, The Scoop Engine that runs this site is freely available, under the terms of the GPL.
Need some help? Email help@kuro5hin.org.
My heart's the long stairs.

Powered by Scoop create account | help/FAQ | mission | links | search | IRC | YOU choose the stories!