Programming Paradigms - Computerphile

preview_player
Показать описание
There are different styles of programming, some quite closely resemble pure mathematics. Mathematician and Computer Scientist Laurence Day compares two of them.

Note: In the Java code the delimiters within the 'for' loop should be semi-colons, not commas. Apologies for the error.

This video was filmed and edited by Sean Riley.

Рекомендации по теме
Комментарии
Автор

This is the THIRD video introducing functional programming where the host tries to introduce it as magic where you just put an expression and it's done, and then goes "but of course that's not all there is to it!".
This annoys me because you could literally have introduced Java in this with "sum(1, 10)" and then defining the method for sum. Like.. am I missing something or is this approach people like to use to introduce functional programming incredibly silly?

LeodSMW
Автор

if you ever have to sum a number of integers from 1 to z, just use the Gauss method z(z+1) / 2, arithmethic expressions are always faster than loops in computer science

Nemesis
Автор

Aaah! You used commas in the Java for loop instead of semicolons!

Tehsusenoh
Автор

May also be worth stating that imperative languages such as Java in this case also afford you the freedom to recursively define the sum function - you don't have to use a loop.

thAttempt
Автор

Nitpicker alert: his Java example would not compile, he is using commas to separate the parts of the for loop instead of semicolons.

SimplyDudeFace
Автор

Come on, what programmer doesn't mix up a symbol, or forget a semicolon, or forgets the name of a method sometimes? Those trivial errors usually happen when a programmer is thinking in a higher level of abstraction, and even more when there is an IDE underlining the syntax errors during typing. Only computers are required to run flawlessly, and even they have to be fault-tolerant sometimes. So why shouldn't we?

FernieCanto
Автор

What he is trying to say is that in imperative languages you give instructions on how to do a process while in declarative languages you define the relations between those things.

theodorberza
Автор

Name of this film changed from 'styles' to 'paradigms' to better reflect the content. >Sean

Computerphile
Автор

C++ templates are functional. Which makes them quite hard for most C++ programmers to use since the rest of C++ is (mostly) imperative.

stensoft
Автор

I could write the same recursive function in Java, so what's the real difference?

RFDarter
Автор

It would be nice if the next explanation would be about how Java's (and others') recursion requires a finite call stack of return pointers while Haskell (and most functional languages) has guaranteed tail-call elimination and what that implies.

Vulcapyro
Автор

"[C/C++/C#] are explicitly MS target languages"

"'high level' C/C++/C# binary will never fit in registry and or memory."

These comments from you are two completely different and unrelated statements, and they are both nonsense.

TazG
Автор

In the for loop, if the variable i starts at zero, there will actually be one extra iteration at the beginning where 0 is added to 0. It would be much better to initialize i at 1 for this purpose.

xcalibur
Автор

Very nice explanation. A very important part of functional programming is being able to store pointers to higher order procedures and being able to return these as a value.

astroboomboy
Автор

Brady -- I know these videos keep getting a lot of criticism, but I think that's a testament to how engaging this channel is. You've really created an amazing set of videos, here and at numberphile, sixty symbols etc.

jsnadrian
Автор

How times change, nowadays in Java you'd write something like IntStream.rangeClosed(1, 10).reduce(0, Integer::sum);, which is suspiciously functional...ish style.

Languages rarely fall into purely one category, and of course as we know, real programmers can use any language and any paradigm to write in Fortran. :)

brodaclop
Автор

10 years later and this explanation is still rock solid, thank you .:)

omaraymanbakr
Автор

I'm so hyper-aware of the high-rise-terminal (upspeak) these days, and this drove me nuts... I wish I didn't go so annoyed by these things as this was a good video!

richardhawkes
Автор

I would LOVE more videos about programming paradigms!

qarey
Автор

It's worth noting, that summing integers from 1 to N would be done by an equation: (N(N + 1))/2

Squeazer