[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Is using OOP for concurrent/parallel programming a bad idea?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 39
Thread images: 1
File: jcip-cover.jpg (55 KB, 379x498) Image search: [Google]
jcip-cover.jpg
55 KB, 379x498
Is using OOP for concurrent/parallel programming a bad idea?

Some Haskellfag told me that's the case.
>>
>>54860992
>Haskell
You can safely ignore everything he says.
>>
>>54861040
POO
>>
>>54860992
Using Java is a bad idea
>>
>>54860992
no it's not.
see: Akka framework
>>
>>54860992
Haskell is a dead meme.
>>
>>54861051
IN
>>
>>54861080
java is industry standard, like it or not.
>>
>>54861103
>>54861105
LOO
>>
>>54861089
Seconding Akka. Best you can get.
>>
>>54861051
Why does /g/ label all the widely used, industry standard languages as pajeet-tier and praise NEET-tier shit like haskell?
>>
>>54861051
>>54861103
>>54861119
Ebin memes, upvoted.
>>
>>54861128
>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
>>
>>54860992
>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.
>>
>>54860992
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()...
>>
>>54861128
because /g/ is all basement dwellers who don't work in the industry.

>>54861220
>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.
>>
>>54860992
Just don't mutate
>>
>>54861374
>thread.start();

the same bullshit with while(true) thread using ExecutorService, Future and the rest of concurrency java shit.
>>
>>54861374
>2016
>not using functional interface
Thread thread = new Thread(() -> { 
while(1>0) System.out.println("You can't stop the train");
});
>>
>>54861376
>architects
Those people who thought generating code from UML was a great idea?
>>
>>54861434
that's not the point, you cant stop while(true) without using the stop method (if there is no waiting line inside)
>>
>>54861374
Know the concurrent api, fag
>>
>>54861374
check out, java concurrent,..

>>using 1>0 instead of true
>>
>>54861511
>>>using 1>0 instead of true
jdk won't let you use while(true) for a reason.
>>
>>54861511
>implying it won't compile to the same bytecode
>>
>>54861128
>why do edgy NEETs shit on stuff used in the real world?

Gee, I wonder.
>>
>>54861374
>>54861433
>>54861466
implement RunnableFuture, then use
while(!this.isCancelled(){})
>>
>>54861489
>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)...
>>
>>54860992

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.


>>54861105

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.


>>54861128

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.
>>
>>54861875
Clojure > Scala
>>
>>54860992
Depends what you are doing.
>>
>>54861105
>the only argument for using Java is "muh industry standard"
>>
>>54861903

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.
>>
>>54861105
Industry Standard Shit.
>>
>>54860992
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 = [“http://www.bing.com”;
“http://www.google.com”;
“http://www.yahoo.com”;
“http://www.search.com”]

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


shit is so easy
>>
tfw semaphores
>>
>>54861414
This. The issue is state.
>>
>>54860992
OOP is ALWAYS a bad idea, fucking ALWAYS, even the logic behind it is waful
>>
>>54861224
This is too reasonable. You better go to a difference website.
Thread replies: 39
Thread images: 1

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.