Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1074073 Posts in 44032 Topics- by 36037 Members - Latest Member: AlucardX60

December 21, 2014, 10:21:23 PM
TIGSource ForumsDeveloperTechnical (Moderators: Glaiel-Gamer, ThemsAllTook)C-based languages - Where should I start?
Pages: [1] 2
Print
Author Topic: C-based languages - Where should I start?  (Read 1686 times)
pxl
Level 0
**


@pixelforge


View Profile Email
« on: February 20, 2013, 11:02:18 AM »

Relatively new to programming, however I want to learn a bit about C-based languages, could anyone tell me where I should start? Panda I just want your opinions on which are relatively easier to get a grasp of for beginners? I hope this question isn't too vague and causes any anger towards me  Giggle
Logged

Evan Balster
Level 10
*****


I live in this head.


View Profile WWW Email
« Reply #1 on: February 20, 2013, 11:18:07 AM »

Start using C++, but learn its programming features one by one.  A lot of people recommend C because it's simpler -- I recommend starting off with C++ but doing mostly C-like things; C++ is essentially C with a lot more features and automation.

Essentially there are a ton of different programming paradigms and features and stuff in the C++ language and it tends to create a lot of confusion because of how many different ways there are to approach any given problem.  So don't worry about virtuals, or templates, or all the other fancy crazy stuff until you've got your head around the super basics:  Pointers, math, basic classes, and maybe a graphics API such as the opensource libraries SDL and SFML.
Logged

Creativity births expression.  Curiosity births exploration.
Our work is as soil to these seeds; our art is what grows from them...


Wreath, SoundSelf, Infinite Blank, Cave Story+, <plaid/audio>
impulse9
Level 5
*****



View Profile WWW
« Reply #2 on: February 20, 2013, 11:31:27 AM »

My suggestion is to start with C because it's a solid foundation for further learning. My personal opinion is that learning C++ is much easier when you are already familiar with C, and the other way around is, well, harder. In C you need to rely on low level constructs and this forces you to learn about computer architecture and operating systems. It's much easier to get carried away in C++ because much of what you're going to use is abstracted away from you, so you don't ever get to the bottom of it, you just see the effects. In C you get to the bottom of things and this will make you understand what is actually going on in the abstractions you use.

Also learning OOP is considerably easier when you are already well-familiar with the procedural realm.

Just my two cents. Good luck on your programming ventures. Smiley
Logged

rivon
Level 10
*****



View Profile
« Reply #3 on: February 20, 2013, 12:46:34 PM »

C++ to C is IMHO easier (I've gone the reverse route). Even easier would be to start with Java or C#, though C++ is better for games.
Logged
HernanZh
Level 2
**



View Profile WWW Email
« Reply #4 on: February 20, 2013, 02:08:13 PM »

Start with C, then move up to C++. C is a relatively small language.
Logged

ham and brie
Level 3
***



View Profile Email
« Reply #5 on: February 20, 2013, 03:05:05 PM »

Start with C++, don't get tainted like many programmers doing things in the C way that can be done easier in C++.
Logged
BleakProspects
Level 4
****



View Profile WWW Email
« Reply #6 on: February 20, 2013, 03:14:45 PM »

Start with C++, don't get tainted like many programmers doing things in the C way that can be done easier in C++.

This I can agree with. To be fair, you can become "tainted" either way, but in my opinion it's better to be "tainted" by C++ than by C. Why? Because C is nearly a subset of C++, and if you figure out some crazy way to do something in C, and later have to do it again in C++, you're going to do it the "C way;" while if you learn some crazy way to do it in C++, the odds are that way is just going to be impossible/extremely difficult in C. So you will be forced to learn the "C way" anyway.

Though, it is possible to be tainted by C++ in such a way that you end up writing all your C code with pseudo object-orientation and a proliferation of structs. I just think this is better than writing C-like code in C++ (especially using POSIX stuff instead of STL and other such no-nos).

I also think it's simply not true that C is an "easier" language to learn than C++. In C, you will be very proud of writing an incomprehensible program full of bit twiddling and pointer arithmetic that would have been accomplished in 10 minutes using an STL container and iterators.
Logged

powly
Level 3
***



View Profile WWW
« Reply #7 on: February 20, 2013, 03:20:14 PM »

C++ is a superset of C, making C not nearly, but exactly a subset of C++ Smiley

I'm not going to comment on the language of choice but rather emphasize that persistence is key. Whichever you pick, you really need to write actual working code to learn it properly. The choice (especially when the two are so similar) matters very little compared to this.
Logged
BleakProspects
Level 4
****



View Profile WWW Email
« Reply #8 on: February 20, 2013, 03:27:49 PM »

C++ is a superset of C, making C not nearly, but exactly a subset of C++ Smiley

I couldn't remember whether it was a complete superset, or just "mostly," I guess that was Objective C which is not strictly a superset.
Logged

impulse9
Level 5
*****



View Profile WWW
« Reply #9 on: February 20, 2013, 03:49:14 PM »

C is not a subset of C++, they are different languages.
Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW Email
« Reply #10 on: February 20, 2013, 06:09:21 PM »

C++ is a superset of C, making C not nearly, but exactly a subset of C++ Smiley

I couldn't remember whether it was a complete superset, or just "mostly," I guess that was Objective C which is not strictly a superset.

Objective-C is a superset of C.  C++ is not, nor has it ever been, a superset of C.
Logged

Franchise - The restaurant wars begin!

What would John Carmack do?
eigenbom
Level 10
*****



View Profile WWW
« Reply #11 on: February 20, 2013, 06:55:33 PM »

Relatively new to programming, however I want to learn a bit about C-based languages, could anyone tell me where I should start? Panda I just want your opinions on which are relatively easier to get a grasp of for beginners? I hope this question isn't too vague and causes any anger towards me  Giggle

Jump straight in. download visual c++ express or xcode, install SFML, and start hacking interactive programs in c++. have fun!
Logged

Xienen
Level 3
***


Greater Good Games


View Profile WWW
« Reply #12 on: February 20, 2013, 09:01:39 PM »

Start with C++, don't get tainted like many programmers doing things in the C way that can be done easier in C++.

This I can agree with. To be fair, you can become "tainted" either way, but in my opinion it's better to be "tainted" by C++ than by C. Why? Because C is nearly a subset of C++, and if you figure out some crazy way to do something in C, and later have to do it again in C++, you're going to do it the "C way;" while if you learn some crazy way to do it in C++, the odds are that way is just going to be impossible/extremely difficult in C. So you will be forced to learn the "C way" anyway.

Though, it is possible to be tainted by C++ in such a way that you end up writing all your C code with pseudo object-orientation and a proliferation of structs. I just think this is better than writing C-like code in C++ (especially using POSIX stuff instead of STL and other such no-nos).

I also think it's simply not true that C is an "easier" language to learn than C++. In C, you will be very proud of writing an incomprehensible program full of bit twiddling and pointer arithmetic that would have been accomplished in 10 minutes using an STL container and iterators.

I would have suggested learning C first until I read this.  Having gone from C++ to C myself, this actually makes a lot of sense to me. As eigenbom (kinda) said, grab a copy of Visual Studio(Windows) or XCode(Mac) and start throwing some stuff together: http://www.cplusplus.com/doc/tutorial/
Logged

Muz
Level 10
*****



View Profile Email
« Reply #13 on: February 20, 2013, 09:07:40 PM »

Try the wibit.net tutorials. It's good enough for learning professional level programming from scratch. Plus they're fun to listen and follow.
http://www.wibit.net/

They recommend C -> C++ -> Objective-C -> Java/C# for a good reason.

You can of course, just go straight to C++ if you like.

I prefer the bottom up approach. It's easier to go top down, but you're less likely to appreciate why some things work that way. It's kinda annoying to 'lose' features like object oriented stuff as you go down. Whereas if you go the other way, it's harder, but more fun as you'll be 'unlocking' new features.

If you're serious about being a programmer, learning low level stuff like C's memory management stuff is important (and a common interview question). If you want quick gratification, do Java/C#.
Logged
xgalaxy
Level 0
***



View Profile
« Reply #14 on: February 21, 2013, 01:17:02 AM »

If you are using MS VS Express, or any VS really, the point is kind of moot anyway, as it doesn't contain a C compiler (at least not one that isn't 30 years out of date and standards compliant).

So you are learning C++ regardless really.

And I know everyone learns differently and all but saying C++ is easier to learn than C is like saying Calculus is easier to learn than Algebra.
Logged
koiwai
Level 1
*



View Profile
« Reply #15 on: February 21, 2013, 03:29:23 AM »

Relatively new to programming, however I want to learn a bit about C-based languages, could anyone tell me where I should start? Panda I just want your opinions on which are relatively easier to get a grasp of for beginners? I hope this question isn't too vague and causes any anger towards me  Giggle

I would suggest C for an inexperienced programmer. Simply because C++ is overwhelmingly huge, and you will never learn it in full. So, imo, you should first get a solid understanding of what a programming language is supposed to do by learning C, and only then try C++. That said, C++ is more convenient language.
Logged

InfiniteStateMachine
Level 10
*****



View Profile WWW Email
« Reply #16 on: February 21, 2013, 03:58:47 AM »

good points on all sides. I think the most important thing is to just start learning. Don't stand on the diving board forever considering the best way to hit the water.

C or C++ are both relatively good choices. Try to do exercises that yield constant rewards to avoid burnout. That essentially means keeping your goals small at the start.
Logged

Klaim
Level 10
*****



View Profile WWW
« Reply #17 on: February 21, 2013, 07:49:48 AM »

The main problem with learning C first is that you have to understand pointers and const char arrays to do something useful, while in C++ you have to avoid them as much as possible.

Which is why I would recommend learning to consider C and C++ widely different languages. It's harder than it looks like to ignore your C background when working with C,  but you get it by working with widely different languages.
Logged

http://www.klaimsden.net | Game : NetRush | Digital Story-Telling Technologies : Art Of Sequence
Gregg Williams
Level 10
*****


Retromite code daemon


View Profile WWW Email
« Reply #18 on: February 21, 2013, 02:53:40 PM »

The main problem with learning C first is that you have to understand pointers and const char arrays to do something useful, while in C++ you have to avoid them as much as possible.
I don't recall C++ needing you to avoid pointers and char arrays.  Many of us never used the STL, and still don't.
Logged

BleakProspects
Level 4
****



View Profile WWW Email
« Reply #19 on: February 21, 2013, 03:15:03 PM »

The main problem with learning C first is that you have to understand pointers and const char arrays to do something useful, while in C++ you have to avoid them as much as possible.
I don't recall C++ needing you to avoid pointers and char arrays.  Many of us never used the STL, and still don't.

Well, I guess each shop is different. In the lab I work at, we have an enormous C++ codebase filled with horrible coding practices from different academics over the decades. Some of the worst bits of code are those coded by "C people" who are either ignorant of the STL, or think the "C Way" is "more elegant". I'm constantly having to write horrible boilerplate code to interface the non-STL-non-boost C-like code with the newer boostified-STL code. One guy even wrote his own sorting routine that was a bastardized version of merge sort which only worked on his hand-coded linked lists. His code even had #define and printf all over the place for debugging. Down the line, we wanted to add features to his part of the codebase, and were horrified to see this little gem, and weren't sure how to extend it. We ended up gutting the whole thing and replacing it with a single call to std::sort over an STL container. It was both faster and easier to maintain.

So I guess I'm biased toward that kind of coding style -- but of course all of this could have been prevented with actual code reviews and code standards; but that's how things work in academia I suppose.
Logged

Pages: [1] 2
Print
Jump to:  

Theme orange-lt created by panic