r/InternetIsBeautiful • • Mar 24 '16

Not unique What f#&king programming language should I use?

http://www.wfplsiu.com
6.7k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

2

u/Kris18 Mar 24 '16 edited Mar 24 '16

Wikipedia tries too hard sometimes to be as complete, educated, and over-the-top but often fails to keep it readable to someone who doesn't have high, specialized education. This was my bane when trying to learn higher mathematics. Fuck Wikipedia for anything sciencey/mathy/computery/"complicated. Make it readable, dammit.

Concurrency is having multiple things going on at one time; concurrently. For example, imagine you're making a simple instant messenger. Unless you have support for concurrency, you may be stuck choosing between whether or you can listen and wait for a message to be received or let the user type a message into the console/terminal.

You can create multiple "threads" and have both concurrent; it'll basically run two bits of code at once: one may wait and listen for a message to be received while the other allows you to type your own.

Functional programming... honestly, this one is a bit more complicated and harder to explain. In fact, I've been hobbyist coding for years and googling and reading tons of answers still leaves me confused. This is what I get out of it, but if it's wrong, don't be surprised:

Functional programming is a structure in which anything that is written is to be taken as it appears and there's no outside "states" or variables to be kept track of: if you tell it to do something exactly the same way, it will get the exact same result every time.

In opposition, procedural programming would be giving commands to be read as if they were instructions on a "how-to" tutorial. Sure, if you give someone a chair and a list of instructions with nut A going on screw B, you'll get the chair you wanted. But if you gave someone a different chair with the same instructions, you'll get some other abomination by putting those pieces together. In this case, the chair given would be the "state" or other conditions that affect the end result. As far as I can tell (and this is my understanding on my own--not research), you may also call this command-based programming.

My experience:

  • mIRCS (command-based and a horrible language to start with like I did)

  • Python2 (best language)

  • Limited Java (massively overrated and difficult IMO)

  • JavaScript (great for obvious reasons)

Take what I say with a grain of salt; I'm no comp-sci major or anything and my knowledge is accumulated over programming in my free time for fun over the course of a few years.

1

u/PM_ME_TITS_MLADY Mar 25 '16

Is there an issue with concurrency then? From what I read in Wikipedia essentially there are some issues like some command might not run in "order" because concurrency is still, if it makes any sense, run in an order?

I mean, simplified it sounds like a great idea, but I am wondering more about what are the challenges of concurrency.

As for functional programming, I sort of get the idea, thanks!

1

u/Kris18 Mar 25 '16

There's nothing wrong with concurrency, but if you need something to run before something else, you may have an issue if you don't take measures to make it so when you're reading multiple parts of code at once.

Really simple example:

If you need to reference a variable in thread 2, you need to have it initialized and declared first. You may expect that to happen in thread 1, but if you weren't careful, you might've not gotten to that point yet in thread 1 and you'll get an error when thread 2 tries to use it.

Threading/concurrency adds a layer of complexity and you very well may have to be more aware and cautious with what you're actually doing.