[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

What big mission critical software projects are written in functional

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 33
Thread images: 2

File: 1484710484924.jpg (1MB, 3456x3456px) Image search: [Google]
1484710484924.jpg
1MB, 3456x3456px
What big mission critical software projects are written in functional programming, /g/?

Genuine question, I've seen /g/ memeing FP and thrashing OOP massively so I wanna learn what's all the fuzz about.

I had never even heard of FP before in nearly 12 years as a software developer, so I have nothing in particular against it tbqh.
>>
Literally none.
Typical /g/ memeage.
>>
>>58733853

OOP is good and FP is useless garbage OP, stop believing what you read on 4chan. Next you'll believe in feminine penis, geez.
>>
>>58733853

>never heard of functional programming

looks like we got another math-retard. this is why pajeet is winning t b h
>>
>>58733853
> 12 years as a software developer
> never even heard of FP
Low quality bait
>>
>>58733896
This, 4chan is known to meme worthless shit just to troll gullible unwary folks like you, OP.
>>
>>58733876
This, thread over
>>
>>58733924
Mathfags are the ones pushing the FP crap, you nigger.

>>58733959
It's not bait, in the industry FP really has no relevance whatsoever.
>>
>>58733853
Lots of them might have parts of it written using FP.

The thing is though, that FP in big languages is kind of new. Java only got it in Java 8, and notice how it's there solely to support OOP.

You're not going to have pure FP anywhere, but then again, you don't have pure OOP anywhere either.

You want to see what religiously pure OOP looks like? Read Yegor's blog:
> http://www.yegor256.com/2016/11/29/eolang.html

I have never ever seen anything like that. Because it would be fucking insane.
>>
>>58733853

AFAIK some ticket systems for airplanes are written in Prolog.

WhatsApp and some telecommunication software is written in Erlang.

ITA software uses LISP.


Generally FP is just a tool, just like OOP.
Sometimes it's better to pick the wrench, sometimes the screwdriver.
>>
>>58734337
You've obviously never been to /dpt/, you're gonna have so much fun when you do.
>>
>>58734232
I found an even better example:
> http://www.yegor256.com/2015/08/18/multiple-return-statements-in-oop.html

public int max(int a, int b) {
return new If(
new GreaterThan(a, b),
a, b
);
}

Disregarding the entire fucking issue of speed, how is this shit more readable?
>>
>>58734487
wtf?
This looks even worse than Java.
>>
>>58734048

Yeah that's why I called you a math retard. Too stupid to understand it you code monkey.
>>
>>58734518
It doesn't, stop damage controlling.
>>
>>58734538

Hey, man. Math is great. And so is functional programming. Shilling against a tool in the toolbox for some kind of personal gain is a fucking kike-esque attitude and you should feel bad.

Your OP was also a complete shitpost. How do you know FP is shit if you've never even heard of it? What kind of closet do you live in where you have never even heard of Ruby et al?
>>
>>58733853
Gov.uk uses Scala
>>
>>58734393

I've been on /g/ for years and deliver code examples on a regular basis.

/g/ likes to bash everything, this includes
OOP.

>"The stories and information posted here are artistic works of fiction and falsehood. Only a fool would take anything posted here as fact."


>>58734232

>You want to see what religiously pure OOP looks like?

I always found the OOP models of Smalltalk/Ruby (quite similar) and Scheme/LISP/JavaScript (also quite similar) pretty good.


>>58734574

I think Ruby is one of the pures OOP langauges out there.

But yes, I understand what you mean:
Stuff like map/reduce/filter or the for-each-loop are typically functional constructs, yet they are so common that people often forget about that.

Personally I don't think it's a "black or white"-thing, why not use functional enumerators with objects and classes? Best of both worlds.

>inb4 "muh purity"


>>58734588

So basically they are using Java with a bunch of Scala classes for the coolness?

Just kidding, Scala has really a nice approach. I plan on learning it the next year. I'm only afraid that it's pretty tempting to "cheat" and use Java-like style every now and then..

Can you recommend it?
>>
>>58734232
>You're not going to have pure FP anywhere
Elm is pretty much as pure as it gets.
Even 'purer' than haskell, as it enforces complete functions, doesn't have undefined and doesn't have unsafePerformIO.
Not that pureness is any form of measure whether something is good.
>>
>>58733853
>What big mission critical software projects are written in functional programming, /g/?
People use the best from both worlds, OP. There's a reason why virtually all modern programming languages and frameworks use concepts both from object-oriented design as well as functional programming.

>I had never even heard of FP before in nearly 12 years as a software developer,
Then you are most likely a completely shit developer to be quite honest. Even self-taught programmers get exposed to functional concepts just by using existing frameworks and being moderately interested in the field of software engineering.
>>
>>58733853
>>58733876
>>58733896

Amazon
Netflix
Australian Post
Capital One
Database Labs
Deutsche Bank
eBay
LG
Oracle
Spotify
Soundcloud
Aviso...

And many more are using Clojure.

FP programing is all over the place in critical back-ends, and big data situations. It's just never made a big splash outside of that because it's not easy or accessible as things like python. And the lack of documentation and tutorials puts casuals off. It's there, but out of sight out of mind. If it was not half the shit you use every day would not be working.
>>
>>58734232
>Here are the things I think do not belong in a pure object-oriented language:
>flow control (for, while, if, etc.)
wut
>>
>>58735129
Why not?
If you want to be 100% pure, everything has to be an object.
Having flow control statements would mean it's a procedural language with OO on top.

It's kinda like lisp, where everything is a list
>>
>>58735129
>>58735232
you ditch your FOR loops and only use something like object.forEach(procedure())

It kind of sucks.

I personally think a "pragmatic" approach is better, and not just with OOP having procedural stuff but also having functional bits and declarative too.

If you've seen C# lately you would understand:

>WPF displaced winforms for the Views. Declarative > OOP here

>LINQ is FP and replaces procedural+OOP Database Queries.
>>
>>58735232
Isn't flow control a necessary subset of every turing complete language though?
>>
>>58735704
This is flow control. It's just hidden behind an abstraction.
A pretty shitty abstraction if you ask me, but someone obviously thought this is a good idea.
>>
>>58735748
>It's just hidden
Meh
Python is best language, followed closely by C.
>>
>>58735662

>you ditch your FOR loops and only use something like object.forEach(procedure())
>It kind of sucks

I think it's way more elegant to use functional iterators.

Let's write a short function that uses an array, replaces some values, concats them and prints as output.
I will write it in Ruby two times, but the first time I try to be as "old schoold" as possible, then second time I use an functional approach.


Here is a traditional/procedural/OOP way of doing it, similar to C, Java or Go:

some_array = ["op", "is", "a", "faggot"]
result_string = ""
i = 0
while i < some_array.length
if (some_array[i] == "a")
some_array[i].replace("always a")
end

if (i%2==0 && i<2)
j = 0
some_string = ""
while j < some_array[i].length
if (some_array[i][j].ord > 96 && some_array[i][j].ord < 123)
some_string += (some_array[i][j].ord - 32).chr
else
some_string = some_string + some_array[i][j]
end
j += 1
end
some_array[i] = some_string
end

result_string = result_string + " " + some_array[i]
i += 1
end
result_string = result_string + "!!"
puts(result_string)



Now the same thing in a "functional way" like you would do it langauges like Ruby, Python or Haskell:

p ["op", "is", "a", "faggot"]
.map {|x| x=="a" ? "always a" : x}
.map.with_index {|x,i| (i.even? and i<2) ? x.upcase : x}
.join(" ")
.+("!!")
>>
File: 1468774523397.jpg (13KB, 334x177px) Image search: [Google]
1468774523397.jpg
13KB, 334x177px
>>58737207
>C is pretty shitty for processing strings
This is news to literally nobody.
Also your code is shit it puts a leading space at the start of the output.
>>
>>58733853
None.

Most mission critical is first modelled using formal methods (See https://en.wikipedia.org/wiki/Formal_methods) to test that your model is complaint to the domain and range of your problem.

The problem with that is that (AFAIK) there are no tools to help you turn your tested automaton into a compilable language that can go into whatever you're making (e.g. a minimal system) so you will have to translate the model into a real programming language, this is where mistakes are made.

Where as FP is nice for enforcing a model, you will find that there are not many people using because they're not very memory efficient (https://en.wikipedia.org/wiki/Functional_programming#Efficiency_issues). On the other hand, modern languages are adding support to FP so this might improve in the future, but I still think is unlikely that people will switch from one paradigm to another and/or using in mission critical software.
>>
>>58737207
>
  if (i%2==0 && i<2)

Whoops I missed that. Why not just write if i==1?
>>
>>58737677
>i==1
err, 0
>>
>>58735125
>half the shit you use every day would not be working
It would, just in another language.
Thread posts: 33
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.