Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[C++] Best way learning C++..?

Custom Title Activated
Loyal Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
That's not really accurate. If you're writing system or performance critical software, the algorithms become just a small part of it (unless the performance is purely CPU intensive, in which case the best algorithm does a great deal for you). However, in these types of systems, (perhaps a game rendering engine for example), optimizations can have a HUGE impact on performance (non-algorithm related optimizations, rather resource optimizations).

Just read the link I posted. No, (micro) optimizations do not make a huge impact on performance. If you do a text comparison for example and from your ASM experience you know one way is 10% faster than the other, you will have made 10% difference on something completely insignificant. If you know how to code well so that you can use a 1000 comparisons instead of 2000 comparisons (which is a minor feat generally) you will already have saved 50% performance.

For example, in PHP the stringhandler is faster when you use single-quoted ('text') type strings compared to double-quoted ("text") strings. Reason for this is the way they are both parsed - a typical micro-optimization.

On the other hand, I also know how to write an caching engine so certain dynamic parts of my website for instance do not have to be rendered for each pageview - a typical macro-optimization.

How much do you think each of these impacts performance?

Exactly: the string optimization does not affect performance in any measurable way - page generation time is about 0.12 seconds with or without it. Sure, it might have saved a 1000th of that, so instead of 0.120 it will now take 0.119 seconds - whoohoo! Compare that to the effect the global caching mechanism has: from 0.120 seconds page generation time drops to a whooping 0.025 seconds, roughly 480% faster. Yes, assembly-level optimization may, in some cases, improve performance a few procent. But the gains at the design level are usually far, far greater. That is why new programmers should always focus on overal design first and low-level implementations later.

Of course, you do not have to take my word for it; there is a good Wikipedia article on , which pretty much states the same:
The architectural design of a system overwhelmingly affects its performance. The choice of algorithm affects efficiency more than any other item of the design.
Versus the gain on assembly-level optimization:
With more modern optimizing compilers and the greater complexity of recent CPUs, it is more difficult to write code that is optimized better than the compiler itself generates, and few projects need resort to this 'ultimate' optimization step.

Once again, I do not deny the fact that it is beneficial for a programmer to know the basics behind memory allocation, CPU utilization and garbage collection. But saying it will lead to more efficient programs passes by that huge, incredibly important and difficult step which is the design process itself. Furthermore almost all applications to date do not need micro-optimization. If you get the overal design right, and run it on a fairly modern machine, almost anything will be fast enough. There is not a company in the world that will pay for you to run through thousands of lines of assembly when they can simply buy a machine that's twice as fast for half the money. Don't believe me? There is a funny on the DailyWTF about just that :laugh:
 
Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
wow thanks for all great answers =D

Well im 13years old and i've already started learning , following a swedish tut [im swedish] and on tuseday ill go to library and get a C++ book and read when im not teching on computer :p
after summer break ill start in 8th grade so while im in 8 and 9grade ill learn and probaly become pretty good and when i have ended 9th grade i'll go in a 'coder' class in 3years. After that :p well idk my goals for now is
to make small helpful things. Make a whole new game []Ive always wanted that[] i'll ofc need a team for gfx and spirits + alot of coding.
And the last thing ive been thinking off is to make a new OS when im very good and prbly a bit older :p Idk...Thanks for reading my dreamlist :Dhaha



permalink Report Post
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
You are completely missing the point. I am not telling him to learn ASM so that he can perform a small overhaul to a function to gain a 10% efficiency increase from hand-coding some loop in ASM. Those sorts of optimizations aren't even worth doing today with optimizing compilers capable of writing code that's better than your average assembly programmer.

It's like learning calculus, sure you can APPLY calculus, but you really have no Ducking clue what any of it means without taking an appropriate analysis course. Can you tell me WHY the intermediate value theorem is true? You KNOW it's true, you can use the fact that someone has proven that it's true, but if you need to use reasoning similar to the reasoning that makes that theorem true, you CANNOT because YOU DO NOT KNOW the reasoning employed to show that it's true. Instead, you simply take it for granted.

The "best way" to learn C++ is to learn assembly first. The best way to learn to program is to pick any language, stick with it, learn the fundamentals of programming, the paradigms, algorithms, data structures, then explore with ASM/C/C++ and with that, any procedural language will be at your disposal to do ANYTHING you wish. But as it stands, as I said before, if he really wants to learn C++, the best way will be to start with ASM. You don't teach anything else by just jumping into the advanced world (math for example, we don't start teaching people partial differential equations and fourier analysis in kindergarten), because that doesn't work, it just confuses the issue and makes learning more difficult if not impossible. You might be able to apply some things you "learn" but you don't really know wtf you're doing.

Read what he asked again, what is the best way to LEARN C++, not to become acquainted with it enough to write a hello world here and a program to parse a file there. He won't learn C++ that way :). I know NOBODY who knows C++ as well as me or better who doesn't know ASM/C very well. And I know plenty of people who've tried to learn C++ for years who don't know ASM/C and they have difficulty doing things that are considered basic. It really does make a MASSIVE difference. There's a reason I'm about 50 levels above anyone else at my university, sadly. [Do not confuse this with memorizing and applying algorithms, that is an entirely different monster, but should also be done in tandem with learning *ANY* language as it's invaluable to know a good algorithm or data structure for a situation, as it saves much time and frustration]
 
Junior Spellweaver
Joined
Jun 1, 2009
Messages
129
Reaction score
0
"I'm a really bored guy and i wish to learn C++ basics and more step by step."

Don't make it too complicated.
 
Custom Title Activated
Loyal Member
Joined
Aug 8, 2004
Messages
3,892
Reaction score
20
However, in these types of systems, (perhaps a game rendering engine for example), optimizations can have a HUGE impact on performance (non-algorithm related optimizations, rather resource optimizations).
I am not telling him to learn ASM so that he can perform a small overhaul to a function to gain a 10% efficiency increase from hand-coding some loop in ASM. Those sorts of optimizations aren't even worth doing today with optimizing compilers capable of writing code that's better than your average assembly programmer.
You do read your own posts, do you? Or are you really too busy boasting about your study results to worry about that? :wink: And yes, I can tell you why the intermediate value theorem is true - it so happens I studied astrophysics before I started my current study in artificial intelligence :wink:

You really think you need to know ASM to understand pointer arithmic or member initialisation? Don't make me laugh - the more you program the more abstract you think, the specific language or implementation is nothing more than a tool. You don't know exactly how every piece of wire in your car works, but you can still drive it, can't you? There is a word for people that concentrate on every little detail at the cost of loosing the greater overview: it's called being an anal-retentive. There is plenty of good examples (like Daevius) to illustrate you really don't need to know ASM to become a good C++ programmer.
 
Newbie Spellweaver
Joined
Jun 19, 2009
Messages
26
Reaction score
0
You are completely missing the point. I am not telling him to learn ASM so that he can perform a small overhaul to a function to gain a 10% efficiency increase from hand-coding some loop in ASM. Those sorts of optimizations aren't even worth doing today with optimizing compilers capable of writing code that's better than your average assembly programmer.
You totally said it:
The best way to learn C++ is to stop learning C++ and to learn Assembly.


ASM is totally old and its a low-level language. It's like your using a hard method instead of using an easy one, besides you can learn C++ even if you don't know ASM.
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Looks like things on ragezone haven't changed much since I last came here.

Enjoy making your console apps that don't do anything useful and living within the prison that will become your immediate set of libraries. I am sincerely sorry for the extreme frustration you will encounter when trying to write many types of software (and inevitably you probably will try to write these types of software) as you won't understand how or why existing examples work.

Though, you can PM me if you want to really learn.
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Well...learning ASM is not a prerequisite to learn any other language. But I think ASM or C _is_ a great tool to get your part of performance-obsessiveness. Both give you a great view on how it all actually works, sure processors differ, but the general concept or method is the same. It's not required before you learn a language, but is very valuable to learn at some point (which is true for C++ (a like) and PHP (a like) languages as well).

I'm a hobby programmer, I love to spend time optimizing or thinking of new algorithms. I really enjoy if it's difficult (like ASM).
 
Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
Ooh nice :D Thanks for info!
I've begin learning C++, its really fun when it works and kinda fun when i get errors, atleast when im able to figure em out.:8:
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Ooh nice :D Thanks for info!
I've begin learning C++, its really fun when it works and kinda fun when i get errors, atleast when im able to figure em out.:8:

^^, wait till you get even more pesky bugs...some bugs take me hours to figure out...write code right immediately or else the bug-demon be damned upon-yee
 
Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
HAha yee :p that can be annoying but when u succee fix it you gets so happy :D atleast i do.
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Just wait till you deal with multithreading errors. They're difficult to debug and are often obscure. And, in a lot of cases, WHY they happen can only be truly explained by assembly.

But then again, apparently assembly is TOTALLY Ducking USELESS when you're learning C++. As anyone here who has programmed and debugged VERY LARGE and COMPLEX software for 10+ years will tell you. Oh wait, there aren't any.

CAS.. wait-free and lock-free algorithms are completely based around ASSEMBLY TRICKS, not C++/C#/Java constructs. I could go on and on for days. But enjoy TRYING to figure out those bugs, you'll probably end up posting the code on a forum somewhere and asking for help because you don't have the PROPER FOUNDATION to debug it yourself.

Aye aye, rowing down a stream into a jungle with 1 days worth of food and no water is a bad, bad idea.
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Just wait till you deal with multithreading errors. They're difficult to debug and are often obscure. And, in a lot of cases, WHY they happen can only be truly explained by assembly.

But then again, apparently assembly is TOTALLY Ducking USELESS when you're learning C++. As anyone here who has programmed and debugged VERY LARGE and COMPLEX software for 10+ years will tell you. Oh wait, there aren't any.

CAS.. wait-free and lock-free algorithms are completely based around ASSEMBLY TRICKS, not C++/C#/Java constructs. I could go on and on for days. But enjoy TRYING to figure out those bugs, you'll probably end up posting the code on a forum somewhere and asking for help because you don't have the PROPER FOUNDATION to debug it yourself.

Aye aye, rowing down a stream into a jungle with 1 days worth of food and no water is a bad, bad idea.

Cool down, someone disagreed with you, so what? No need to get angry about it.
 
Newbie Spellweaver
Joined
Jun 19, 2009
Messages
26
Reaction score
0
Just wait till you deal with multithreading errors. They're difficult to debug and are often obscure. And, in a lot of cases, WHY they happen can only be truly explained by assembly.

But then again, apparently assembly is TOTALLY Ducking USELESS when you're learning C++. As anyone here who has programmed and debugged VERY LARGE and COMPLEX software for 10+ years will tell you. Oh wait, there aren't any.

CAS.. wait-free and lock-free algorithms are completely based around ASSEMBLY TRICKS, not C++/C#/Java constructs. I could go on and on for days. But enjoy TRYING to figure out those bugs, you'll probably end up posting the code on a forum somewhere and asking for help because you don't have the PROPER FOUNDATION to debug it yourself.

Aye aye, rowing down a stream into a jungle with 1 days worth of food and no water is a bad, bad idea.
did you know whats the thread's purpose? stay on the topic.
You can't make people learn ASM because you just said so.

You can read this quote for you to understand:
Hello! :D

I'm areally bored guy and i wish to learn C++ basics and more step by step.
I wonder what internetguide/bok/video i shoudl watch do learn C++ as fast as possible, but im sure it'll take time,
Please links or tips :D

Live help by msn would also be good lol :p

Well thanks in adv.







@TS
is where I learned.
 
Watching from above
Legend
Joined
Apr 9, 2004
Messages
3,828
Reaction score
752
Yeah, it's pretty much pointless invading every topic by saying they want the wrong thing. Sure, a recommendation by the side can be a good hint, but we'll never get anywhere here if every question (topic) is answered with another question: "why do want to do that, it's lame, do this instead..".

As to the debate going on: I don't think learning ASM is the best way learning C++, either. I recommend a book, too, rather than separate tutorials because there's a lot where the "theory" is more important than a single implementation.

As far as mentioned multi-threading problems go, it's kind of not even tied to C++ itself, but algorithms and techniques, more related to general programming skills, besides you don't even need to know ASM to be successful with concurrency.
 
Ginger by design.
Loyal Member
Joined
Feb 15, 2007
Messages
2,340
Reaction score
653
Yeah, it's pretty much pointless invading every topic by saying they want the wrong thing. Sure, a recommendation by the side can be a good hint, but we'll never get anywhere here if every question (topic) is answered with another question: "why do want to do that, it's lame, do this instead..".

As to the debate going on: I don't think learning ASM is the best way learning C++, either. I recommend a book, too, rather than separate tutorials because there's a lot where the "theory" is more important than a single implementation.

As far as mentioned multi-threading problems go, it's kind of not even tied to C++ itself, but algorithms and techniques, more related to general programming skills, besides you don't even need to know ASM to be successful with concurrency.

EnterCriticialSection()
CODE
LeaveCriticalSection()

or

pthread_mutex_lock()
CODE
pthread_mutex_unlock()

Everywhere causes massive bottlenecks and makes concurrency completely useless. I wouldn't call that being "successful." The only way to achieve true scalability is wait-free design, and that's not simple, not even to parallel experts.
 
Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
Hmm
Two questions
I'm gonna spend alot of time learning programing.
First question
Im now gonna start learn C++ much, but i atleast wanna learn one or two more programming language.
What more u suggest me to learn?
What im gonna do with my coding skillz, is helping privvate server coding. Make my own titanms repack since c++ is titan. And in future make a game...<.<

Question 2
What can i actually do with C++ :O?
Can i do like, anything? i mean, what can i make? all kind of games, programs?
 
Custom Title Activated
Loyal Member
Joined
Jun 28, 2007
Messages
2,986
Reaction score
3
Uuh yes. C++ is general purpose, you can make the weirdest extremes if you want to.

Start with C++ first, its useless to already decide what to do after C++ because it'll keep you busy for years. When you learned C++ it'll be much easier choosing another language.

Whatever language you do, dedicate to it (no other languages in the meanwhile) and do it seriously. The most useless programmers know jack of all trades.
 
Experienced Elementalist
Joined
Mar 25, 2009
Messages
204
Reaction score
2
Oohh :D
Thanks for ur good answers, all of em have been good sofar.

Back on topic, well as ive said i wanna do games and a OS later in my young life.
Hmm yea i should learn C++ seriosly first then decide.
Since i wanna make games i shall also learn some photoshop xd the gfx part seem to be hard for every game creator. :D
 
Back
Top