Live data from Hacker News

Elixir for Humans Who Know Python

hibox.live

141–150 of 198 posts

Re: Elixir for Humans Who Know Python

#141

Earlier quoted context omitted.

Django’s approach is to run all the migrations, from the migration files, if the database gets wiped clean. In other words, if you’re developing on your local machine, you can just drop the DB and start new (or if using SQLite, just delete a file), and after running migrations, you never have to worry about whether all the necessary files are in sync with the database. As Neo might say:“there is no spoon…” seriously,…

Thanks! FWIW, structure.sql is not needed in Ecto either. You must do that when: 1. You want to start discarding migrations (because you have too many) 2. You had an existing database Are those never a "trigger" on Django side? I appreciate the opportunity to learn!

TIL you actually don’t need structure.sql for Ecto! In that case, discarding migrations on a large running app seems like a not-always-good practice, right? FWIW, my experience with Ecto has always been in joining existing codebases that are already big.

I do also want to add that Django can kind of do the reverse of auto-generating migrations: it can “inspect” an existing database and generate Python classes that allow you to use the Django API as if you wrote those classes yourself: https://docs.djangoproject.com/en/4.1/howto/legacy-databases...

Of course, the feature is not going to be perfect, especially if a team has been using odd naming conventions in the legacy database, but it seems helpful at least in theory.

Re: Elixir for Humans Who Know Python

#142
I've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language.

Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the language and I now more or less regard it as an elegant programming language put together by a thoughtful person with great programming taste.

The Phoenix framework is a great bonus point if you want increased productivity for writing web apps. I don't miss Python at all.

Elixir rests on the shoulders of giants though, and the Erlang/OTP is yet another elegantly engineered piece of technology, enabling one to develop concurrent, distributed and fault tolerant systems with ease, and in this regard I think the Erlang/Elixir ecosystem takes the crown. The actor model is simple, yet very powerful.

For reference, I've also been learning Nim and F#, and they're also pretty unique and well designed languages in their own ways. I love Nim's fast compilation times, efficiency and expressiveness and F#'s powerful type system which enables one to develop domain models with ease. I've also been occasionally taking stabs at Rust, but it always feels just a tad too complex for my brain. I'll continue playing with it though, maybe it will eventually make sense.

Ultimately, every design decision is also a tradeoff. I don't think we'll ever have a perfect, human designed language.

My dream language would probably be a combination of Elixir and F# though, a language with an advanced and powerful type system, functional programming and the actor model as the building blocks. I guess fast compilation times à la Nim wouldn’t hurt either. :)

Re: Elixir for Humans Who Know Python

#143

I've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language. Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the l…

Sounds like Gleam[0] would be up your alley :) As an F# guy myself, I am hoping it pans out, as I miss the BEAM platform!

[0] https://gleam.run/

Re: Elixir for Humans Who Know Python

#144
post #65

Earlier quoted context omitted.

> Django does not generate anything through scaffolding like Phoenix I was one of the co-authors of Devise, which is an integrated authentication solution for Rails (similar in spirit to Django), and you will easily find people who swear that the code generation solutions are miles better. That’s because eventually they’d want to customize how the framework or library work and then, instead of simply being able to ch…

With Phoenix 1.7 being released, will there be a new edition of "Programming Phoenix"? The latest one covers Phoenix 1.4, which is already slightly outdated. I think having an up-to-date book would be of great value for Phoenix beginners :)

The same publisher has a "Programming Phoenix LiveView" book, which is probably your best bet at this point.

Re: Elixir for Humans Who Know Python

#145
post #143

I've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language. Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the l…

Sounds like Gleam[0] would be up your alley :) As an F# guy myself, I am hoping it pans out, as I miss the BEAM platform! [0] https://gleam.run/

Yeah, I've known about Gleam, but I don't recall exactly why I wasn't too compelled to use it. I installed it with brew a while back, I tried a few basic examples and since then it's just been sitting there. I guess I should revisit. But thanks for the reminder anyway.

Re: Elixir for Humans Who Know Python

#146

I've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language. Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the l…

> Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places

This complaint and a similar one for maps were the primary driver in me making an "Elixir tips" playlist of YT videos: https://www.youtube.com/watch?v=7w98voHko20&list=PLFhQVxlaKQ...

What kinds of things have you been coding or reading in your Rust learning so far? I'm a pretty big fan of Herbert Wolverson's Pragprog Rust book and open source Roguelike project, as well as Tim McNamara's Rust in Action (which I've only gone through part of due to how each project leaves you wanting to keep building it after the book moves on to another).

Re: Elixir for Humans Who Know Python

#147

I've been programming my web projects exclusively in Elixir for the last few years and I've been deeply enjoying the language. Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places – over time, I've grown to love and appreciate the l…

> Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places This complaint and a similar one for maps were the primary driver in me making an "Elixir tips" playlist of YT videos: https://www.youtube.com/watch?v=7w98voHko20&list=PLFhQVxla…

I wish I had this when I learned the language. :) I'll take a look, as your playlist is quite comprehensive it appears. Thanks for sharing!

Re: Rust - I've been trying out basic examples, simple web servers, etc; nothing too fancy. But it just seems too ceremonious to get even the most basic things done. I own the book "Rust in Action", I just didn't have the proper time to go over it.

Re: Elixir for Humans Who Know Python

#148

Interesting article. Having the built in Redis via ETS is slick. I currently use Python but don't use Django but instead wrote my own WSGI frameworks based on Flask Restx. I'm not a big believer of ORMs besides their CRUD functionality so there is not much benefit for me using Django and the security burden it carries (like PHP) by being so popular. I can keep my designs light weight, very secure and fast; albeit not…

> Interesting article. Having the built in Redis via ETS is slick. This isn't really true. Although having a built in redis may be possible, the fact is that production elixir projects do use redis on a lot of cases (for example as a task queue). ETS is rarely used because of its complexity.

Redis might have a nicer API but the ops of maintaining another service is not simpler than just using ETS that is built in the platform.

I'd rather choose Redis only iff I hit the limits of ETS. And 99% of apps won't even get to that point.

Re: Elixir for Humans Who Know Python

#149

Earlier quoted context omitted.

> Although at first, some unfamiliar design decisions annoyed me, for they were not well explained in the tutorials I was learning the language from – e.g `arg: value` as a shortcut for `[{:arg, value}]` in function arguments and other places This complaint and a similar one for maps were the primary driver in me making an "Elixir tips" playlist of YT videos: https://www.youtube.com/watch?v=7w98voHko20&list=PLFhQVxla…

I wish I had this when I learned the language. :) I'll take a look, as your playlist is quite comprehensive it appears. Thanks for sharing! Re: Rust - I've been trying out basic examples, simple web servers, etc; nothing too fancy. But it just seems too ceremonious to get even the most basic things done. I own the book "Rust in Action", I just didn't have the proper time to go over it.

It takes you through the heavy lifting of writing a CHIP-8 emulator, a database and a whole bunch of things. It really feels like it could have been several books and he just had to cut back the scope of each part to fit everything in and ship it.

The great thing about that is that it leaves you with projects just begging for you to dot the "i"s and cross the "t"s.

Re: Elixir for Humans Who Know Python

#150

Earlier quoted context omitted.

> I use Phoenix only on projects where its real-time capabilities will be the protagonist. As a web user (not dev) I would say real-time (as in super fast?) should always be the protagonist? To me that's the most important factor that makes the difference between nice and shtty website.

Real time like a chat app, or a video game or something. Not just a fast site. Seems like most "real-time" sites are slower as they have a harder time taking advantage of caching and the like, or use a lot of slow client-side javascript that inevitably works poorly. Basically if you need the server to be able to change the data a user is currently looking at, collaborative multi-user stuff mostly. Liveview could be g…

Been looking at CRDTs lately for this, sounds like Elixir would be a good fit. Although what I've seen before has used C++ or Rust? to compile to wasm for the graphics part of the front end. Do all these technologies work together well?
Post reply on HN