Should I learn C?
I forecasted for next quarter and I decided to take a class on C (the programming language). It's by the same professor who is teaching my unix class so I’ll be used to his teaching style. But I’m having second thoughts. I want to take the intro to PHP class. I have gotten away without learning PHP for quite a while, but I think it is essential in my future to really learn it well. Do you think it would be a waste of a quarter to take C? I don’t think it’s very popular in the web development arena. But is it a good base to start learning real programming? Or should I just skip it and take PHP instead?
Next week we are going to start shell scripting in unix, is that a good enough base to start programming?
Abhishek Reddy posted this at 05:09 — 16th November 2006.
He has: 3,348 posts
Joined: Jul 2001
C is neither fun nor pretty. But it is useful, largely due to the profusion of operating systems in the *nix tradition. It's worth learning C solely to understand how its memory management and pointers work. This will help you as you learn other languages, because most of what you'll use is implemented on a C/*nix-inspired stack -- even Microsoft Windows. (For example, you might understand one of the reasons why PHP sucks. )
I don't think PHP can teach you anything uniquely that's good or novel. It's yet another dull language with subpar features, that just happens to have found a niche in web programming due to fortuitous timing. You can put PHP to good use, of course, if you already know how to program a web application in a dynamic language.
I'm not sure PHP will be all that important to your future. Increasingly, you will have the option -- if not compulsion -- of using any of Java, C#, Python, Ruby, Perl, maybe even Lisp or Javascript for your web backend, and of course an ECMAscript client-side. Any of those languages would be better than PHP to start with now.
So I'd go with the C course, given those two choices.
Busy posted this at 10:04 — 16th November 2006.
He has: 6,151 posts
Joined: May 2001
I did a C\C++ course, learnt how to crash a computer pretty well
As Abhi said, C is neither fun nor pretty, you need a complier to compile before you run the scripts where as PHP can run off the page (apache does the compiling).
C is very library based, you use a lot of them but don't need to know what, where or why. PHP is all on hand, functions as well but you don't need to include libary files to run certain functions.
ALthough PHP is based on C, there is no real connection, if anything learning PHP for me was like learning another language based on a whole different arrangment.
End of the day a lot of it lies on what you want to do for a living, webdesign/development or programming. I'd just go with PHP if your just doing web stuff, but would go Java, Perl etc for programming
JeevesBond posted this at 12:18 — 16th November 2006.
He has: 3,956 posts
Joined: Jun 2002
Why not skip the wait, you could explain it to us now Abhi (and I do mean that).
C is still a very widely-used language. TIOBE Programming Community Index (for what it's worth) puts it at the second most popular language by quite a margin. The clear leader is Java though. Ruby has been surging up over the past few months. While my favourite language of the moment: Haskell, is languishing in #46th.
Ouch, that's a harsh surmisal! What are your reasons for this slamming? Are you talking about all the disparate functions? Lack of object orientation?
I agree with Abhi overall, C will give you a firm foundation to learn other languages. Plus you will have the opportunity to learn things such as pointers and memory management (yummy, malloc() action), which aren't in PHP. Even though most languages handle 'garbage collection' automatically these days, it's better to have a good working knowledge of these concepts. They will still affect most programming you do. Even Visual Basic developers such as myself had a bunch of techniques to make the VB runtimes use memory more efficiently.
a Padded Cell our articles site!
Greg K posted this at 14:56 — 16th November 2006.
He has: 2,145 posts
Joined: Nov 2003
I agree with Jeeves, especially thinking back to your reactions in this thread
If the class was taught by someone who knows the subject really well and can teach really well, then I would recommend the class in C. PHP is easy enough to learn from just resources on the net.
If you understand the structure of C, then IMO it will mae it easier and/or improve your desing in other languages (including php).
-Greg
FrankR posted this at 19:47 — 16th November 2006.
He has: 45 posts
Joined: Oct 2006
In my opinion, the C programming language is a great place to learn a procedural language and a bit about how computers really work. It is rather close to the bare metal - meaning that when compiler optimizations are turned off, your code is translated to assembly code in a straightforward manner. The Kernighan and Ritchie classic, entitled "The C Programming Language (2nd Edition)," has long been considered a must-have for the library collection of every discerning programmer.
I definately think that you should go for the C class. I believe that what you learn will be undoubtably valuable. You can pick up PHP at any time. Once you learn how to actually program, you can pick up any language and work with it. PHP is a great thing to learn on your own and for work, but C will serve you well whereever you go and whatever you do.
I hope this helps
Cheers!
Frank
Author of SQL Converter for Excel, which is an Excel add-in for converting data to MySQL.
teammatt3 posted this at 20:04 — 16th November 2006.
He has: 2,102 posts
Joined: Sep 2003
Looks like you guys think I should take C. I'll stick to it.
Yeah you're right, I just need the patience to sit down and go through them :snooze: .
JeevesBond posted this at 20:29 — 16th November 2006.
He has: 3,956 posts
Joined: Jun 2002
Indeed! Probably the best way to learn is to get the basics down, then build a simple project. You'll read what you need to learn then, but in a way that isn't mind-numbingly boring!
Greg, that link doesn't work. I really want to know what you're linking to!
I have heard from a variety of sources that PHP is a limited and flawed language, am really interested in why people think this. I've used PHP quite extensively, but have yet to hit the boundaries of it's abilities.
a Padded Cell our articles site!
andy206uk posted this at 01:32 — 17th November 2006.
He has: 1,758 posts
Joined: Jul 2002
Doesn't PHP use a C style syntax anyway? If it does (and I'm sure it does) you'll find learning PHP much easier when you know the basics...
Greg K posted this at 02:39 — 17th November 2006.
He has: 2,145 posts
Joined: Nov 2003
Jeeves, fixed the link in my post. My main thought was back to his first reply to the thread.
-Greg
Abhishek Reddy posted this at 07:02 — 17th November 2006.
He has: 3,348 posts
Joined: Jul 2001
Greg and Jeeves, this thread was not about why PHP sucks. I didn't want to discuss that as it would hijack the main discussion. Greg, I am also not selling anything.
However, as Matt has his answer, and you asked for it, I'll jump into a critique of PHP in a moment. Before that I should get a few things straight.
Every language has its faults, and PHP is no different. My criticism of PHP is threefold: it has a set of flaws, it has few redeeming features, and other languages are better.
PHP is Turing-complete, of course, and isn't a tarpit. It has many relatively useful features above that, so as I said, it can be put to good use. Though the language is subpar, applications written with PHP need not be. Indeed, there are several PHP-based applications I really like. Therefore, the scope of this critique is limited to PHP only, and doesn't reflect on the code and programmers that live on it.
"PHP", like most language names, is overloaded. It refers to the language (grammar, types, constructs, architecture), the environment (functions, library, garbage collector), and the implementation (Apache module, binary, settings, conf files etc). Each of these has its own problems.
Why PHP the language sucks:
Why PHP the environment sucks:
Why PHP the implementation sucks:
Why is PHP so bad? I think the cause lies in its history. The language grew out of a small set of library functions for web programming. Only it didn't stop growing; anything that was remotely useful was piled into the core, without concern for orthogonality, consistency, compatibility, or any other design considerations. It's a classic case of a domain-specific language mutating into a general-purpose language due to external forces.
Why is PHP so popular if it's so bad? Popularity doesn't suggest good quality, unfortunately. PHP got lucky, being supported by the right platform (Apache) at the right time. mod_php was much faster and simpler than CGI at a time when FastCGI and other alternatives weren't popular.
Why won't PHP be so popular in the future? PHP4 isn't just rough around the edges, it's fundamentally broken, as has been the development philosophy of the project. PHP5 is an improvement, but it is still playing catch-up to other languages. It's like a new language because of the incompatibilities and doesn't enjoy a great deal of market share. Competitors like Ruby, Python and Java have been making inroads already. I expect with .Net 3.0 C#, or other languages on that platform, will also grow as web frameworks and service APIs mature. FastCGI provides a level playing ground, too, nullifying mod_php's advantage. It will be interesting to see how PHP6 turns out, but I can't imagine it saving PHP from itself.
Is PHP good for anything? Yes. Despite its flaws I find that it's easy for a novice to learn enough of it to do useful things quickly. Experienced developers can produce dynamic sites rapidly. And it is widely supported, particularly on shared hosts.
However, I suggested not taking a class on it because PHP tends to encourage bad programming habits (especially for novices) and lacks relevant interesting features, in comparison with C, at least.
[Note: forgive me if the above is not 100% accurate. The main source of error might be the differences between the incompatible versions of PHP. I don't know all the changes very well; I may not be aware of a problem that's been fixed in PHP5. However, my points should still stand as PHP4 remains very popular.]
For more:
http://www.bitstorm.org/edwin/en/php/
http://spyced.blogspot.com/2005/06/why-php-sucks.html
http://www.ukuug.org/events/linux2002/papers/html/php/index.html
http://maurus.net/work/php-sucks/
http://tnx.nl/php
http://keithdevens.com/weblog/archive/2003/Aug/13/HATE-PHP
teammatt3 posted this at 19:25 — 29th July 2007.
He has: 2,102 posts
Joined: Sep 2003
Just a (really late) follow up: I was very glad I took the C class. I learned a lot about program efficiency (that was pretty interesting), memory management, pointers, numbers, and just programming in general. After taking that class, I picked up PHP pretty easily and while I'm still a beginner, I think that class really made a difference in how I go about programming.
I can't say all C classes will be great, but mine certainly was (though, it was very hard and time consuming; we started with 42 people and ended the quarter with 18)
kb posted this at 01:52 — 30th July 2007.
He has: 1,380 posts
Joined: Feb 2002
Having never mentioned anything, I think I'll put my two cents in here, albeit as a post-script.
C was the first language I had to learn in a classroom setting, and it wasn't that bad.
I've always looked down on over-developed languages like C# and Java, because unless you're going to do some very complicated things (like games), there really is no need. Why should you be 4 levels of abstraction away from the machine? Why not keep it at 2?
C is an easy language. I don't know what some of you guys are talking about, but in principle it really doesn't differ that much from other languages, besides the level of abstraction and a few things. Yes, pointers suck. Yes, memory management is a hassle. Yes, trying to figure out that seg fault is Hell.
But all in all, it teaches you alot. You learn why people choose languages like Java over C... because they're lazy and scared. You rejoice that languages like PHP don't have actual pointers, just things that are only slightly similar, and in concept only.
The best part, though, is realizing that once you learn a low-level language like C... you can pick any language of similar level, or higher, up very very quickly.
elena29 posted this at 08:39 — 31st July 2007.
They have: 24 posts
Joined: Jul 2007
C is a good programming language, especially for Unix environments and low level work.
There are many other evolved programming languages, even if C will always remain the most popular, especially when it comes down to hardware programming. I have learned myself C and X86ASM over time and I must say that working with these programming languages and gaining experience in the field has proven useful later on, especially when going for a job application at a medium size local company.
I encourage you to learn C but you must be prepared to face a programming language that is not that fun, even if aplicable in many environments and offering quite a lot of advantages over most others.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.