Best variant of C for a beginner?
C
 44%  [ 12 ]
C++
 18%  [ 5 ]
C#
 37%  [ 10 ]
Objective-C
 0%  [ 0 ]
Other (C or not); specify in post
 0%  [ 0 ]
Total Votes : 27

I don't tend to do much programming. A while ago, I began to delve into understanding z80 assembly, but I realized how relatively useless it was for me. If I want to make a program for my calculator, I can often push the limits of and find interesting methods to use with TI-BASIC to achieve my desired goal; I don't use it for many advanced tasks, and my calculator is the only platform for which z80 assembly would serve a use for me. I'd prefer to put my effort into learning a language I would be able to use for more than one device.

Considering what programmers tend to think of Java as a beginning language, I'd rather keep away from it for now. However, I do want to learn a language more tiered toward a larger selection of devices. Obviously, C is quite commonly used, though there are some common variants (C, C++, C# and Objective-C seem to be discussed most often).

I would like to know everybody's opinion as to what variant might be the best to learn, in terms of practicality as well as in terms of ease to learn. Are some variants more tiered toward certain goals (for example, gaming versus calculations)? I would also appreciate it if I could be directed to a tutorial of some sort to help me. If somebody would recommend another language over C, I'd also like to hear the suggestion.
I'm very fond of C#, myself. And I think it's great for beginners. That said, I also think Python is a really good beginners (and all-purpose) language. With something like PyGame, you can get into programming games pretty quickly and easily.
I'm with Merth on this, C# or Python would be the way to go. C being the next best option. And whoever voted for C++, you mad dawg, C++ is terrible, especially for beginners. C# and Obj-C do C-like OO programming much better and cleaner than C++.
Okay, so it seems that C# and Python tend to be the popular ones (I'll assume neither of you voted on the poll due to the mixed opinion, which would essentially bring the votes for C# to 3; even if one of you did vote, it would tie with the other choices). May I ask if there is a specific tutorial for C# that would be recommended for a beginner to OOP?
My first to be learned was C, and it was a choice between C and C++. When I was younger I tried learning C++, but everything just seemed a bit unnecessarily messy about it, so I stopped since I got confused a lot. Learning C a year later wasn't that bad at all, and I even pledged to learn C++ after I got a small foothold in C; I looked at it again, saw mess, and to this day I still have never written a full program in C++ Razz
C is the most straightforward place to start if you want to learn C. Otherwise go for something like Python.
You should start with objective-C with the knowledge that it's very little like C, and it can only get better from there. Very Happy </sarcasm>
C# is definitely the cleanest, easiest, and most easily scalable of your options. I have no experience with python, so I cannot say anything there. C is the simplest of them all, but there are a LOT of standards to choose from, there are no built-in safeguards, and you have to make a lot of your own framework to do anything really big or dynamic (...which is a plus for C, if your intent is to have complete control of literally everything). The benefit of C# is that you will also automatically have a feel (to some extent) for C++ and Java, since it was designed to have the best parts of all such previous languages (and few if any of the worst parts).

Objective-C is mainly only used by Apple, and is more like C with extra mechanisms added in for message passing. You have to declare a lot of extra stuff versus the same thing in Java/C#; but it uses a very different mechanism for OOP anyway (like SmallTalk). I wouldn't recommend Objective-C unless you either had a good reason to use it (Apple), or you really want to learn a "message passing" style language instead of a class-based language (like most of the popular high-level OOP language are).
If you want to learn C-like languages, I absolutely recommend starting with C. Particularly if you've dealt with BASIC or ASM before, I'd imagine you'll find C to be relatively straightforward, and not too have too many gotchas. I find C++ to be powerful, if hard-to-understand, but then again, any sort of OOP is hard to understand if classes and objects are foreign to you. I'd certainly recommend C++ over Java, for instance.
Pick a -d-r-u-g- language that will work with minimal fuss across multiple platforms. This means NOT C# or Objective-C unless you want to muck about with Mono or GNUStep. Since all of these are extensions to C, it makes a lot more sense to start with the basics, and go from there.

[edit]

shkaboinka is correct in that Objective-C implements a purer (SmallTalk) form of OOP; whereas C# is inspired by C++/Java, meaning it manages to bastardize traditional imperative style programming together with most of the key parts of OOP.

I still say you're better off learning C first.
The best language to learn is usually the one you can get help in. What do your friends use?
For what it's worth, these so called "variants" of C really aren't.

C#, for example, is completely unrelated to C/C++. It is not a variant at all, it's an entirely different language and stack. If anything it is a variant of Java - only with all the suck removed.

Similar is true for Obj-C

C++, however, is much more a "variant of C" in that it is more or less a superset. That's why you will only see those two combined into C/C++, but not the other two.

In terms of learnability, C is the worst. It's not a starter language. C++ is better iff you start immediately with the STL (I've seen plenty of books and tutorials ignore the STL, which is just idiotic)

Start with Python to learn the general concepts, definitely.
Kllrnohj wrote:
Similar is true for Obj-C

C++, however, is much more a "variant of C" in that it is more or less a superset. That's why you will only see those two combined into C/C++, but not the other two.

Obj-C is actually a strict superset of C, which is more than can be said for C++ Wink The real reason for the lumped-together naming is that the standard libraries for C++ have actual market share, and have had for almost 30 years. Objective-C was introduced the same year as C++, but has only really been gaining traction for less than a decade. And even though C isn't strictly compatible with C++, the bits of C++ which are different still look like C. The bits of Obj-C which are different look like SmallTalk.

[edit]

Though fun fact, I found out today that Obj-C is set to pass C++ in programmer usage for active development projects this year. Less than 1% behind.
elfprince13 wrote:
Pick a -d-r-u-g- language that will work with minimal fuss across multiple platforms. This means NOT C# or Objective-C unless you want to muck about with Mono or GNUStep.
I really don't think C is something that works with minimal fuss across multiple platforms, in that you generally have to recompile the executable to get it to work for you, which is hardly "minimal fuss"--especially for any non-trivial program (sure, your "hello world" program will compile, but start doing graphics and stuff and you add a whole word of dependencies and it just gets icky. Usually. I'm sure you'll come up with a few examples of where it's super easy or something). With Mono you just get it from the repos (if they're up-to-date, which they're usually not, because Linux sucks), or build it from source (which sucks, but you only have to do it once), and they you're ready to run all sorts of .NET apps (unless they have P/Invokes).
It looks like you have enough to make an informed decision. Anything much more is likely to get a bit political (Kllrnohj tends to think that C++ is the best language in the world, many feel the same way about C#, and a lot of assembly programmers insist that C is the only pure and simple option of these). Here is my summary:

C - Pure and simple, but without anything built-in for OOP. You have total control and little mess to deal with; but you do have to do a lot of it manually (but often more simply) ... probably a good choice if you are coming from BASIC, where you have to make your own structures anyway
C++ - OOP, but with everything exposed (powerful, but messy and unsafe as compared to C#/Java)
Objective-C - A more proper superset of C, but an unusual form of OOP (for most).
C# - Nearly all the power of C++, but with the feel/safety of Java (but much better); but you do need the .Net framework, and it is a different language.
Python - Very powerful and expressive language, and the code is actually a lot simpler than the others. It's interpreted though.
merthsoft wrote:
I really don't think C is something that works with minimal fuss across multiple platforms, in that you generally have to recompile the executable to get it to work for you, which is hardly "minimal fuss"--especially for any non-trivial program (sure, your "hello world" program will compile, but start doing graphics and stuff and you add a whole word of dependencies and it just gets icky. Usually. I'm sure you'll come up with a few examples of where it's super easy or something).

OpenGL, SDL, Qt, all work just fine in C. Especially now that the vast majority of consumer hardware is x86, essentially any application that doesn't need to access hardware drivers directly (or maybe some multithreading libraries) really shouldn't care what OS it's run on, unless you write crappy code or make really stupid design decisions. Since we're talking about teaching someone to program they should be learning to do it right. I can spend a month working on C/C++ for FreeBuild (an application with 35MB of source code) under OS X, and have the Windows build working fine within 30 minutes - and that's just compiler differences, because I use Visual Studio instead of MinGW. If you use GCC across the board you should have even less of a problem. The exception being for code that is split between OpenGL and DirectX because the T3D devs made stupid decisions and DirectX has backwards coordinates.
elfprince13 wrote:
Obj-C is actually a strict superset of C, which is more than can be said for C++ Wink


Yes, but the general usage patterns are very, very different, which is what actually matters. C++ looks like C with "super duper structs" plus some template magic, Obj-C is a radically different beast with the message passing and stuff. Of course, realistically "Obj-C" really means "Obj-C using Apple's APIs", because nobody else touches that ugly trash. Wink

shkaboinka wrote:
Kllrnohj tends to think that C++ is the best language in the world


No I don't, and if you had half a brain you'd see I repeatedly recommend Python.
Kllrnohj wrote:
C++ looks like C with "super duper structs" plus some template magic, Obj-C is a radically different beast with the message passing and stuff.

Which is of course exactly what my post said Wink

Kllrnohj wrote:

No I don't, and if you had half a brain you'd see I repeatedly recommend Python.


Indeed. While I maintain that C is the best C-like language for beginners, Python is definitely better for beginners.
elfprince13 wrote:
merthsoft wrote:
I really don't think C is something that works with minimal fuss across multiple platforms, in that you generally have to recompile the executable to get it to work for you, which is hardly "minimal fuss"--especially for any non-trivial program (sure, your "hello world" program will compile, but start doing graphics and stuff and you add a whole word of dependencies and it just gets icky. Usually. I'm sure you'll come up with a few examples of where it's super easy or something).

I can spend a month working on C/C++ for FreeBuild (an application with 35MB of source code) under OS X, and have the Windows build working fine within 30 minutes - and that's just compiler differences, because I use Visual Studio instead of MinGW.
The fact remains that you have to recompile, which I still don't consider minimal fuss (note that recompiling was indeed my first and main point).

Out of curiosity, if it's that easy, why aren't more games cross-platform? It seems like it would be a no-brainer for companies to make all their games for Mac (I recall when ID was trying to do this, and then gave up because it was too complicated to get their tech to work with Mac and Windows).
I would say that, for an absolute beginner, C# is a great way to introduce C style syntax. It's still rigid and structured in its use of simple syntax such as semicolons at the end of lines, it introduces many high and low level behaviors, and the Microsoft .NET framework has gotten blazing fast in the past few years. I can usually develop an application significantly faster in C# than in C, even though I only have about 5 weeks of C# experience and two years of C. I am finding that I'm almost as fast with C++ now that I'm embracing the STL and other libraries such as std::string. (I still refuse to use ostream though, as it adds too much heft to the application, and I'm perfectly comfortable with, nay I prefer stdio.h)

Speed of development in C# is not only due to the power of even the Visual C# Express IDE, but also due to the very JIT nature of the language. The only issues I've ever encountered that were difficult to debug in C# involved race conditions. Thinking of which, I will admit that C# is great at hiding things. I was using a network library that uses a threaded callback mechanism. (!) It is not immediately apparent that the callback is in a thread, even to my trained eyes, so one day my GUI magically stopped functioning as expected, for I hadn't been implementing thread safety. However; after 3 runs, an exception was thrown saying that a cross-thread manipulation of the form was being made, which massively helped; I wouldn't have gotten such information from GDB.

It could be my experience with C/C++ that makes it hard to be trapped by the language, but I find that C# has very few gotchyas. I was also pleased to find out that my programs would run on Gentoo via mono with no modification to the binary whatsoever. I don't have an X Server on my Gentoo box, so I haven't been able to try windowed applications, but all of my console apps function exactly as they do on windows, even with 3rd party libraries.

I know that I'm advocating for C# here, but my true love is C++. Over the years though, all of the gaps between the two languages have been closing. I hate to admit it, but the only respects of C# that lag behind C++ now are speed of execution (Which is actually growing to be quite marginal) and run-time memory usage. Portability isn't really an issue anymore. You need a runtime for C# on any system you run it on, but it will run as expected without a recompile on any system that mono supports, although the speed of mono is horrible compared to the official runtime. C# totally decimates C++ in terms of binary size, ease of debugging, and compile time.

C# is a great language. It provides nearly all the power of C++, but has the additional power of an intelligent JIT behind it. The need for C/C++ will never falter as long as there are integrated devices with severe hardware constraints, though. The consumer software industry seems to be moving more towards languages like C# though due mainly to the relatively rapid development time. Almost anyones desktop computer can handle the overhead of a JIT compiler now, too. The language is not held to standards either, like C/C++ are, which is a double edged blade. Microsoft can change any feature at will, either crippling the language in some way, or making it faster or more powerful. It can fluctuate with how Microsoft sees it being used, and with how it ought to be used.

tl; dr: C# is actually quite competent, and fairly beginner friendly, and the industry seems to be moving there anyways.

I may edit this post. It was kind of a stream of consciousness and may not be totally coherent.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 3
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement