Is using OOP for concurrent/parallel programming a bad idea?

Is using OOP for concurrent/parallel programming a bad idea?

Some Haskellfag told me that's the case.

Other urls found in this thread:

bing.com”;
google.com”;
yahoo.com”;
search.com”]
twitter.com/SFWRedditVideos

>Haskell
You can safely ignore everything he says.

POO

Using Java is a bad idea

no it's not.
see: Akka framework

Haskell is a dead meme.

IN

java is industry standard, like it or not.

LOO

Seconding Akka. Best you can get.

Why does Sup Forums label all the widely used, industry standard languages as pajeet-tier and praise NEET-tier shit like haskell?

Ebin memes, upvoted.

>derp most websites use the PHP therefore the PHP good xD
because pajeet learns things because they are "industry standard"

real computer scientists use what has technical merits

of course if you're to stupid to make intelligent choices you will just pick what is popular you filthy code monkey

>Is using OOP for concurrent/parallel programming a bad idea?

No. There's a lot of concurrent oop code out there that works.

> Some Haskellfag told me that's the case.

There's also a lot of concurrent oop code that doesn't work. He was probably getting at the point that mutable state gives you certain problems with concurrent programming. Haskell doesn't have any mutable state so it doesn't suffer from the same problems. Haskell does have other problems though, so like 99% of "this vs that language" things it's personal preference as to what problems you'd rather deal with.

Thread thread = null;

final Runnable r = new Runnable() {
public void run() {
while(1>0)
System.out.println("You can't stop the train");
}
};

thread = new Thread( r );
The only way to sptop while(true) thread is to use deprecated method stop()...

because Sup Forums is all basement dwellers who don't work in the industry.

>real computer scientists use what has technical merits
meanwhile, architects pick a language that gets the project done in the shortest time, while keeping it maintainable for years to come.

Just don't mutate

>thread.start();

the same bullshit with while(true) thread using ExecutorService, Future and the rest of concurrency java shit.

>2016
>not using functional interface
Thread thread = new Thread(() -> {
while(1>0) System.out.println("You can't stop the train");
});

>architects
Those people who thought generating code from UML was a great idea?

that's not the point, you cant stop while(true) without using the stop method (if there is no waiting line inside)

Know the concurrent api, fag

check out, java concurrent,..

>>using 1>0 instead of true

>>>using 1>0 instead of true
jdk won't let you use while(true) for a reason.

>implying it won't compile to the same bytecode

>why do edgy NEETs shit on stuff used in the real world?

Gee, I wonder.

implement RunnableFuture, then use
while(!this.isCancelled(){})

>concurrent
>implying I hevent tried this with concurent
You won't stop 1 thread other than main if it's on while(true) and there is no Thread.wait() inside the loop.

I'm loading class file in the run time with java.lang.reflect, that's why I need to deal with while(true)...

It depends on the task.
Java is OK since it has powerfull threads, but for real concurrent programming (with multiple cores) there are many better solutions.


Industry standards are not set in stone.
And they aren't necessarily the best solution.

It's up to us to provide good solutions for future generations, the industry will follow sooner or later.


But Java really is shit.
It carries on all the design mistakes of it's past ("muh backwards compatibility").

Hopefully Scala will replace Java within the next 10 years.

Clojure > Scala

Depends what you are doing.

>the only argument for using Java is "muh industry standard"

Personally I like Clojure, yes. And I'm not particulary a Scala fanboy either. I just think it's more realistic to replace Java with Scala.


Scala looks almost like Java and you can even use it in a "Java way". But it has a lot of tiny nice features that make it way smoother than Java.

So many Java guys try out Scala and get adicted because of all the nice litte places, where Scala is better.

Also it doesn't look to unfamiliar to Java devs. Try to suggest using Erlang for a big concurrent project - the CEOs will just laugh hysterically because it's beyond their grasp than anything so "java unlike" could actually be usefull.

Also clojure, it just looks too "lispy".


But Scala is another story, since it's disguised as an "almost java" langauge, but has very powerfull stuff hidden within (i.e. the whole functional approach). So you can make an easy shift, allowing Java devs to save face while also bringing them the joy and power of functional programming and a more mature language.


Of course Java won't vanish in a few years, but if 50% of all companies switched to Scala that would already be an amazing way to enhance industry standards to the next level.

Industry Standard Shit.

of course
check this out
open System
open System.Net
open Microsoft.FSharp.Control.WebExtensions

let http url =
async { let req = WebRequest.Create(Uri url)
use! resp = req.AsyncGetResponse()
use stream = resp.GetResponseStream()
use reader = new StreamReader(stream)
let contents = reader.ReadToEnd()
return contents }

let sites = [“bing.com”;
google.com”;
yahoo.com”;
search.com”]

let htmlOfSites =
Async.Parallel [for site in sites -> http site ]
|> Async.RunSynchronously


shit is so easy

tfw semaphores

This. The issue is state.

OOP is ALWAYS a bad idea, fucking ALWAYS, even the logic behind it is waful

This is too reasonable. You better go to a difference website.