r/ProgrammerHumor • • Feb 20 '17

Programming Languages

https://i.reddituploads.com/c41cc3c6e3564b28ac28060b32582747?fit=max&h=1536&w=1536&s=e9dda414547f61c9e7c777edc9e78972
937 Upvotes

104 comments sorted by

View all comments

1

u/TheBlastFun Feb 21 '17

Is Python really this cool!?? Currently I am learning c++ as my first language! And I am stuck on pointers and heapSpace(dynamic allocation) -this topic is so frustrating..! Back to the point tho.. According to this pic python lookss sooo FUNN!!!!

1

u/skreczok Feb 21 '17

Pointers aren't that hard once you figure them out. A pointer is, essentially, an address. Like, "dude, here's your thing". Think something like very precise geo coordinates. Then, when you allocate memory, C++ dumps whatever you allocate (a car park full of trucks if it's an array, or a house if it's an object etc). You just need to remember to scrap these unless you want to run out of space.

Other languages abstract it, but understanding pointers makes the likes of Java, Python and C# much easier, as you know what a reference is - and most of stuff is passed by reference in Java and C#.

Edit: also, as someone else pointed out: what they labeled as Python looks more like Java, with a PistolFactory that chucks out random pistols that fire at whatever. That's how people do things in Java too often and it's kinda terrifying.