Live data from Hacker News

What Sucks About Erlang (2008)

damienkatz.net

21–30 of 105 posts

Re: What Sucks About Erlang (2008)

#22
post #17

Earlier quoted context omitted.

We've been using Elixir almost exclusively for a couple years, and I can't speak highly enough about it. There are clearly problems where beam is ill-suited, but otherwise, I almost feel religious about it. I've worked for many years with many other languages and runtimes, but beam, OTP and Elixir (and the synergy between them) are better tools. As a foundation, message passing and isolation are the only realistic we…

Can you share a bit about the deployment story. I haven't really been able to get a good view of the automation behind that. Granted, I have yet to develop anything actually deployable, but would love to hear some opinions about that.

My point is that you can achieve many of the same benefits of microservices within a single app (or "vm" in erlang terms).

So you get isolation (beam processes), decoupling (message passing) and resilience (supervisors) without having to deploy and maintain N different apps and the pain points that come with that (monitoring, discovery, integration testing, debugging, ...)

Our company has other systems, in other languages, and a pretty involved deployment process (docker+nomad) so our deploys are pretty specific to that. But, I can tell you that as a developer, having only a few "apps" that internally have hundreds of services, has more or less freed us up of having to worry about any of that cognitive (and performance) overhead.

Re: What Sucks About Erlang (2008)

#23
post #9

CouchDB. It's rare that a piece of software is bad enough to give its language and runtime a bad name, but it's actually that bad.

Huh? I have never heard of anyone saying erlang is bad because of couchdb. I've heard criticisms of couchdb itself, sure. But they've been more along the lines of "MVCC multi-master document stores are not a good solution for this problem" more than "CouchDB is a bad MVCC multi-master document store".

Re: What Sucks About Erlang (2008)

#24

Earlier quoted context omitted.

I've tried to use it. I hadn't realized it was erlang based, but now I respect erlang less

I haven’t used it personally, but I looked at it enough to know that its goals are different from most DBs. Isn’t it supposed to be mainly REST based and have a goal of being able to sync multiple nodes with expected connection loss in between? I’ve never needed that on a project but it seems like it would work for some use cases. I hear good things about PouchDB.

I don't quite get pouchdb. Do you need to store multiple revisions of the same document in a browser database? Locks/transactions seem like a better approach here for writing to data client side.

Re: What Sucks About Erlang (2008)

#25
post #8

Programming discussions would be much better if everyone could be this critical of their favourite programming languages. There are languages everyone is happy for you to criticize online. Then there are a small few that cause people to lose their shit when you offer a critique. It's really sad - you really shouldn't be so personally invested in a tool you didn't write.

'You can divide programming languages into two groups - those that people complain about, and those that nobody uses'

C# is widely used, but it's a bit of a sacred cow.

Re: What Sucks About Erlang (2008)

#26
It's a 10 year old blog post from the creator of CouchDB who then later declared the project dead despite it already having a vibrant open source community with multiple users and contributors. Then went on to create another project that had a similar name but was a merge of a bunch of other technologies which lead to endless confusion years on after the fact.

http://damienkatz.net/2012/01/the_future_of_couchdb.html

Yes, of course the argument should stand on its own despite the author's other claims or blog posts, so let's review some claims:

> Because Prolog sucks ass for building entire applications.

There have been entire applications written in Prolog. Attacking syntax is is just silly. Had Prolog used statements and not expressions or ; instead of . I doubt we'd would have a seen a lot more or less applications in Prolog.

> But that hasn't deterred Erlang from stealing it's dynamite syntax.

The syntax is consistent. That's the point. It has relatively few syntax and semantic rules. It has strong types and behaves consistently, comparing say, with "this" in Javascript. js has semicolons but it behave inconsistently sometimes. You'd have to explain why {} + [] = 0 for example. Picking on js here since the author used js as an example of a "good" language.

> editing code is much harder than conventional languages.

Have not found this to be true. It is a bit harder. But not much harder and not a show stopper. You can't randomly copy and paste code and reorder statements because compiler will not like it. That's probably a good thing. Variables being immutable is helping when inserting a new function call in the middle, you have to think well if that modified value is suitable for the operations that follow below.

> If Expressions

There are 6 paragraphs talking about the "if" expression. "if" is not even used that often and focusing on it just because it has the same name as the "if" statement from Algol (C) type languages is a waste of time.

Use "case" instead or even better multiple function clause heads. Yes, you can't do an early return so you have to explicitly handle every case. I see it as a good thing. You can cheat and say "_ -> ...DefaultValue" but it will stand and be obvious what's happening to the reader.

> You Say String of Characters, I Say List of Integers

Or list of unicode code points... You have a choice to use binaries instead of lists of integers. They are closer to the traditional strings in other languages. This is a better explanation of how they work: https://medium.com/@jlouis666/erlang-string-handling-7588daa...

> but it's surprisingly limited and verbose, requiring you to state the type of the record for each reference in the code.

Since the blog was written Erlang got maps other languages call them dicts or hash tables for example.

All in all I'd say syntax is often what people talk about but it is closer to bike shedding. It is easy to argue about because it's right there and everyone can see a . instead of a ;. It would better to talk about the semantics of the language, sending messages, concurrency, modeling applications as a set of communicating processes, supervision trees etc.

Re: What Sucks About Erlang (2008)

#28
I disagreed up until the docs section.

I like all the other things he critiqued!!1!

Rearranging: the punctuation helps you think about how you’re rearranging. You can’t copy/paste around in any function and expect it it work!

The records comparison to a struct is unfair. He could have patterned matched on the record instead of destructuring and accessed the attributes of the record.

Immutability! Fuck yeah! I tend to name subsequent variables with the mutation that was applied to them. It’s wordy.

Name = “wayne”

NameCapitalized = ...

Now get off my lawn!

Re: What Sucks About Erlang (2008)

#29
post #9

CouchDB. It's rare that a piece of software is bad enough to give its language and runtime a bad name, but it's actually that bad.

Any complaints in particular? I had been contemplating CouchDB for a new application at work, maybe you have a link I could read about it? I thought that the incrementally updating mapreduce style views looked really powerful, especially when combined with the changes subscriptions / long polling features.

God, where to start.

Map/reduce views ("secondary indexes") are currently built by serializing JSON down a pipe to an external process called couchjs that links against a seven year old version of Mozilla Spidermonkey (1.8.5, released on March 31st 2011, and the only version it currently works with). This external process then pipes the map results back, again as JSON. Forget zerocopy; we're serializing and deserializing twice per document. Almost all of this "external view server" (the only kind AFAICT) is actually written in Javascript on that seven year old engine. Nothing is streaming; your map function is sandbox-evaled in that process, the results of a single call are stuffed into a Javascript array via .push, then stringified and printed on standard output as a single line. The entire internal "view server" protocol is based on a pipe of single-line JSON commands and data payloads. Performance (and likely security, due to age of the engine) in this subsystem is extremely poor IME.

You can write map/reduce views in Erlang itself as an alternative, but that engine is disabled by default due to security concerns – it's "not sandboxed". Performance in this area also appeared to be proportional to the code size of the map function, which sounded a lot like it was being serialized down a pipe with no caching.

If you make a change to a single view in a design document, the database system will rebuild all indexes in that design document unconditionally, even if the other view code hasn't changed. The only way to prevent this is to store a single view per design document, and manage those documents yourself.

Once you've endured your multi-day index rebuild on a couple million documents, you'll also have to issue an extra "cleanup" command to delete the old (now essentially useless) indexes. It's a full rebuild, so you need 2x the space at a minimum to pull it off.

The data itself is stored in a single file per shard, opened in O_APPEND mode, effectively serializing all writes on the shard. You also will not see kswapd active, ever, because the OS VMM is not being used effectively – no shared memory for IPC, and no use of mmap AFAICT.

Server-side changes feed filters appear to be extremely slow when compared to just filtering the results in the client.

Authorization: limiting read access will be difficult at best. Transactional behavior: no, aside from a single bulk write feature (make sure to use "all or nothing" mode though).

Logging: signal to noise ratio is poor. Giant stack traces for minor events. You may even see strings emitted as UTF-32 arrays of integers in base 10. Hope you brought an ASCII table at least.

Documentation: The following passage from section 5.2.5 of the CouchDB v2.1.1 manual just about says it all: "Views with the JavaScript query server are extremely slow to generate when there are a non-trivial number of documents to process. The generation process won’t even saturate a single CPU let alone your I/O. The cause is the latency involved in the CouchDB server and separate couchjs query server, dramatically indicating how important it is to take latency out of your implementation." I can't say anything nice here about that last sentence, so I'm just going to keep my mouth shut.

But worst of all: every time it starts up, it tells me "it's time to relax". Nothing about this is relaxing.

(These are my own private individually-held views, and do not reflect the views of any employer or organization)

Re: What Sucks About Erlang (2008)

#30
post #9

CouchDB. It's rare that a piece of software is bad enough to give its language and runtime a bad name, but it's actually that bad.

Huh? I have never heard of anyone saying erlang is bad because of couchdb. I've heard criticisms of couchdb itself, sure. But they've been more along the lines of "MVCC multi-master document stores are not a good solution for this problem" more than "CouchDB is a bad MVCC multi-master document store".

It doesn't use real node-local/shard-local MVCC AFAICT. It's O_APPEND on flat files.
Post reply on HN