The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 23, 2019, 10:23:26 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: C/C++/C# where to start?  (Read 5393 times)
ksan
Rookie
**
Offline Offline

Posts: 10


View Profile
« on: November 24, 2009, 10:06:27 AM »

I've done everything in PHP up until now and think I am at an intermediate level. Due to speed and scalability though I would like to move to a "real" language.
I have no experience in server administration or anything unix, so I guess there is a lot of learning to be done. Can you recommend any good resource for learning C and the likes? Either books or websites are fine.
Thanks guys!
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: November 24, 2009, 10:17:34 AM »

C++.

But don't be confused into the notion that PHP is not a "real" language. It is enormously powerful and can be tweaked for lotsa more power. Simply look up APC for PHP, install it and you'll see what I mean. Additionally, don't think that just because you're in a compiled language, that crappy coding will make it better. Crap is crap.

The reason to extend into C/C++ would be because there is either something missing from PHP (or your current tool of choice), or you are required to for a project, or simply to grow yourself. Unless you're doing drivers or high-end/high-speed processing apps to be run locally on a machine, there's nothing that PHP is not going to do for you. And if we consider the browser as your view portal, then the backend language is immaterial. To grow your chops, you might consider learning JS really top to bottom and then invest yourself in an AJAX methodology, which is way more contemporary and forward thinking than C++.

All this said, I love C and C++ and they're great tools to have in the bucket. A book as simple as Teach Yourself C++ in 24 hours will give you enough to get going. If you are a strong PHPster, you will find a great deal of the language immediately accessible ... although some of the intricacies of compilation and linking might befuddle you for a bit.

Oh ... that and pointers. Pointers will dick you for a while Wink
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
ksan
Rookie
**
Offline Offline

Posts: 10


View Profile
« Reply #2 on: November 24, 2009, 01:44:55 PM »

Great, thanks for your input. I never heard of APC before but it sounds really promising.

Also, I just ordered the book and I'm looking forward too it. You are right, this endeavour will help me grow. For the most part sticking to PHP, my native language if you will, is going to be much more productive.
Logged

No links in signatures please
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #3 on: November 24, 2009, 02:26:28 PM »

APC, or the Alternative PHP Cache will keep compiled versions of your code in memory, so they don't need to be compiled again the next time they are called. It can makes PHP run more like modules under JBOSS for Java. When I started really using it (and understanding the dynamics of the tool and how to use it) I increased my PHP performance by about 1000%. Yes, 3 zeros.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
lamontagne
Journeyman
***
Offline Offline

Posts: 89


View Profile
« Reply #4 on: November 24, 2009, 03:56:11 PM »

Oh ... that and pointers. Pointers will dick you for a while Wink


Pointers are your best friend in any language. No matter what language you pick and even if you decide to stick with PHP I suggest you get a serious grasp on pointers, even down to the machine level. It will open new doors for you entirely.
Logged

"Long time no see. I only pray the caliber of your questions has improved." - Kevin Smith
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #5 on: November 24, 2009, 04:01:42 PM »

 Ditto totally friggin' spot on. But they'll dick with a n00b for a while. And not, perhaps the pointer itself, but the whole concept of memory locations, dereferencing, References and then pointers to pointers of pointers. That'll bake his noodle.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
isthisthingon
Global Moderator
Lifer
*****
Offline Offline

Posts: 2879



View Profile
« Reply #6 on: November 24, 2009, 04:47:02 PM »

http://www.headfirstlabs.com/books/hfooad/



Quote
Pointers are your best friend in any language. No matter what language you pick and even if you decide to stick with PHP I suggest you get a serious grasp on pointers, even down to the machine level. It will open new doors for you entirely.

I can't imagine life without understanding pointers.  I got into C soon after I learned to program in Basic and the lessens learned about memory management and pointers have guided me for the past (gulp) almost 30 years I've been a software engineer.  I think I was 10 in the 5'th grade and I'm 40 now so.... 

That said I couldn't agree more with the advice of perks.  Here's my recommendation: spend as much time as your brain can handle trying to grasp pointers, memory management, and other lower-level concepts such as callbacks, type casting, multi-threading, etc.  But like any good workout program you will never stick with it unless there's some fun involved. 

Learning C# or Java would not be a bad idea either and you'll get far more support from current books and people doing it now - rather than way back in college 

Oh did I mention object oriented analysis and design??  Wink  Key of keys  Nerd
Logged

I would love to change the world, but they won't give me the source code.
lamontagne
Journeyman
***
Offline Offline

Posts: 89


View Profile
« Reply #7 on: November 24, 2009, 06:12:57 PM »

I can also vouch that c# is a good language to get into after php... the transition isn't as harsh as C or C++ would be.. but if you have the time, just learn C.
Logged

"Long time no see. I only pray the caliber of your questions has improved." - Kevin Smith
nop_90
Global Moderator
Lifer
*****
Offline Offline

Posts: 2203


View Profile
« Reply #8 on: November 24, 2009, 07:32:46 PM »

Power of C/C++ is in embedding into a higher level language like Python,PHP,ruby,perl,lua etc.
Main reason why u want to do this is pointers.

Prime example is NumPy lib is python.
Math lib that allows u to manipulate large arrays/matrix.
Because of pointers its speed is almost that of C/C++.

What makes it more powerful, is allocate memory for matrix with python.
Then lets say u have a math operation u want to do on that matrix.
Using C/C++ u can access the memory using another module u created in C/C++.
So basically ur grunt work is done is C/C++ and python is just the "glue".

Where problems can happen.
U fuk up ur pointers. In this case u get a memory leak.
Or worse yet u get a segmentation fault.

As rule of thumb.
Make ur algo in scripting language.
So lets say ur doing a flood fill to break a captcha.
Don't worry about speed. Just make sure it works.
Then u profile the code. See what functions are being called, how much time is being spent in each function.

U see in ur flood fill, certain function is being called 2000 times at 1ms per call.
Optimize that one with C/C++.
One the other hand do not waste ur time optimizing another function that is called 1x Smiley


Logged
Vaughan
n00b
*
Offline Offline

Posts: 4



View Profile
« Reply #9 on: November 07, 2010, 11:29:23 PM »

Hello guys.....!
Thank you for your useful information.I like this kind of post which tell us much wander full massage. ...!
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #10 on: November 07, 2010, 11:48:07 PM »

Bummer. And here I thought V might be a real person  Undecided
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!