_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
Hi Joe,
I did try nodejs some time ago and I can tell from that experience that regards to development performance and confortable programming, nodejs is very nice, it is very intelligent way to program, it is faster too, but I have to tell you this, nodejs as a program language is very close or even more nicely than Erlang, but as a technology it is the biggest crap I ever taste, sorry about that, everything there explode and you have no control at all of the explodes, if the stack ran out; and it does quickly and easily, it just ran out without any possible solution and the system goes down inevitably, I came out to think that you cannot program a serious thing over that! Despite of that simple fact, all other is fine, nicely coding programming I think.
Best regards,
Ivan.
I came out to think that you cannot program a serious thing over that! Despite of that simple fact, all other is fine, nicely coding programming I think.
Can you really compare the two? :)
--
Remember to send a copy to erlang (dot) questions (at) erlang (dot) org when posting.
---
You received this message because you are subscribed to the Google Groups "Erlang Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erlang-programm...@googlegroups.com.
To post to this group, send email to erlang-pr...@googlegroups.com.
Visit this group at http://groups.google.com/group/erlang-programming.
For more options, visit https://groups.google.com/d/optout.
--Studying for the Turing test
--
Remember to send a copy to erlang (dot) questions (at) erlang (dot) org when posting.
---
You received this message because you are subscribed to the Google Groups "Erlang Programming" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erlang-programm...@googlegroups.com.
To post to this group, send email to erlang-pr...@googlegroups.com.
Visit this group at http://groups.google.com/group/erlang-programming.
For more options, visit https://groups.google.com/d/optout.
Are you testing against single threaded node or one of the clustered versions or multiple processes or?
Hi all,For this to be comparable both Erlang and Node.js need to be runningsimilarly. I don't see how a concurrent Erlang runtime with multiple schedulerscan be compared with a single-threaded Node.js implementation objectively orfairly...
It's actually the programming models I want to compare and not theperformance - what worries me about node is the run-to-completionsemantics of event callbacks - namely that a long-running event will blockthe server preventing short computations from being performed. Theshort jobs which could be done immediately have to wait until the long jobshave finished - this should reflect in the average latencies of a request.
In summary though, I believe that at a "whole-systems" level, node has no particular performance advantage (assuming standard CPU architecture) that would make me choose it over Ruby, Java or Erlang (all of which I find easier to program, for different reasons).
Node is very popular so I'm trying to understand what it is about node that is attractive.
Not quite. V8 is a javascript engine, as is Rhino, as is SpiderMonkey,
as is WebKit, etc. In particular, V8 is the javascript engine for the
Chrome browser. node wraps glue around it to create a server-side
environment.
A couple of references from http://nodejs.org/about/ - both 'intro to
node.js' type slide decks from Ryan Dahl - who is kind of the ultimate
authority, in that he's the author of node:
Slide 2 (right after the cover) of http://nodejs.org/jsconf2010.pdf
starts with this statement: "node.js: Evented Server-side Javascript"
A slightly earlier version
(http://s3.amazonaws.com/four.livejournal/20091117/jsconf.pdf) says this
(again, slide 2):
node.js
in brief:
Server-side Javascript
Built on Google’s V8
Evented, non-blocking I/O. Similar to
EventMachine or Twisted.
CommonJS module system.
8000 lines of C/C++, 2000 lines of
Javascript, 14 contributors.
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
_______________________________________________
I think the understanding of how node became so popular, is because the one who invented node, he had one goal in mind, to take the advantage of the already well formed and big javascript community, javascript became so popular it had its reasons, but it was just a client-side technology!, so what about a server side technology that complements that already fully operational client-side tec? Using the same community? noting to create, noting to grow, only putting in the eyes of the fools another foolish. That's what nodejs is.
Now imagine the turn of programming technics if all browser companies could include interpretation for Erlang natively? And you could communicate two Erlang's nodes one in the client (browser) another in the server as the same way as Erlang always do, Even so without having that big community, I'm sure the entire web community will be forced to see that new tec that is in all browsers and have the same counterpart in the server
Best,
Ivan.
-----Mensaje original-----
De: erlang-quest...@erlang.org [mailto:erlang-quest...@erlang.org] En nombre de Miles Fidelman
Enviado el: martes, 17 de junio de 2014 10:26 p.m.
Para: Erlang
Asunto: Re: [erlang-questions] node.js vs erlang
Hi all,
Paulo F. Oliveira says: “…At the moment, though, I enjoy prototyping with Node.js and implementing with Erlang. :)…”
Yes Paulo, I definely think that it is what nodejs is about, it is very nice to prototyping things because of the code, easily to understand and program; a different way of thinking (no so nice like Erlang but.. still..), but noting seriously such as what you can do with Erlang you can build with nodejs I think.
Best,
Ivan.
De: erlang-quest...@erlang.org [mailto:erlang-quest...@erlang.org] En nombre de Paulo F. Oliveira
Enviado el: martes, 17 de junio de 2014 09:07 a.m.
Para: Joe Armstrong
CC: Greg Young; Juan Facorro; Erlang; erlang-pr...@googlegroups.com
Asunto: Re: [erlang-questions] node.js vs erlang
"Node is very popular so I'm trying to understand what it is about node that is attractive."
On 06/18/2014 09:39 AM, Aaron J. Seigo wrote:
> comparing with cowboy, the differences are glaring. for instance, in the
> "getting started" guide for cowboy:
>
> * we live in the microwave popcorn and 10-minutes-is-a-long-video-on-youtube
> age. yet the first FOUR sections are not about cowboy at all, but talking about
> the modern web and how to learn erlang. as someone moderately familiar with
> the web, i don't care about this. *just let me get started already!* if i'm
> reading the getting started guide for cowboy, i probably don't need to be sold
> on either the modern web OR erlang.
I'm not sure why you call it a "getting started guide" all over your
email. It's the user guide. It may have one "getting started" chapter,
but its goal is not to get people started, but to be a complete guide.
This includes not only practical examples but also theory. Why theory?
Well everyone coming to Cowboy isn't a web developer, or even an Erlang
developer. Some of my users were happy enough that these chapters were
in the guide that they contacted me directly to tell me they liked them.
If you are a web developer, then why are you reading these chapters? Do
you read the documentation for every computer you buy? Do you need to
learn how to put the power plug in to charge it? You probably don't need
that. But some people do, and that's why we put these "obvious" things
in the docs.
> * being a good, modern developer with the attention span of the average
> backyard squirrel i simply skipped straight to the "Getting Started" section.
> the FIRST sentence is this:
>
> "Setting up a working Erlang application is a little more complex than for
> most other languages. The reason is that Erlang is designed to build systems
> and not just simple applications."
>
> ... aaaaaaaand cowboy just lost me as a user. i don't WANT complex[1], and my
> application IS simple. so cowboy is not for me! right?
Well there's nothing we can do about that. We can't just write one file
and run a program on it. That's simply not how Erlang works. We have to
create an OTP application, compile, start the VM with the right paths
etc. That's not just Cowboy deciding to be more complex than nodejs,
that's how Erlang was designed.
And while it's improving (you should have seen things 4 years ago when I
started, the getting started in Cowboy is *immensely* simpler than it
would have been then), it'll never be as simple as nodejs. Because most
of the stuff in the getting started chapter is necessary as I'll explain
in a bit.
> * the rest of the "getting started" walks me through doing a ton of
> boilerplate stuff. it's nice to know how things work, but i'm a busy web dev
> (have i mentioned my lack of attention span yet? oh look, a peanut! and it's
> an event driven async peanut! yum! *runs off*). everything in that section
> ought to be boiled down to "run this one simple command and everything is done
> for you. click here to read about the gory details." and doing so should give
> me a fully functional application template that i can immediately start. that
> one command should probably take a simple config file with things like the app
> name and other variable details (such as which erlang apps to include in my
> awesome new project, including but also in addition to cowboy). basically, an
> npm-for-erlang.
The next erlang.mk version will make it a little easier by generating a
base project (using templates, as you say). But that will not change the
getting started chapter much, as we will still have to explain things.
Instead of saying "create" it will say "edit", basically.
It may sound like a lot for someone with as little attention span as
you, but going through these steps saves you an immense amount of time
later on. If Erlang beginners start using releases immediately, we win.
They will not have to suffer going through hoops like we did to get to
that point. They will not have to fiddle with paths, or make start
scripts, or deal with complex deployment issues, or anything that we
struggled with for years. It *is* a big step, and we probably can't
reduce it much more, but it's an incredible time saver.
But of course impatient people will prefer to waste their time by
missing out on it.
And to be honest if we weren't doing this then we would have to explain
how to write a start function, start erl with the -s option and make a
start script for frequent use. It wouldn't be simpler, it would just be
different, and we would just miss an opportunity to teach beginners "the
right way" from the start.
> oh, and bonus points if there is a file created just for route definitions which
> would then be automatically included by the foo_app.erl to be passed to
> cowboy_router:compile. having a "well known" place to define routes will
> standardize cowboy using applications and allow the starting dev to focus on
> what they care about (routes and handlers) while ignoring the details like the
> app module. yes, yes, eventually they'll likely want to dig into that as well,
> but not at the beginning. (this is an area that cowboy+erlang could be even
> better than express+node.js)
Cowboy isn't a Web framework. There's nothing to standardize. It's a
thin HTTP layer implementing the various HTTP specs. That's it. Yes,
routing is also part of the spec, as it is a way to map URIs to
resources which is well covered by the spec.
There's tons of Web frameworks built on top of Cowboy if you want
standards. Everything in Cowboy is done by calling a function (or Cowboy
calling one of your functions). The application module is simply the
only place where you can run code at startup, so we have to cover it.
Besides I don't see much difference between explaining how to run code
in this module vs explaining the structure of a configuration file (it's
harder to do the latter really).
> * i couldn't find the bragging section of the docs. ;) more seriously, the
> getting started guide tries to sell me on the modern web and erlang's place in
> it, but how about a fun little one-pager that backs up the claims made in the
> main README: "Cowboy is a small, fast and modular HTTP server written in
> Erlang." and " It is optimized for low latency and low memory usage". show me
> the money^Hmeasurements! a simple set of charts showing how many simultaneous
> connections can be handled and what kind of latencies app the developers
> achieve on regular ol' hardware, along with a LOC-you-need-to-write-for-a-
> barebones-app count would help convince people and would be the thing that
> would get passed around on stackoverflow, g+, twitter, etc. when justifying /
> recommending cowboy.
Would you believe me if I told you Cowboy is capable of handling
millions of concurrent Websocket connections on a middle sized server,
with *no impact* on latency? And would you believe me if I told you I do
not have the slightest idea what the upper limit for the number of
connections Cowboy can actually handle *is*? Because that's the truth.
This is in large part due to Erlang, Cowboy mostly tries to be careful
about memory use, and could do a better job at it.
But still, how do you even brag about a difference that big with other
platforms, and make people actually believe you?
Besides, if you look at the benchmark of the week, they're still all
focused on glorified "hello world" measuring requests per second. Cowboy
obviously can't compete there, as these are won by JITs not by the
underlaying code. Not to mention these benchmarks are the most
misleading and useless kind you can ever write.
--
Loïc Hoguin
http://ninenines.eu

Yes Paulo, I definely think that it is what nodejs is about, it is very nice to prototyping things because of the code, easily to understand and program; a different way of thinking (no so nice like Erlang but.. still..), but noting seriously such as what you can do with Erlang you can build with nodejs I think.
That's stretching it. All the documentation and examples are in that
section of the readme. It's not particularly ordered either, some people
prefer starting with examples, others a reference, yet others a guide.
And in those people will need one or another element of information.
> i'm not trying to tell you that what you've done is empirically wrong, but how
> non-optimal results may come from what is there right now in the way it is
> presented. whether you choose to pick anything useful from that is obviously
> up to you :)
>
> specifically, i'd suggest that a more streamlined "getting started" guide that
> gets straight to the "your first cowboy server in one command" story would be
> valuable. it is something that the (quite nice) user guide does not provide,
> and which is something most people i know who are in the process of casually
> evaluating new frameworks are really helped by.
I don't really care about people who casually evaluate things. Why would
I? I never did, and that never stopped Cowboy from getting new users.
I care about my current users. All the work I do is for the sake of
current users. Even the theory stuff was added at the demand of current,
albeit beginner, users. All the work I do now is entirely based on
feedback I receive.
I'm not sure why people would use the getting started chapter to
casually evaluate Cowboy though. There are a dozen or more prebuilt
examples that can be ran with a single command. They range from hello
world to Websocket to REST services. The getting started isn't there to
replace them, it's there to get people who have decided to use Cowboy,
well, started.
> i completely understand. however, you don't need to confront the potential
> adopter with that rather scary proclamation as the *very first sentence*.
Maybe not. But it's easier to send a patch than tell completely
unrelated people it's wrong to do that in a completely unrelated topic.
> now, as for "you can't just have one file" that's obvious true. but you *can*
> have a helper app that creates the file structure and basic files described in
> the (very clear!) step-by-step "getting started" section. i know because i
> have written and used exactly such tools many times in the past which generate
> significantly more complex boilerplate.
We'll still have to describe it though, so it makes little difference to
the text, as I said before. It'll just save a couple keystrokes to the
user. Which is obviously good, but not to die for.
>> it'll never be as simple as nodejs.
>
> it doesn't have to be. "make everything as simple as possible, but no
> simpler," so said Einstein. dude was right. :) setting up a first "make me a
> toy demo app" with cowboy is not as simple as it could be. it does not need to
> be as simple as nodejs, but that particular step can be a lot simpler than it
> currently is.
Then you should explain how. Send a patch showing how you think it
should be done, for example. At least we'll know exactly what can be
improved.
>> getting started chapter much, as we will still have to explain things.
>> Instead of saying "create" it will say "edit", basically.
>
> not really ... the getting started page can be condensed a LOT by skipping
> over details until the user has started the dummy app for the first time.
>
> THEN it can start saying "now edit this file..." the reward (seeing a running
> cowboy app) is delayed; move that up a bit and then after that first hit of
> success start laying in the details.
But you need to edit the file to get it working. I'm not sure what
you're getting at there.
> you can do that by giving me something that works immediately with as little
> effort, and explanation, as possible. if i can point my web browser to
> localhost:8080 after 30s and have a "hello, partner!" message appear i am
> much, much more likely to stick around for the explanations of how that just
> happened.
That's what the examples are for. You can even copy paste an example and
add your things directly if that's what you want. Many people start this
way. But it doesn't fit everyone's way of learning things.
You're taking a small part of the documentation like it's the only thing
Cowboy has. It's not. Different people use different things to
experiment or get started. I think we cover a pretty large part of the
population with what Cowboy offers.
>> And to be honest if we weren't doing this then we would have to explain
>> how to write a start function, start erl with the -s option and make a
>> start script for frequent use. It wouldn't be simpler, it would just be
>> different, and we would just miss an opportunity to teach beginners "the
>> right way" from the start.
>
> the first job is not to teach someone the right way.
But teaching them the wrong way is more immediate work for them. And
completely unrelated to actually learning Cowboy. I'm not sure what
you're getting at there.
> one way to do that is to provide a quick and easy "win" with as few steps as
> possible. then once they've gotten to a first quick success, dirty and ignorant
> of the details, start them through the process of explaining how everything
> works and why.
That's actually what the getting started is. It doesn't actually explain
anything. It is just a step by step to making a Cowboy based
application. I'm not sure where you see details in there.
> when i followed the cowboy user guide's "getting started" section, my first
> thought was "where should i put another route? should i just plonk it in
> hello_erlang_app:start/2, or is it cleaner to put it somewhere else ...?"
It tells you where to put them. At no point will you see the
documentation, examples or even me saying to put the routes anywhere
else. I'm not sure what made you want to put them in a different file,
perhaps habit from using other things.
The only thing I would ever do different compared to that is to make a
function in that same module returning the routes, but then only if I'll
ever need to update them live. And that'd be a very advanced subject
that is not covered in the guide at this point.
> so i'm not suggesting cowboy should be a complete web framework, but that it
> should present what it already presents in a way that is more structured and
> therefore more approachable to the average new-comer. because that is who will
> be reading / using that part of the documentation :)
I'm not sure how going from "everything is functions" to "everything is
functions except these things that are configuration files" is going to
help anyone. Keep it simple.
> yes, many (most) people really struggle with learning that much. for people
> who pick things up quickly, that seems very alien, but it's just how it is.
> there is no changing everyone else ;)
Perhaps, but then it's the first such feedback I get. And I have both
smart and dumb users. (No offense! I'm definitely in the dumb category
myself.)
It sounds more and more that it's just unusual for you that there's no
configuration file and it's all done using functions. Well that's not
going to change anytime soon because that's kind of the point.
> in the case of the cowboy, i don't think you'd need to compare #s with other
> frameworks. simply show some numbers of real-world tests you (or your minions
> :) have done that demonstrate performance. just show the true capabilities of
> cowboy/erlang clearly as in the above two examples and people will accept it.
> they do so every day for other projects / products.
I could. But it takes a lot of time. And other things take precedence,
like finishing the guide and such. If anyone wants to put numbers out
for Erlang and Cowboy though, be my guest.
It's not obvious anyone would care anyway. Whatsapp published a few
times their peaks, having almost 3 million concurrent connections on one
server using Erlang, and we didn't really see an influx of new Erlang
users because of that. Most people don't play in that category.
> so benchmark what matters to you. people who care about those things will
> respond positively, and those who don't might start realizing that they ought
> to care about those things ;)
I don't really benchmark anymore. I just do when I want to make sure a
change didn't kill performance. Benchmarks don't matter much to me.
There's more important things to take care of before I go back to
benchmarking.
> hell, write a paragraph about how you aren't benchmarking synthetic "hello
> world" performance because that only measures the benefit of having a JIT based
> system rather than the real world performance of a system (JIT or not) and
> include that on your page of numbers. :)
I'm not sure how to write a benchmark that does not give an unfair
advantage to a JIT based system. I'm not even sure how to write a good
benchmark. They're a nice tool to have a general idea that what you did
isn't worse than what you had before, but that's all they are.
Okay I wanted to skip this thread entirely but you mentioned Cowboy and said weird things about it so I'll bite.
"Setting up a working Erlang application is a little more complex than for
Well there's nothing we can do about that. We can't just write one file and run a program on it. That's simply not how Erlang works. We have to create an OTP application, compile, start the VM with the right paths etc. That's not just Cowboy deciding to be more complex than nodejs, that's how Erlang was designed.most other languages. The reason is that Erlang is designed to build systems
and not just simple applications."
... aaaaaaaand cowboy just lost me as a user. i don't WANT complex[1], and my
application IS simple. so cowboy is not for me! right?
And while it's improving (you should have seen things 4 years ago when I started, the getting started in Cowboy is *immensely* simpler than it would have been then), it'll never be as simple as nodejs. Because most of the stuff in the getting started chapter is necessary as I'll explain in a bit.The next erlang.mk version will make it a little easier by generating a base project (using templates, as you say). But that will not change the getting started chapter much, as we will still have to explain things. Instead of saying "create" it will say "edit", basically.
* the rest of the "getting started" walks me through doing a ton of
boilerplate stuff. it's nice to know how things work, but i'm a busy web dev
(have i mentioned my lack of attention span yet? oh look, a peanut! and it's
an event driven async peanut! yum! *runs off*). everything in that section
ought to be boiled down to "run this one simple command and everything is done
for you. click here to read about the gory details." and doing so should give
me a fully functional application template that i can immediately start. that
one command should probably take a simple config file with things like the app
name and other variable details (such as which erlang apps to include in my
awesome new project, including but also in addition to cowboy). basically, an
npm-for-erlang.
It may sound like a lot for someone with as little attention span as you, but going through these steps saves you an immense amount of time later on. If Erlang beginners start using releases immediately, we win. They will not have to suffer going through hoops like we did to get to that point. They will not have to fiddle with paths, or make start scripts, or deal with complex deployment issues, or anything that we struggled with for years. It *is* a big step, and we probably can't reduce it much more, but it's an incredible time saver.
But of course impatient people will prefer to waste their time by missing out on it.
And to be honest if we weren't doing this then we would have to explain how to write a start function, start erl with the -s option and make a start script for frequent use. It wouldn't be simpler, it would just be different, and we would just miss an opportunity to teach beginners "the right way" from the start.
--Loïc Hoguin
http://ninenines.eu
The setup is more complex but the way we get there isn't. Have you read
the getting started chapter[1]? The release part is smaller than it
would take to explain "erl -run" or "erl -s": we don't have to write
extra code for it, we don't have to manually setup paths, we don't have
to deal with reltool, and so on. It's literally "create relx.config, put
this in it, run make again". Bam you got a release. That part can't get
any simpler.
Erlang *is* more complex to use than many other languages (it is still
simpler than C, C++ and the like though). Either you do things manually
by downloading dependencies manually and such, or you use a build system
like erlang.mk (or rebar) to automate things which requires you to
create an OTP application.
Because erlang.mk automates the use of relx to build releases it is
actually simpler to make a release than manually setup paths and
whatnot. We just have to create the one file! We don't deal with reltool
here, creating the release is *really* easier than not.
There's no simpler alternative to all that in the Erlang ecosystem. We
will be able to make it a little simpler by having templates instead of
making the user copy things, but the getting started chapter will not go
down in length dramatically because of this.
We could remove all explanations to make it perhaps half the size it
currently is, but then we removed all explanations. It's a chapter about
getting started, it's supposed to provide initial pointers to users, not
just get them to run an example and then ask themselves "now what?". We
have actual examples for people that want that already.
I am not even sure what triggers all these good comments about the
nodejs documentation. Sure it has a 6 lines and 1 command example on its
front page. There's no denying that. Then what? A link to API docs. I
have *no* idea how people manage to learn how to use it. Surely by using
other resources than these, because while I'm confident I could run the
front page example quickly, I am also confident that's about all I could
do with it for a rather long time until I manage to figure out how to do
anything meaningful, if I were to only use the official docs.
[1] http://ninenines.eu/docs/en/cowboy/HEAD/guide/getting_started/
--
Loïc Hoguin
http://ninenines.eu
That's another thing I don't understand. People always say nodejs has
lots of users. Yet I haven't heard of a single success story.
Erlang, you don't have to look far. Most big companies use Erlang. Half
the world's phone communications go through Erlang. You can find Erlang
in space. Heck even npm, the nodejs package manager, uses Erlang.
So my question then is: on what is the hype built? It certainly doesn't
seem to be built on the capabilities of the platform. I doubt it's
because it has one short example on its front page either. It probably
*helps* but it's not *why* there's hype about it.
If you want to attract hypey people you have to build hype around
Erlang, and that's much harder because you can't just hop in, everything
is different and you have to restart learning from scratch. As simple as
an example you might put on its front page, it will not get the point
across as well as one for a familiar language.
On 19/06/2014 09:52, Loïc Hoguin wrote:
> On 06/19/2014 08:50 AM, Aaron J. Seigo wrote:
>> by doing those 3 things, nodejs can have a steep learning curve and still
>> succeed in getting lots of users.
>
> That's another thing I don't understand. People always say nodejs has
> lots of users. Yet I haven't heard of a single success story.
>
> Erlang, you don't have to look far. Most big companies use Erlang. Half
> the world's phone communications go through Erlang. You can find Erlang
> in space. Heck even npm, the nodejs package manager, uses Erlang.
>
> So my question then is: on what is the hype built? It certainly doesn't
> seem to be built on the capabilities of the platform. I doubt it's
> because it has one short example on its front page either. It probably
> *helps* but it's not *why* there's hype about it.
>
> If you want to attract hypey people you have to build hype around
> Erlang, and that's much harder because you can't just hop in, everything
> is different and you have to restart learning from scratch. As simple as
> an example you might put on its front page, it will not get the point
> across as well as one for a familiar language.
>
--
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development
iv...@llaisdy.com
www.llaisdy.com
llaisdy.wordpress.com
github.com/llaisdy
www.linkedin.com/in/ivanuemlianin
festina lente
============================================================
What is wrong with that? Cowboy is aimed at people who know Erlang.
Rails is aimed at people who know Ruby.
Personally, I program in several languages, including Javascript. I
found node easy to write because of my Javascript experience, mostly
because of how callbacks are used. But I don't "only know Javascript".
> and (b) don't want to learn any other programming languages. For this
> market segment, I can certainly imagine nodejs is very exciting.
Eh?
I try to regularly evaluate new languages and platforms to use, and I
doubt I'm the only person who does that.
Node was exciting (to me) because it promised a nice solution to the
I/O-bound scenarios which (I think) Aaron described in pretty good
detail. "Event-driven, non-blocking I/O, server-side Javascript". Node
delivers on those fronts, just like it says it does. It doesn't matter
that there are better things out there (for some definition of better).
Yes, there is hype around node. And yes, it has problems too. But the
platform does have benefits.
Disparaging the platform or the people who use it seems less than
helpful. Helping aid in the understanding of how Erlang compares to node
may be more helpful.
- johnk
>
> On 19/06/2014 09:52, Loïc Hoguin wrote:
>> On 06/19/2014 08:50 AM, Aaron J. Seigo wrote:
>>> by doing those 3 things, nodejs can have a steep learning curve and
>>> still
>>> succeed in getting lots of users.
>>
>> That's another thing I don't understand. People always say nodejs has
>> lots of users. Yet I haven't heard of a single success story.
>>
>> Erlang, you don't have to look far. Most big companies use Erlang. Half
>> the world's phone communications go through Erlang. You can find Erlang
>> in space. Heck even npm, the nodejs package manager, uses Erlang.
>>
>> So my question then is: on what is the hype built? It certainly doesn't
>> seem to be built on the capabilities of the platform. I doubt it's
>> because it has one short example on its front page either. It probably
>> *helps* but it's not *why* there's hype about it.
>>
>> If you want to attract hypey people you have to build hype around
>> Erlang, and that's much harder because you can't just hop in, everything
>> is different and you have to restart learning from scratch. As simple as
>> an example you might put on its front page, it will not get the point
>> across as well as one for a familiar language.
>>
>
Okay I wanted to skip this thread entirely but you mentioned Cowboy and said weird things about it so I'll bite.I'm not sure why you call it a "getting started guide" all over your email. It's the user guide. It may have one "getting started" chapter, but its goal is not to get people started, but to be a complete guide. This includes not only practical examples but also theory. Why theory? Well everyone coming to Cowboy isn't a web developer, or even an Erlang developer. Some of my users were happy enough that these chapters were in the guide that they contacted me directly to tell me they liked them.
On 06/18/2014 09:39 AM, Aaron J. Seigo wrote:
comparing with cowboy, the differences are glaring. for instance, in the>
"getting started" guide for cowboy:
* we live in the microwave popcorn and 10-minutes-is-a-long-video-on-youtube
age. yet the first FOUR sections are not about cowboy at all, but talking about
the modern web and how to learn erlang. as someone moderately familiar with
the web, i don't care about this. *just let me get started already!* if i'm
reading the getting started guide for cowboy, i probably don't need to be sold
on either the modern web OR erlang.
If you are a web developer, then why are you reading these chapters? Do you read the documentation for every computer you buy? Do you need to learn how to put the power plug in to charge it? You probably don't need that. But some people do, and that's why we put these "obvious" things in the docs.Well there's nothing we can do about that. We can't just write one file and run a program on it. That's simply not how Erlang works.
* being a good, modern developer with the attention span of the average
backyard squirrel i simply skipped straight to the "Getting Started" section.
the FIRST sentence is this:
"Setting up a working Erlang application is a little more complex than for
most other languages. The reason is that Erlang is designed to build systems
and not just simple applications."
... aaaaaaaand cowboy just lost me as a user. i don't WANT complex[1], and my
application IS simple. so cowboy is not for me! right?
We have to create an OTP application, compile,
That's not just Cowboy deciding to be more complex than nodejs, that's how Erlang was designed.
Joe, your one file example is longer than my many files getting started,
not to mention completely cryptic. The shebang up there isn't something
you can just drop on people, you have to explain it. You also have to
say why you have an infinite receive and how to stop the program. Plus,
doing this you'd also have to explain them that they have to download 3
different projects manually and to put them in the appropriate folder.
And of course, the worst is that by taking this one file example, people
immediately get stuck. How do they add a second handler? I personally
have no idea how to go from that one handler escript to something bigger.
> 2) make a packed escript that packs all the compiled code into a
> single file
> rebar is a good example of this
That script takes an OTP application and bundles it into one escript. It
makes little difference with taking an OTP application and generating a
release, except the release is a lot more useful for servers.
> Erlang was not designed to be complex - the primitives in Erlang
> (spawn_link, trap_exits, etc.) were designed to be as simple as possible
> and were intended to be called from library routines.
I didn't say Erlang was designed to be complex. I'm saying running the
Erlang VM is of higher complexity than dropping a PHP file into a folder
or running nodejs myfile.js. And yes, that's true even if you use escripts.
Hey Joe
Node is very popular so I'm trying to understand what it is about node that is attractive.
Lots of people already know js, so it seems an easy platform to get in.What I love about node:
- npm
- modules ecosystem
- easy to deploy
- easy to start: you can use js, you do not need a specific ide, easy to install, good documentation, and examples
- tjhollowaychuck:
this guy have made lots of projects that makes your life easier: express, mocha, jade, supertest, commander.
Lots of examples, simplicity, elegant design and good documentation
https://github.com/visionmedia- You can develop applications very fast due to javascripts nature (dynamic typing, closures, easy introspection, prototype inheritance)
2014-06-17 14:41 GMT+02:00 Joe Armstrong <erl...@gmail.com>:
On Tue, Jun 17, 2014 at 2:05 PM, Darach Ennis <dar...@gmail.com> wrote:
Hi all,For this to be comparable both Erlang and Node.js need to be runningsimilarly. I don't see how a concurrent Erlang runtime with multiple schedulerscan be compared with a single-threaded Node.js implementation objectively orfairly...
It's actually the programming models I want to compare and not theperformance - what worries me about node is the run-to-completionsemantics of event callbacks - namely that a long-running event will blockthe server preventing short computations from being performed. Theshort jobs which could be done immediately have to wait until the long jobshave finished - this should reflect in the average latencies of a request.I made a little experiment (a fibonacci server in erlang and node) and fired off1000 parallel requests to compute fib(N) with N a random number from 10..40.As I suspected many of the fib(10) events are blocked by ongoing computation offib(40) - this reflect in the latencies.
Node is about 1.6 times faster than Erlang - but the latencies for small computationsare terrible - Erlang never blocks so the response times are more predictable.And yes I know that fib can be offloaded to a background processor or parallelisedin JS with a bit of black magic - but manually converting a long lived computation intoa re-entrant non-blocking version is very difficult.
The node books say something like "make sure that callbacks run-to-completion quickly"I would say that complying with this advice is extremely difficult. It's very difficult to guesswhich computations will take a long time, and even if you know it's difficult to break them intosmall re-entrant chunks.
Node is very popular so I'm trying to understand what it is about node that is attractive.
npm for example, looks well engineered and something we could learn from. The nodeweb servers are easy to setup and run, so I'd like to see if we could make equallyeasy to use Erlang servers.
Performance is not a primary concern - easy of programming and correctness are.
Cheers/Joe
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions
I think that's highly debatable. At least from my perspective, Erlang
ISN'T more complex than many other languages, and is perhaps simpler,
when you factor in the entire ecosystem required to do any kind of
serious work.
For example, to get serious work done in C, you need to know about:
- a text editor or IDE - I wouldn't call emacs, or vim, or Eclipse
trivial to learn
- version control
- language details - including libraries
- program/application structure - header files, linking
- run-time environments and dependencies
- build system (anybody know an easy tutorial for gnutools?, and these
days add in Jenkins)
- packaging system(s)
- logging, monitoring hooks
- and probably stuff I've left out
Java is no different, but is maybe easier to pick up if you already know
all of the above for C:
- OOP is a new set of concepts (but not if you've been doing C++ or
Objective-C)
- you're still using emacs, or vim, or Eclipse
- you're still using git or svn (or switching to something similar)
- when it gets to everything else, there's pretty much a 1-1
relationship between things your familiar with and the new environment
(e.g., gnutools vs. maven, ant, etc.)
In once sense, Erlang is no different - "Hello, World" is easy, it's the
details and the ecosystem that require serious learning. In another
sense, it's different in several key respects:
- the core concepts are unfamiliar to many (functional programming,
actor model)
- the run-time environment is different
- the structure of applications is different (as is the tooling)
I.e., one is not simply learning the same concepts in new clothing. In
that regard, one does have to learn more (unless Erlang is the first
language you learn). But whether it's more complex is debatable (e.g.,
no header files to worry about, no automake, and so forth).
Miles Fidelman
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
_______________________________________________
It may be worth mentioning that in the survey results, Node.js does not show up as a strong alternative. The usual suspects wrt Erlang alternatives are Go, the JVM languages (largely Clojure and Scala), Haskell, and to a lesser extent Elixir.
One of the contributors to this thread described Node.js as "the biggest crap I ever taste" which, from my own non scientific experience, is not an isolated opinion. I don't know if it's worth investing a lot of energy in reverse engineering the popularity of this platform.
Btw here's the tag cloud for the Erlang language/framework alternatives:
http://www.gar1t.com/presentations/2014-06-10-euc/#slide-76
golang.org was cited many times as an outstanding resource for learning Go.
I didn't repeat but what I said was about getting started, and in
particular in a web development setting, where pretty much every other
platform just require you to drop a file in the right folder and you're
done.
Erlang is simpler than C for sure, and I don't know (nor care) about
Java but I wouldn't be surprised if it was simpler too. Only those
aren't really used for web development. (Some people do, but you're a
lot more likely to find a PHP web developer than a C/Java one, at least
in my experience.)
--
Loïc Hoguin
http://ninenines.eu
Except that's simply not true, unless you're talking about dropping HTML
files (maybe including JavaScript) into an Apache directory - and even
that assumes that Apache is already set up.
More commonly, we're talking about:
- select a platform (Drupal, Wordpress, Joomla, Plone), install (and,
guess what, not all that easy - particularly if you're wiring it up with
Apache)
- select and install a database
- configure the platform and database
- selection and configure modues
- define pages and behaviors through GUI interfaces
- and then we're into the world of custom module development
The underlying language doesn't enter into the picture at all, except for:
- install-time dependencies
- writing custom modules
- things that are external to the web-site such as database applications
At which point:
> Erlang is simpler than C for sure, and I don't know (nor care) about
> Java but I wouldn't be surprised if it was simpler too. Only those
> aren't really used for web development. (Some people do, but you're a
> lot more likely to find a PHP web developer than a C/Java one, at
> least in my experience.)
>
What exactly are we comparing here? Programming language <>
run-time-environment <> (web) platform <> development environment.
--
In theory, there is no difference between theory and practice.
In practice, there is. .... Yogi Berra
_______________________________________________
Could a large part of its success be explained by the fact that making anything in either .Net or Java takes such an amount of effort that something like Node is seen as a godsent (which in fairness for a lot uses it really is). Everyone of those devs knows the language well enough to get going.
-Mark
On 06/19/2014 01:06 PM, Joe Armstrong wrote:[snip huge file]
You can - Here is an example of a single file cowboy server that computes
fib(N) -
Joe, your one file example is longer than my many files getting started, not to mention completely cryptic.
Put this in a file. chmod it to u+x and run it
Then got to http://localhost:8124/fib?n=10
And fib(10) will be returned
The shebang up there isn't something you can just drop on people, you have to explain it.
You also have to say why you have an infinite receive
and how to stop the program.
Plus, doing this you'd also have to explain them that they have to download 3 different projects manually and to put them in the appropriate folder.
And of course, the worst is that by taking this one file example, people immediately get stuck. How do they add a second handler? I personally have no idea how to go from that one handler escript to something bigger.
That script takes an OTP application and bundles it into one escript. It makes little difference with taking an OTP application and generating a release, except the release is a lot more useful for servers.
2) make a packed escript that packs all the compiled code into a
single file
rebar is a good example of this
I didn't say Erlang was designed to be complex. I'm saying running the Erlang VM is of higher complexity than dropping a PHP file into a folder or running nodejs myfile.js. And yes, that's true even if you use escripts.
Erlang was not designed to be complex - the primitives in Erlang
(spawn_link, trap_exits, etc.) were designed to be as simple as possible
and were intended to be called from library routines.
Right then we are definitely not talking about the same thing, because
this part of the thread forked into Cowboy's getting started chapter
territory, which is exactly the beginners first steps with Cowboy.
I have no interest in a snippet as small as nodejs, because while
technically more or less possible, it would not at all be representative
of code people actually write.
Confusing beginners with that kind of snippet is not something I see as
any good.
--
Loïc Hoguin
http://ninenines.eu
So with all the complexity issues being talked about would a basic
'app generator' along the lines of yeoman
http://yeoman.io/learning/index.html not be a better fit?
On 06/20/2014 02:54 PM, Leonard Boyce wrote:
> 2) "What the hell is with the crazy 'defacto' indentation. I don't use
> or want to learn to use emacs, I'm perfectly happy with Sublime."
Why the hell are they not using Sublime? What's this 'defacto'
indentation thing you mention? Most people write Erlang in their
favorite editor. I use vim without any plugins myself.
> 3) "TDD is extremely painful. What should I be writing tests for?"
If it's painful then they're not doing it right. They should write tests
for exactly the things they test manually. Doesn't need to be more than
that at the beginning, tests can get added over time.
> 5) "No unicode aware/safe string library? wtf? Lists of integers?
> Binaries? Why in deities name does it have to be so convoluted?"
I'm not sure why they would say that. It's not like JS has good Unicode
support either. Erlang has a number of ICU bindings available if you do
need Unicode though.
> 7) "Dialyzer is dog slow"
Is it? Are they rebuilding the PLT all the time? It never takes more
than 10s to dialyze for me on the bigger projects (usually < 2s though).
Much faster than running tests (especially running tests by hand if
that's what they'd prefer doing).
> 8) "What's up with the documentation organization? Why do I have to
> use google to be able to find anything in the official docs?
> Navigating the docs is crazy, I feel like it's still 1998"
???
It sounds a lot like you/they're making their life harder than it should be.
--
Loïc Hoguin
http://ninenines.eu
It's not a holy war :) This thread has been going for quite a while
and unfortunately for a time warped into a 'cowboy complexity
criticism thread'.
All I'm trying to do is add to the conversation by providing anecdotal
evidence on pain points for those new to Erlang.
I believe there is always value in examining the opinions and
statements of others as they allow us to find ways to possibly
improve.
> On 06/20/2014 02:54 PM, Leonard Boyce wrote:
>>
>> 2) "What the hell is with the crazy 'defacto' indentation. I don't use
>> or want to learn to use emacs, I'm perfectly happy with Sublime."
>
>
> Why the hell are they not using Sublime? What's this 'defacto' indentation
> thing you mention? Most people write Erlang in their favorite editor. I use
> vim without any plugins myself.
They are using Sublime as that's their editor of choice.
When I started learning Erlang I was informed that the 'defacto'
standard for indentation is the indentation used by elang mode for
emacs as this was the primary erlang editor. Maybe I was misinformed,
but that became our coding standard. Others developers use emacs or
ElrIDE (which uses the same indentation as emacs). No other 'popular'
editor correctly supports the 'emacs style' indentation for Erlang.
Maybe it's just me but I like consistency and my mind is 'trained' to
match this indentation format.
>> 3) "TDD is extremely painful. What should I be writing tests for?"
>
>
> If it's painful then they're not doing it right. They should write tests for
> exactly the things they test manually. Doesn't need to be more than that at
> the beginning, tests can get added over time.
Thank you. This is something which is not really covered as an "Erlang
best practice" in anything I've seen to date. My guys want to write
tests for every possible return from every single function. I'm even
seeing tests which are actually testing returns from OTP function
calls.
If anyone knows of any resources for "Best Practices" for erlang
testing I'd appreciate their sharing.
>> 5) "No unicode aware/safe string library? wtf? Lists of integers?
>> Binaries? Why in deities name does it have to be so convoluted?"
>
>
> I'm not sure why they would say that. It's not like JS has good Unicode
> support either. Erlang has a number of ICU bindings available if you do need
> Unicode though.
Again, they're learning and it's a process. In our main project we use
the "ux" library.
But I understand their befuddlement. It just "seems" like something a
language should include.
Seeing the movement over the versions with unicode support I guess
that eventually it may exist.
>> 7) "Dialyzer is dog slow"
>
>
> Is it? Are they rebuilding the PLT all the time? It never takes more than
> 10s to dialyze for me on the bigger projects (usually < 2s though). Much
> faster than running tests (especially running tests by hand if that's what
> they'd prefer doing).
Confession time, I just blindly believed that when I was told. Turns
out they missed reading the "0." in seconds in the timer. His simple
build time was 0m0.45
On the other hand, your pointing this out led me to investigate our
main project makefile. Here it currently takes ~ 15 minutes to run and
basically uses 100% memory and forces swapping.
Maybe someone smarter can point out the error as I certainly cannot see it :(
### snip from Makefile (assume correctly tab indented)
## Dialyzer
DEPSOLVER_PLT=.depsolver_plt
OTP_PLT=.otp_plt
.PHONY: dialyzer
$(DEPSOLVER_PLT):
-dialyzer --output_plt $(OTP_PLT) --build_plt \
--apps erts kernel stdlib crypto public_key mnesia ssl xmerl inets
-dialyzer --output_plt $(DEPSOLVER_PLT) --build_plt \
--apps -r deps
dialyzer: $(DEPSOLVER_PLT)
nice -19 \
dialyzer apps/*/ebin/ --plts $(OTP_PLT) $(DEPSOLVER_PLT) \
-Wrace_conditions \
-Wunmatched_returns \
-Wno_improper_lists
### end snip
>> 8) "What's up with the documentation organization? Why do I have to
>> use google to be able to find anything in the official docs?
>> Navigating the docs is crazy, I feel like it's still 1998"
>
>
> ???
>
> http://www.erlang.org/erldoc
And yet the 1st documentation link on http://www.erlang.org/doc.html
(the title "Erlang/OTP documentation") is to the *non* searchable
version http://www.erlang.org/doc/.
Yes, right in that paragraph is a link to the searchable version, but
if they already have the link to what they're looking for, why would
they even bother reading that paragraph.
Additionally, google search results invariably link to the *non*
searchable documentation.
Maybe changing the link on the paragraph title and explicitly listing
links to both types of documentation in the paragraph body would
prevent this 'mistake'.
I know I made that mistake myself. I was totally unaware the
searchable docs existed.
> It sounds a lot like you/they're making their life harder than it should be.
That could well be the case, and this is why I believe such
discussions are useful as I want to make life easier for all.
Thanks for the response,
Leonard
That was just my reaction, sorry. A more polite kind of "What the .. are
they doing?".
I feel I should write a detailed explanation of my workflow somewhere.
Too often do I read people having too many issues than they should. My
workflow isn't perfect by any means, but it probably wouldn't hurt to
put it into words. (rebar users be damned though, because I don't use it.)
> They are using Sublime as that's their editor of choice.
> When I started learning Erlang I was informed that the 'defacto'
> standard for indentation is the indentation used by elang mode for
> emacs as this was the primary erlang editor. Maybe I was misinformed,
> but that became our coding standard. Others developers use emacs or
> ElrIDE (which uses the same indentation as emacs). No other 'popular'
> editor correctly supports the 'emacs style' indentation for Erlang.
> Maybe it's just me but I like consistency and my mind is 'trained' to
> match this indentation format.
The standard is "indent the same as the code around your change". True
not only for third party projects but also for OTP code.
> Thank you. This is something which is not really covered as an "Erlang
> best practice" in anything I've seen to date. My guys want to write
> tests for every possible return from every single function. I'm even
> seeing tests which are actually testing returns from OTP function
> calls.
If you really want to test all possible cases you should take a look at
property based testing, but beware of the learning curve.
> Maybe someone smarter can point out the error as I certainly cannot see it :(
I do not see it, but if I had to guess I'd say it generates the PLT
every time.
By the way, shameless plug if you like makefiles:
https://github.com/extend/erlang.mk
> And yet the 1st documentation link on http://www.erlang.org/doc.html
> (the title "Erlang/OTP documentation") is to the *non* searchable
> version http://www.erlang.org/doc/.
> Yes, right in that paragraph is a link to the searchable version, but
> if they already have the link to what they're looking for, why would
> they even bother reading that paragraph.
I am not disagreeing with you there, switching the links out would
definitely be better.
"I feel I should write a detailed explanation of my workflow somewhere."
--