5 ms·
I think there's a large class of apps where you end up writing less than 30-50k lines of code and things aren't a problem in the end. I've built a video course
by nickjj 4y ago
I think there's a large class of apps where you end up writing less than 30-50k lines of code and things aren't a problem in the end.
I've built a video course platform now in Flask, Phoenix and Rails and I've built about 60% of the platform in all 3 tech stacks. The Rails app has ~7k lines of code (LOC count includes everything but tests), it's substantially less than the others. The Phoenix app was by far the worst of the 3 in terms of how much code I had to write and overall "difficulty" of the code. The Flask app sat somewhere in the middle, at times it made doing certain things easier and more efficient than Rails but if I had to rank overall developer happiness and how easy it was to do things it would be Rails > Flask > Phoenix where let's say Rails is a 8.5 in terms of happiness, Flask is a solid 7 and Phoenix was maybe a 4 or 5. This includes a number of real-time elements like having a persistent video player that survives across page navigations, notifications and comments being broadcast to all connected clients with authentication and more.
- uxcolumbo 4y agoSurprised about your score for Phoenix. What exactly were the painpoints? My impression was Elixir / Phoenix was ranking high in developer happiness.
- nickjj 4y agoDeveloper happiness includes all facets of development IMO. The language, 3rd party packages, the overall ecosystem, the community, etc.. Elixir isn't really in the same ballpark as Python and Ruby for package support. Lots of 3rd party vendors don't have official SDKs for Elixir and having to recreate certain components of those SDKs manually can be very tricky. This is especially true for payment gateways like Stripe, Payal, Paddle and others since there's gory details about certain things aren't as easy as making an HTTP call with a token. So you end up having to recreate these things from scratch because most community versions are abandoned due to them being maintained by 1 or 2 people who stopped using it. Also, LiveView's APIs keep changing. The amount of churn was out of control for a few years where it felt like every few months you had to make drastic rewrites to keep up with it all. At the same time the docs are very minimal and community support through blog posts weren't there in the same way they are for Rails and Flask. It felt like you were on your own to solve everything in a fast moving world with an ever growing API. Then for the language, Elixir didn't click for me, even after writing 10k lines of code. I felt like I could get pretty far and understood enough to get most things done but I felt like I was getting stonewall'd quite frequently and couldn't solve certain basic problems after exhausting all pre-existing resources (my brain, docs, blog posts, open source projects, etc.). I don't feel I have this same issue in Python or Ruby. There's such a big community that nearly everything can be found, or at least get you to the point where you can apply something to your domain without asking in chat for help. A good example is https://github.com/josevalim/nested-map-reduce-traversal https://github.com/josevalim/nested-map-reduce-traversal which is something Jose and I worked on a few years ago. If he didn't step in and provide an example on how to do what's essentially a nested loop while modifying a counter in Elixir I would have had to stop developing my project. I still have to step back and spend a full 5 minutes trying to mentally parse his solution where as the Python and Ruby solutions are immediate with no effort. When trying to build a pretty big project, these routine blockers or having to spend 3 hours (or 3 days) down a rabbit hole vs just doing it in a few minutes make a big difference -- this is also after spending months learning the language and ecosystem already. You end up getting fatigued from having to build so many libraries to get to the point where you can work on your main's app goal and it's demoralizing getting hard blocked. There's also this pit in your stomach that's concerned at how quickly you can get stuck in a way that you can't self-resolve. When trying to build a business, these are all very dangerous things. You put all of that together and my happiness level for Elixir was kind of low. It's nothing personal, just my opinion. I think it has good ideas and concepts in places but it didn't feel like the juice was worth the squeeze for someone like me who didn't already have many years of functional programming experience beforehand. Flask and Rails are both fast enough where you can build a million dollar a year business on a single $40 / month server with tens of thousands of customers. You can still get p95+ <= 100ms response times from your back-end in this scenario and both tech stacks have a good story for using websockets nowadays. Thankfully Hotwire Turbo is back-end agnostic which means you can build really nice feeling front-ends with any tech stack with minimal JS. I'm really happy DHH pioneered this pattern with Turbolinks which evolved into something wonderful.
- uxcolumbo 4y agoThanks for sharing your experience. Somehow makes me think for this web stuff just use a well established glue language / toolkit with a huge and thriving community, e.g. like you mentioned RoR, Flask or even Laravel ;) - which lets you focus more on building your solution for your business problem. And for certain things where it's niche, e.g. you need real time with hundreds of thousands of nodes, self healing etc features, use Elixir with BEAM.
- nickjj 4y agoNo problem. Yep your comment sums it up well. Although Kubernetes does allow you to horizontally scale decently well with any tech stack. I've run a few Flask + Celery apps (replace that with Rails + Sidekiq or whatever your preferred stack is) on Kubernetes and it's working out quite nicely. Zero downtime deploys (and even node upgrades) with a deployment model that makes sense for individuals and large teams (gitops philosophy using well supported tools like Argo CD, etc.). For things that don't need that scale, a single server with Docker Compose does the trick. I've been doing that for about 8 years now with Docker and Ansible. ~20 lines of YAML configuration to get a machine from ground zero to fully up and running, secured and serving any Dockerized app of your choosing over a custom domain with SSL with automated DB backups, monitoring, logging, etc..