Learning C++ programming language

"
SkyCore wrote:
Not to long ago i thought id learn python. 10 minutes later looking at example code i saw like 3 or 4 colons which all meant different things because of their context. Then and there i was like, 'nope'. Ill stick to languages that are actually human readable.

Java is the ideal beginner language imo.
I'm struggling to work out if you're joking or not. Python is much, much more human-readable than Java for people just starting to learn programming, and that's one of it's strengths.

I earned extra cash teaching in the computer science labs and tutorials at my university both during my degree and after I graduated, for 1st through 3rd year papers, and was employed as a research assistant helping to run our part of an international study into how people learn to program.

I was one of the lab demonstrators the first year the department introduced an optional python paper to be taken before the previous introductory paper, which used Java, and demonstrated that paper the next semester. The students who'd gotten to learn programming in python first before having to deal with all java's peculiarities and obnoxious boilerplate in general did a lot better than those in the same year who hadn't taken the python paper, and those in the previous year who hadn't had the option.

If someone was dead-set on learning Java specifically, I wouldn't stop them, but I wouldn't recommend it as a first language for someone learning programming, because leaning Java as well as learning programming increases the stuff you have to take in, and sometimes new programmers can't separate the two particularly well.

Basically, having to learn this (extra spacing because I can't make the tabs work):
"
public class HelloWorld {

public static void main(String[] args) {

System.out.println("Hello, World");

}

}
Is a lot trickier than this:
"
print( "Hello, World")
especially when you consider this first has to be saved to a file with a particular name for reasons that aren't immediately apparent, because the Java compiler enforces that, and the second doesn't need to be compiled and can be typed directly int he python shell and will immediately produce the intended result.

The things being touted in this thread as good features of Java as a first language (readability, ease of getting to a visible result, etc) are notably more true of Python than they are of Java, and Python has a lot less boilerplate code that has to be either memorised without understanding until you get to the point you can start to actually learn what it's for - Python, for the most part, lets you only have the bits that are important to the actual program.

Python being an interpreted language is useful for learning (compilers and how they work are important, but it's useful to not have to care about those until after you've got the basics of programming down - again with the point that keeps coming up about wanting to quickly see a result and know you're making progress, and being able to just type individual commands into the interactive shell in IDLE and copy them into an actual file when you've got them working is something I saw helping a lot of the students when they ran into issues.

Python isn't perfect, and it's not something you're going to make a big-budget game in (although it has been used for some successful indie titles), but it's a great choice as a first language because it keeps the focus on learning programming, rather than learning the language, and you can then apply those same concepts to other programming languages much more easily later.

As someone who learned in QBasic from outdated library books intended for the BBC micro (which ran a different kind of basic with different commands in many cases), and later in Delphi from an article series in PC World, who was taught Pascal, Javascript, Java, C, and C++ at varying levels of official education, who was employed to help teach Java, C, and Python at university for several years, and who (somehow) managed to get a job at an actual game studio coding in C++ (although I still use python to automate some stuff from time to time, and our server guys use it a fair bit), I'd say you can learn in any language you want, and the concepts you learn will be broadly applicable in other languages, making it easier to learn another programming language once/if you decide to switch. But you'll make that initial process easier for yourself by choosing Python as a starting point.

If I remember, I'll post a link to some of the resources used in the abovementioned python paper here once I've dug them up. If I don't remember and anyone actually wants those, PM me a reminder sometime.
Last edited by Mark_GGG on Oct 28, 2015, 1:34:20 AM
"
Mark_GGG wrote:

Python is much, much more human-readable than Java


Perhaps im not human. That would explain quite a few things.

And i have to lol at this ancient forum which you cant properly post code in. I spent too much time pasting code examples of python that were nothing more than a jumble of letters and symbols, only to have it eaten by the forum.

"

s[::2] = [1]*8
i[:1:-1]

Is not easily non-human readable imo.
For years i searched for deep truths. A thousand revelations. At the very edge...the ability to think itself dissolves away.Thinking in human language is the problem. Any separation from 'the whole truth' is incomplete.My incomplete concepts may add to your 'whole truth', accept it or think about it
Last edited by SkyCore on Oct 28, 2015, 5:28:32 AM
Hey these are just my 2 cents as someone who is studying embedded systems:

We started with mathlab, c and had additional classes for vim (an old but powerful editor), git and g (a visual programming language for testing circuits and using the computer as a multimeter with external boards for our circuits elements + basic gate knowledge and logics.

C was a good starting point for me since you learn the basic concepts in any language first and then just transfer them to the next languages and get to know the different features of other programming languages that way fairly easy. You also learn how to allocate memory for your programm by hand and will have to work with pointers, arrays and all the basic stuff.

During these steps we also got to learn the backus naur form which is an annotation for the rules/grammar of a language.

Next came java and c++, assembler and vhdl and architecture classes. We programmed microcomputers like the 8051 and fpga's + testbenches and learned shell programming.

Before taking up my studies i started programming lego mindstorm roboters in java and pascal II and also wrote programms in delphi + i worked with sql and databases.

Most of the programming before my studies was webrelated and sql/php homepage coding for a bitcoin faucet and a paywall homepage utilizing the bitcoin qt to make micropayments to clickworkers for advertising.

It doesnt really matter where you start in case that you have a thing in mind that you want to accomplish (especially if there are transferrable tutorials that work on a similar subject and you will either find those or can chose from one of the interesting projects you found). You might want to take the hardware approach too though, since you get a basic idea of architecture. Try to work on more than just learning the programming language since a broader picture of what a computer is, what approaches there are to programming in general (style, reusability of code etc.) will make it easyer for you to really build on what you have learned so far.

a last mention that might be worth looking into: in case you want to go commercial later on is xcode/swift for apple since mobile games have a good market, can easily go viral if you got good ideas, are less complex than computer games that run on different systems and also teach you how to utilize smartphone sensors and crazy stuff (of course you could do android too). theres magazines helping you out and also forums for help;)

just keep being inspired and try what suits you best.
Never in a rush - always in a mess.
When I went through college our first dip into programming was c/c++ fairly straight forward and somewhat easy until you got into high performance coding and such. Then came along php which wasn't bad. Then Java. I loved that shit. But I can see being an OO language that it would not be easy for beginners. But, I do remember it made making lists and trees soooo much easier than with c++.

You want a real manly man language though? Do you want your brain mercilessly raped over and over again without proper use of lubricant!? Then assembly is for you! It... Broke me... I'm so sorry.. [runs of stage crying]
"
I'm struggling to work out if you're joking or not. Python is much, much more human-readable than Java for people just starting to learn programming, and that's one of it's strengths.

Well Python is the 3rd choice for embedded scripting aside from JS and Lua.
Also you can't know what he was using. It's even possible that people told him to use notepad++ to highlight Python Synthax and he hit different ones.




"
If someone was dead-set on learning Java specifically, I wouldn't stop them, but I wouldn't recommend it as a first language for someone learning programming, because leaning Java as well as learning programming increases the stuff you have to take in, and sometimes new programmers can't separate the two particularly well.

The one's to blame are those people who think it's a great idea to do the same type of teaching for each programming language and never explain what "#include <stdio.h>" in C++ or "uses wincrt" in Pascal is and tell you "just to add that every time"

JS is popular because it's often used for embedded scripting and it's simpler than other languages without using outdated types of programming.

But I couldn't figure out why people would use Java, maybe it was clever marketing because the I would always find better alternatives for its advertised strengths.

It's quiet funny when teachers taught in school how ancient c(++) worked and in university the first language became Java since standard input output and classes became too complicated or professors told you what you know is crap++ not c++.

"
Python being an interpreted language is useful for learning (compilers and how they work are important, but it's useful to not have to care about those until after you've got the basics of programming down

Unless you go deep into ASM you won't ever fully understand how compilers work.

"
As someone who learned in QBasic from outdated library books intended for the BBC micro (which ran a different kind of basic with different commands in many cases), and later in Delphi from an article series in PC World, who was taught Pascal, Javascript, Java, C, and C++ at varying levels of official education, who was employed to help teach Java, C, and Python at university for several years, and who (somehow) managed to get a job at an actual game studio coding in C++

Sounds pretty familiar the order with the difference that QBasic was taught in 7th grade, Pascal in 9th grade and from 11th on we switched to Delphi/C++/x86 ASM but in university since I didn't chose CS it was Mathlab,Fortran(gotta love case insensitive :p), ASM, Haskell and C++/C#.


Also why use quote? It should be easier to use a pastebin and select a language for highlighting.




"
Is not easily non-human readable imo.

It's more about synthax or loops.

for( int i=0;i<100;i++))

or

for i:= 0 to 100 do

is more complicated than

for i in range(0, 100):

especially in c++ when you loop through lists or vectors it isn't nice to read.



"
You want a real manly man language though? Do you want your brain mercilessly raped over and over again without proper use of lubricant!? Then assembly is for you! It... Broke me... I'm so sorry.. [runs of stage crying]



Somebody didn't play stacking as kid.
That's not manly it's machinely.

Actually ASM isn't that difficult when you get the knack of it. I also considered it quiet annoying in the beginning because the books, lessons were horrible and so were the poor jokes.
For example x64 Assembly you see a R7 register when R8-R15 are actually already 8 registers. And guess what 8 + 8 is 16 so why would we have 17? Since ASM is quiet mathematical you could tell those people "2^4= 17 you fail"


But from own experience I can tell you don't try to get cocky with ASM skills, when you are in a forum where others are also are knowledgeable because one of my hoaxes got be banned, almost banned and then mod tagged. I only got caught because somebody had over a decade more experience in ASM so he could easily bypass my antidebugging tricks. Well I was 20 back then.
And yes I got deep into coding since I was 15.
As a programmer who picked up C++ first and other languages such as Lua, XC, and JS afterwards, I think learning something like Python first makes a lot of sense. You can definitely start with any language, and the knowledge gained will apply to other languages pretty well, but something that lets you easily and quickly see results is helpful.

I was lucky in that I had an amazing teacher that I got to work alongside one on one with when I started, and still work with doing pair programming today. I would have struggled to pick up C++ in a more typical classroom environment, and I'm pretty sure I would have failed on teaching it to myself.

That said, now that I know how C++ works it feels pretty natural to me, and I'm impressed with how much power it gives you. Sure, that power comes with risks, especially when you're writing driver code, but it's nice to be able to manage memory just so when needed.

I'm not sure how helpful this would be, but there's a code library that contains some amazingly well documented code that I use at work every day, and it's free for non commercial use, called Juce. It can be found here: www.juce.com

Reading through the way Juce does things helped me understand a lot of different aspects of how C++ worked, and it also showcases some interesting ways to format your own code.

Hilbert, assembly still kind of blows my mind. I'm learning it right now for XC, since the compiler we use for that isn't that great at optimizing things, and it's been fascinating learning what the assembly equivalent of things is. Especially when you discover some commands that you can only do via assembly that are exactly what you were looking for :).

I'm curious, what IDE's do people like to use? I started with Visual Studio and have stuck with it, partially because of an amazing extension called Visual Assist X.
(From the perspective of a systems programmer, not games dev or web dev.)

I learned and used x86 assembly, C, Java, Haskell, Python, C++, and Ruby in college. Also got a decent amount of familiarity with LISP and Perl. After you learn two languages (and spending some time studying language theory (i.e. automata theory) and compilers), learning more becomes extremely easy.

Used Ruby and Python at my first job.
Used Java and Python at my second job.
Used C++ and Python at my third job.
Currently using C++ and Python at my job.

Python is fucking wonderful. It's fantastic for scripting, graphing/viz, simple mocks of complex designs, and is extremely readable. Learning how it works at a basic level doesn't take long. I happily suggest anyone wanting to learn programming to start with Python and then go from there.

C++ is also fucking wonderful in a different way. It's an immense amount of developer power -- holding the gun directly in your hands. Working with other people requires a lot of discipline, but the results are damn fast and efficient. C++11 or newer is a completely different world than "old style" C++.

---

The best way to learn programming is to start asking why something you are interested in works the way that it does. To fully answer what all (exactly) happens will take a decade, maybe more... no rush. Scratch your own itch. :)

---

re: IDEs, I use vim primarily for most things. For C++ I've been toying on and off with CLion (from JetBrains) since I enjoyed IntelliJ back in Javaland. Visual Studio is fine if you care about Windows, or so I've heard.
Ah yeah, I should have mentioned I'm developing almost exclusively on and for Windows at the moment, with some XCode for OS X and XTimeComposer for XC. Visual Studio is what I learned on as well, so it's what feels the most comfortable to me.

I also use Sublime for writing Lua scripts for Wireshark, and it does a great job for that.
"
Mephasm wrote:
"
grepman wrote:
Stuff


Yeah, but the OP asked for:

"
mjkittredge wrote:

I just want to create something super basic like pong to start off, just to see some kind of result that works and be proud of it that I grasped the basics, feel like I'm making progress. Branch out with more complexity from there.


I'm just speaking from my personal experience as someone who tried to start with C++ many years ago. I ended up getting bogged down and gave up after about 2 months, which then gave me the false impression that programming was just too difficult. Its not, I was just trying to swallow a watermelon whole.

I reccomended Unity and C# (or Java) because they are easy to learn and you get to see results, which is perhaps the most important part of the learning process. It is also a more practical place to start, especially if you plan to become an indie developer. Because unless you have a very generous friend who is a graphical artist, you will need to learn how to make models, textures, sprites, etc, yourself. This will consume the majority of the time it takes to make a game, even one with shitty graphics. One way of sidestepping this is to use procedural generation for terrain, think Minecraft or Terraria. But depending on what type of game you want to make, this might not be possible.

If your end goal is to be a programmer, sure learn C++ its a great language, but if you want to be a game developer I would go with unity first. Unity will help you achieve results, which is what most game studios look for. They want to see what projects you have worked on or completed, and usually don't care much about education.



I understand, but none of this has to do with c++ being archaic or not. just because you had troubles when trying to learn it, doesn't make it archaic by any logic.

Id also argue whether programming is 'difficult'- it's a very touchy subject. The basics of programming are not difficult. Programming is something that is relatively easy to learn, but EXTREMELY difficult to master. Programming is logic, applying mathematical concepts to problem-solving aka algorithms, and knowledge of hardware/software/the way shit works all meshed in one.

A game developer IS a programmer. Saying 'learn unity first' without knowing concepts is getting ahead of yourself. Even if you aren't doing netcode (and game developers do netcode - how can a game developer make netcode without knowing tcp/ip stack, concurrency issues and so on)- you need to know basics. Scripting might get you somewhere with games that have full game engines fleshed out (such as wintermute for point and click adventures) into IDEs. I mean, basic scripting. How is anyone going to design a game not knowing what a thread or event-driven programming is ? You may build a small model of a golden gate bridge not knowing strength of materials, but you aren't building a real, functioning golden gate bridge that is designed to withhold earthquakes, wear and tear and thousands of cars daily, with only brief knowledge of structural/civil engineering.

Java and C# arent necessarily easier to learn than C++. In fact, Id say theyre equally easy to learn. There might be more structural elegance and syntactic sugar to some stuff in C# and Java, but general syntax isnt much different at all. I mean,
nNo one is going to push a newbie to boggle in pointer arithmetic or multithreading or purposeful obfuscation on day one.

"
pneuma wrote:

C++ is also fucking wonderful in a different way. It's an immense amount of developer power -- holding the gun directly in your hands.

my choice of analogy is a manual transmission vs automatic transmission on the same car. A good driver with a manual transmission will get the best results in terms of efficiency and performance. Automatic is nice because you dont have to worry about the car stalling, you dont have to mess with the clutch and you dont have to keep your hand on the gearbox, but you wont *ever* get performance like you do with a manual with a great driver. you will be capped by what the automatic transmission dictates.

"

re: IDEs, I use vim primarily for most things. For C++ I've been toying on and off with CLion (from JetBrains) since I enjoyed IntelliJ back in Javaland. Visual Studio is fine if you care about Windows, or so I've heard.

VS is the best C++ IDE (and the default C# IDE I guess) for large projects Ive used. its a shame its only on windows, but if you aren't doing an architecture or UI/graphics-heavy project, c++ code is fairly portable for things like servers if you have all the required libraries.

Report Forum Post

Report Account:

Report Type

Additional Info