[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]

Phoenix/Elixir

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: 13
Thread images: 1

File: phoenixframework-logo.png (43KB, 1473x753px) Image search: [Google]
phoenixframework-logo.png
43KB, 1473x753px
How is it different from Django/Python and Rails/Ruby?
>>
Far better concurrency. Python has the GIL and Ruby has something similar I believe.

inb4 "import multiprocessing"
>>
>>56117265
>Far better concurrency

Is that relevant in an MVC web framework?
>>
>>56116186
Elixir as a language is built on a very different paradigm (actor model, process-oriented) than Ruby or Python. Most of what >>56117265 describes stems from this.

Phoenix as a framework is far less opinionated than either Rails or Django, and plays better with the rest of the whole Erlang+Elixir ecosystem.

The "best practices" for contemporary deployment and ops are fairly different as well. For anyone who has spent the last 5 years going down the containerized microservices rabbit hole, deploying BEAM languages feels like an entirely new set of laws of physics.
>>
>>56117945
>Is that relevant in an MVC web framework?
MVC has nothing to do with concurrency. MVC is not your app. MVC is just a pattern, one of many that you must use to achieve whatever you are seeking you build.

And yes, concurrency (separate from parallelism!) matters. It allows you to take on more web requests faster with the same amount of server resources. In this case, by several orders of magnitude.
>>
>>56117945

You're an idiot.
>>
>>56117945
Yes. That Scala's web frameworks Play and Scalatra are so successful despite the language definitely being third-rate in popularity is mostly due to the extremely good concurrency offered (backed by Akka).

It also has ursurped a good part of what Hadoop did with Spark, which again ties into what are usually big enterprise stacks ending on many ends somewhere in the interwebs.


Every other heavier web framework definitely wants the same now.
>>
>>56116186

Bump for answer..
>>
>>56117265

Ruby also has the GIL, but they want to replace it in the next Version.


>>56116186

The difference is first and foremost the Elixir language. Like Scala compiles to Java bytecode, Elixir compiles to Erlang bytecode.

Erlang is not that fast for single tasks, but it's pretty cool when you need many processes (thousands up to millions), because it has very light weight processes and a good communictaion modell between those. Also Erlang being a functional language has immutable values, which makes concurrency easier.

Basically Rails or Python are totally fine for everything you'll ever build. But if you need a lot of users (think a Top 500 internet site) and highly avalibility, Phoenix has advantages. Also Phoenix is a little faster than Rails, but it's not hard to be faster than Rails.. :)
Rails on the other hand has far more libraries and a richer ecosystem. Phoenix is mature for its age, but it is still pretty young.

So basically it's a matter of taste (do you prefer Elixir, Ruby or Python), unless you have a real big site.
>>
>>56122647

As a language comparison, here's good ol' quicksort - in a minimalisitc way:

# Python
def qsort(arr):
if len(arr) <= 1:
return arr
else:
return qsort([x for x in arr[1:] if x<arr[0]]) + [arr[0]] + qsort([x for x in arr[1:] if x>=arr[0]])

# Ruby
def qs(l)
return [] if (x,*xs=l).empty?
less, more = xs.partition{|y| y < x}
qs(less) + [x] + qs(more)
end

# Elixir
def sort([head | rest]) do
{before, after} = Enum.partition(rest, &(&1 < head))
sort(before) ++ [head] ++ sort(after)
end

# Erlang
sort([Pivot|T]) ->
sort([ X || X <- T, X < Pivot]) ++ [Pivot] ++ sort([ X || X <- T, X >= Pivot]);
sort([]) -> [].



As you see, Python and Ruby can also do things short, but it's a little more "hacky" and sometimes sublte what happens where.

In a functional language like Elixir/Erlang thigs are sometimes "clearer". But it's a matter of what you prefer, all those are great.
>>
>>56122717
whats the point of using a simplistic language that's supposed to be easier to read if you write it in a way thats harder to understand what's going on?
>>
>>56122803

What language do you specifically mean?

Please mind that a C or Java implementation would always be much longer..


Python and Ruby use C objects underneath, you code much less and are a tad slower.

Elixir and Erlang run on the Erlang Virtual machine. You can even precompile Elixir, but unfortunately that makes short code not much faster, since you always need some startup time for the Erlang virtual machine - a similiar porcess works in Java. But the JVM is not meant for highly availible concurrency, the Erlang VM is.
>>
>>56122938
I haven't used the other languages so I can only talk about python.
One of the objectives of python is to make code easiert to read, e.g forcing tabs. So we are not worrying about the speed here.

When you do something like this:

return qsort([x for x in arr[1:] if x<arr[0]]) + [arr[0]] + qsort([x for x in arr[1:] if x>=arr[0]])


It's not going to be easier to read, the line is too long
Is it more efficient that way? I don't know but I don't think so since it's using recursion but again I don't care about the speed here.
I have encountered almost totally incomprehensible scripts because whoever who wrote it tried to use the fewer number of characters possible to implement it.
Who cares if you need 10 more lines of code? What I want is to be able to work on it months after I wrote it and to be able to detect bugs quickly.
Thread posts: 13
Thread images: 1


[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.