Jump to content

C++ I bought a time machine and want to learn it


Recommended Posts

Hi guys,

 

I thought I would be nice to learn C++ to get a better understanding of programming. Some time ago i just dived into php, but sometimes I think I am missing what's behind it. Does anyone might wanna give me a heads if it's a good thing to learn c++ to get a better understanding of programming or should i go back more and start of with C than C++.

 

All tips are welcome

Link to comment
Share on other sites

I think it's well worth it.  Both languages really highlight what goes on under the hood, especially when it comes to memory management.  There's an epiphany that almost everyone gets when they build their first dynamically linked list.  Seeing the memory allocation/de-allocation at play, pointers doing their thing, what references and addresses actually mean....

 

You'll also see one reason why the idea of type is important.  PHP is a dynamically typed language, but type definitely does exist in the language, even if it's not explicit.  OOP looks at type in a more abstract way, but at least you'll be forced to deal with it from the outset.  You'll start to see why I and everyone else trying to do OOP the right way harps on it.

 

I recommend the two Thinking in C++ books.  They're both fairly big, but do a great job exploring the language in an engaging way.  If you get nothing else out of it, you'll at least see how simple PHP is in comparison.

Link to comment
Share on other sites

Thanks a lot Nightslyr!

 

I definitely have a look at those books. (was planning on buying a kindle for all these E-books) These are the ones right? http://www.mindview.net/Books/TICPP/ThinkingInCPP2e.html

 

I am pretty sure ones i understand C++ developing in php would sometimes make more sense.

Cool now lets start up that Time machine and start learning  ;D

 

Thanks mate!

Link to comment
Share on other sites

  • 2 weeks later...

Can I give my two cents? Learn C++ before going back and learning C; you may develop some bad habits or styles with C that may hinder you from really getting the most out of C++. The book they had me read when I was in school (like 2008ish) was "The C++ Programming Language, Third Edition by Bjarne Stroustrup". Pretty decent read, and a really in depth look at C++, it's features, the standard library etc. Although, it sort of assumes you have a basic understanding of programming concepts (OOP, Modular etc), so just be ready to do some outside research if your working through this title.  Also, http://www.learncpp.com/ , is a decent web page to really just "get started" etc. with programming; but it's not going to take you all the way to finishing real projects.

 

Learn C++, it's fun :D and it never hurts to know another language. Any "programming" language will help you with another, just working with the concepts in general (in any language, environment) will help build you into a better programmer.

 

As far as knowing C++ and PhP don't count on them 100% translating lol...I was sooooo used to working in Strong Static env. that when I started PhP I get my variable's mixed up all the time b/c I'm struggling with that for some reason :\, although it probably will be easier to go into a SS environment vs coming into a PhP like one :\.

 

Good luck with it, if you have any questions as your starting out feel free to message :D

 

Best wishes,

 

~ alice

Link to comment
Share on other sites

I should try relearning C++ sometime this summer.  I used it in college, way back in the day (1998-2000 or so... damn I'm old), but haven't had a chance to play with it since.  It was fun, though.  Getting your first dynamically linked list to work is magical.

Link to comment
Share on other sites

I should try relearning C++ sometime this summer.  I used it in college, way back in the day (1998-2000 or so... damn I'm old), but haven't had a chance to play with it since.  It was fun, though.  Getting your first dynamically linked list to work is magical.

 

My first programming languages were Turbo Pascal, Assembler and COBOL (in that order). After my first encounter with COBOL I pulled out my shotgun (backpack) and pulled the trigger! Then I learned Java and C++ :)

Link to comment
Share on other sites

Hehe, I've heard things about COBOL.

 

I actually started way back in the early 80's, as a child, with BASIC on my Commodore VIC-20.  Nothing special, but it was cool seeing instructions turn into something else on the screen.  I didn't program again until college, mainly because I had more interest in liberal artsy stuff at the time. 

 

I didn't do too well when my classes shifted over (down) to C and we started doing low-level stuff.  Shifting and flipping bits never appealed to me, and I had a hard time 'seeing' how to successfully finish my assignments anyway.  My mind seems to do best with abstract models, and I could never really put bytes, and their constituent bits, into that conceptual framework.

 

My biggest regret is not getting my CS degree.  I'd love to go back and try it again some day, now that I have some real life experience to help me along.

Link to comment
Share on other sites

haha! Machine coding? Totally failed that the first time I took it :P I had to retake both of my assembly language courses, haha, and I was even specializing in computer engineering (hence my requirement to retake these course :P lol...sorta important when dealing with device drivers and OS"s :P). A CS degree is fine, but sometimes they make you learn a whole lot more than you'll ever use since it's sort of a general degree in :computing theory: for the most part; if your already in the industry why not just learn languages, and build a portfolio? Not to mention, college is ridiculously expensive now a days, but if your thinking about going have you considered a university? :(

 

CSSFreakie: I know how you feel, without sounding too strange I've literally wished many times to be able to "plug" in knowledge as they do in the matrix lol :P Anyone can learn anything about computers, it just takes time...lol...wouldn't it be sooo nice if we could skip the 'time' part :P.

Link to comment
Share on other sites

haha! Machine coding? Totally failed that the first time I took it :P I had to retake both of my assembly language courses, haha, and I was even specializing in computer engineering (hence my requirement to retake these course :P lol...sorta important when dealing with device drivers and OS"s :P). A CS degree is fine, but sometimes they make you learn a whole lot more than you'll ever use since it's sort of a general degree in :computing theory: for the most part; if your already in the industry why not just learn languages, and build a portfolio? Not to mention, college is ridiculously expensive now a days, but if your thinking about going have you considered a university? :(

 

Ah, by 'college' I meant university.  The terms are mostly interchangeable where I'm from.  I went to the University of New Hampshire.  And, like you, the assembly language course is what got me.  It was an odd course.  We never wrote real assembly.  Instead, we wrote instructions in C for a simple virtual machine (also written in C) that my professor had made.  When we weren't doing that, we were working on simple compression/decompression algorithms, something with floating point numbers, and something with a custom linker.  So, while it was called 'assembly language', it was really all over the place.  I graduated with a BA in Communication at the end. :P

 

Right now, I'm slowly building up my own business/portfolio.  Until now, most of my work has been small scale stuff, the kinds of things you can't really put in a portfolio.  Some of my old work has been lost (a company folded, some clients changed software, I've had a computer die on me, etc.).  The rest is piecemeal, like "Oh, well I hacked a Joomla module, and here's where I did some custom JavaScript for a client."  Nothing to truly hang my hat on.  I also didn't plan on being a freelancer.  So, now with lessons learned, I'm trying to do it right.  Start small, start slow, then ramp up when I have my feet under me and something to showcase.

Link to comment
Share on other sites

We never wrote real assembly.

 

If you ever get the chance, try it! The next time you start bashing out some PHP or C you already know what will be going on behind the scenes. Like a simple division by zero, which changes a "flag" on the CPU registry. You'll also start to understand how high-level/abstract PHP and C truly is, the notable difference in number of lines required to do something like a simple IF or FOR.

Link to comment
Share on other sites

We never wrote real assembly.

 

If you ever get the chance, try it! The next time you start bashing out some PHP or C you already know what will be going on behind the scenes. Like a simple division by zero, which changes a "flag" on the CPU registry. You'll also start to understand how high-level/abstract PHP and C truly is, the notable difference in number of lines required to do something like a simple IF or FOR.

 

Well, the prof's virtual machine was similar.  We still had to play with registers and what not.  It just wasn't the real Intel x86 architecture we were playing with.  But, there was a simple execution stack, and we could track some things as it grew/shrank.

Link to comment
Share on other sites

  • 2 weeks later...

I agree with Ignace that assembler offers a wonderful amount of insight into how the computer really works, as well as insight into how memory is managed, concepts like the heap, stack, memory models, instructions, interrupts, etc., as well as how a high level language implements functions, pass by reference vs. pass by value, and the list goes on and on.  You probably never quite look at object the same once you realize they're typically just a data structure with a list of pointers to functions.

 

Personally, I would advise learning C first.  I don't see the danger of learning things "wrong" with C, and the simple fact is that C is used to implement C++.  Once you understand C syntax its much easier to understand C++ syntax and its idiosyncracies that come from C.  Learning C also gives you a nice springboard to looking at things like writing PHP extensions.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.