View Full Version : Transitioning into C?
FlamingHawk
11-06-2006, 02:45 PM
I'm currently learning PHP because a friend recommended that it was a bit easier to learn PHP than C++, so the transition to C++ would be a bit easier after I learned PHP. However, are there any languages similar to C++ rather than PHP (a scripting language) to make learning C++ a bit easier?
And what about C?
Thanks
Reedbeta
11-06-2006, 03:13 PM
Java is rather similiar to C++ in many respects.
C is hardly ever used nowadays, and is more or less a subset of C++ anyway.
FlamingHawk
11-06-2006, 03:19 PM
Would you think that Java is a bit easier to learn than C++ but is really similar?
Reedbeta
11-06-2006, 03:22 PM
Personally, I dislike Java, but I know a lot of people who swear by it. And many university CS programs use Java as their introductory language and teach students C++ much later, so it seems at least they think Java is easier to learn. Personally, I learned Pascal and then C++ before I ever touched Java, so I can't tell you from my own experience if Java would've been easier to learn first or not.
FlamingHawk
11-06-2006, 03:24 PM
Is there a good transition from Pascal to C++ or was it completely diff?
Reedbeta
11-06-2006, 03:27 PM
That's a tough question to answer. Pascal and C++ have quite different syntax, so the keywords, the way the program is typed in, all that has to be relearned. However, all the fundamental concepts of programming like if statements, loops, and so on are shared, as well as some constructs like classes/objects and pointers. Java on the other hand has mostly the same syntax as C++, but it also forces you to be object-oriented; it's not a multi-paradigm language like Pascal or C++, which also allow procedural code. Java has the same concepts and many of the same constructs that appear in C++, but it encourages a somewhat different style of programming than what is most natural in C++.
FlamingHawk
11-06-2006, 04:11 PM
What I mean by transition is essentially the same or really similar syntax, not generally the concepts of programming because those are learned when you learn just about any programming language.
Reedbeta
11-06-2006, 06:27 PM
In that case Java -> C++ is definitely an easier transition than Pascal -> C++. On the other hand, if you know the basic concepts of programming you should be able to pick up just about any imperative/procedural/OO language without any trouble. (A functional language might give you a headache, if you haven't seen them before.)
someone13
11-06-2006, 08:02 PM
Dude, if I were you I'd just start off with just basic C++ then build your way up. Its best to learn your target language first, instead of getting it confused with another language.
To answer your main question though, PHP to C++ isn't a good transition in my opinion. Granted, the syntax is similar however PHP allows you to declare variables without data types, whereas it's a requirement in C++ and most other languages. In my opinion PHP isn't a good programming language to be starting off on.
On the other hand, I agree with Reedbeta. All you wanna do is learn the basic programming concepts, and PHP can help with this. Once you got the basic concepts down, you can learn any programming language no time flat. I still don't recommend starting off with PHP though.
monjardin
11-06-2006, 08:34 PM
I don't think C would be a bad language for learning at all. Most people new to programming don't have a grasp for what to do with the extra features C++ provides anyway. It typically ends up being a C program with iostreams. Also, see Joel Spolsky's article on "The Perils of JavaSchool (http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html)".
C is still used heavily in operating systems and embedded programming. It does appear to have died out in game and desktop application programming (and for very valid reasons as Reedbeta pointed out).
bramz
11-07-2006, 03:12 AM
"What I mean by transition is essentially the same or really similar syntax, not generally the concepts of programming because those are learned when you learn just about any programming language.", FlamingHawk
Beware! There's more about programming concepts that for loops and curly brackets!
Don't judge the similarity of languages solely on syntax. The syntax can be very similar, while it express a totally different idea on some key topics, asking for a totally different way of thinking. Personally, in that respect, I think TurboPascal (*shiver*) is closer to C++ than Java, because in TurboPascal you also deal with value semantics, naked pointers and raw memory. While in Java you have a nice garbage collector and reference semantic for objects. I've seen too many students struggling with exactly that when they move from Java to C++. They often "new" objects where it is trivial to put it on the stack, and more often they forget to clean it up again. Or copying an object and believing original and copy are still one single object. It _looks_ similar, but it's totally different. To be absolutely clear: I DON NOT SUGGEST LEARNING TURBOPASCAL FIRST!
"Most people new to programming don't have a grasp for what to do with the extra features C++ provides anyway. It typically ends up being a C program with iostreams.", monjardin
Funny, (almost) exactly the same thing can be said of (some to many) people moving from C to C++. They don't have a grasp for what to do with the extra features C++ provides anyway. It typically ends up being a C program with classes (couldn't use iostreams in my example, of course ;)). Nevertheless, C is not a bad language, I agree.
Anyway, if you want to learn C++, then start learning C++.
Cheers,
Bramz
SamuraiCrow
11-07-2006, 08:25 PM
Pascal can be converted into C using P2C (http://directory.fsf.org/devel/conversion/p2c.html) but I don't think it supports full Object-Pascal support like FreePascal (http://freepascal.org/).
vBulletin, Copyright ©2000-2010, Jelsoft Enterprises Ltd.