9 ms·
I have spent a lot of time with node(express), Java(Spring) and rails. I see a lot of complaints about node, but node with typescript has been a joy to work wit
by confidantlake 5y ago
I have spent a lot of time with node(express), Java(Spring) and rails. I see a lot of complaints about node, but node with typescript has been a joy to work with. It is lightweight and has a type system. I know where every piece of code is coming from, there is no magic involved. I either wrote the function in that file, I am importing it, or it is a method on a js object. I only have know one language for both front end and back end. A better standard library would be nice.
Rails is nice in terms of getting the project set up, not bikeshedding about the tooling, and working with the db. But the actual coding has been painful for me. I really dislike working with a non typed language. I dislike optional parans in function calls and optional braces for hashes. I dislike all the magic of rails. I never know what is going on because there is some functionality that inherits from a rails class or some other part of the code base. I would rather write a bit more code for a bit more clarity. Maybe if python were typed I would like Django? But python has all of that nonsense around virtualenv.
Spring has been ok, but not great. Too much bloated abstract factory creator nonsense. Dependency injection never really clicked for me. All of these annotations. I quite liked plain Java but Spring just felt like this monster.
All in all node(express) has been the nicest for me.
- megaman821 5y agoExpress isn't really like Spring, Rails or Django. Express is very simple and may be good for someone learning the basics, but how is a novice web developer supposed to know what is missing? There concerns from security, authorization, sessions, and many more that Express doesn't handle out-of-the-box.
- confidantlake 5y agoWhen I said rails was nice for project setup, it was things like what you mentioned. Definitely easier to do those things in rails. In express there are packages for those things, ie https://www.npmjs.com/package/express-session https://www.npmjs.com/package/express-session. Agree it would have been nice as part of the express library.
- mjlawson 5y ago> ... how is a novice web developer supposed to know what is missing? That is a great question. Is it the job of the tooling to prevent a novice developer from shooting themselves in their foot? Do we need higher-level abstractions in our frameworks that are analogous to memory safety in programming languages? Perhaps. Alternatively, I don't think that security practices are particularly hidden. Anyone who's used the web knows has used a login form. I would give most novice developers the benefit of the doubt that they're going to be curious and look into that. I would argue that it is, in part, their responsibility to learn these things. It's our responsibility perhaps as stewards of the secure web to teach and enforce best practices. I don't think baking in these best practices into frameworks does these developers any favors, except that it allows them to focus on something else.
- epolanski 5y agoI often think of languages like Haskell that could offer the clarity and expressiveness and the static types I want, but the developer experience and killer software (react, phoenix, rails) has just never been there. TypeScript to me is the compromise I'm willing to settle on. It is also lackluster from many aspects but day by day it gets a bit easier.
- lolinder 5y agoIf you haven't already found it, you should look into IHP (https://ihp.digitallyinduced.com/ https://ihp.digitallyinduced.com/). It aims to build the convenience of Rails on top of Haskell's powerful type system. I've not yet built anything serious in it, but I've been following its progress, and it's looking really good so far.
- saila 5y agoPython has optional static typing, which I think is getting better with each new release, e.g. allowing `T | U` for union types in 3.10. Types can be checked with mypy: http://www.mypy-lang.org/ http://www.mypy-lang.org/ For Django, there are these two typing packages: - https://pypi.org/project/django-stubs https://pypi.org/project/django-stubs - https://pypi.org/project/django-types https://pypi.org/project/django-types I can't vouch for them, but it looks like they're being actively developed. I like the idea of full-stack JavaScript (or TypeScript), but last time I tried to use Node for a back end, I couldn't find anything that compared to libraries/frameworks like Django, Rails, SQLAlchemy, etc.
- bingohbangoh 5y agoIdk if its just me but I find the testing frameworks for expressJS to be _awful_ -- chai and mocha work great but throw in sinon and its like pulling teeth. The lack of good documentation is painful and often treats me like I don't already know the concepts involve. Sequelize isn't as intuitive as Django's ORM either imo.
- crucialfelix 5y agoI recently set up a good old Django backend with REST framework. Frontend in Next.js Turned out to be painfully slow to iterate. The ORM needs constant attention to join or prefetch queries. Switched to Prisma and it's an utter joy. If the typescript has no errors then there won't be runtime errors. Sequelize is a multi generational mess. It's a huge time waster.
- ranguna 5y ago> Sequelize is a multi generational mess. It's a huge time waster. Could you elaborate on that ? I personally like the functional aspect of sequelize.
- crucialfelix 5y agoJust that there are several generations of API. This makes TypeScript pretty much useless / impossible. Working with Prisma: if it compiles (and you don't have a business logic error), then you usually won't get any runtime sql errors. You don't have type safety with sequelize.
- me_me_mu_mu 5y agoSame here. For any new project I use my own minimal express setup. Super easy to deploy and even easier to scale.
- mikeryan 5y agoSo its been a while since I used Rails but when I did I enjoyed it. In particular, say what you will about DHH I think having a fairly "opinionated view" on how the framework should function makes it much easier to deal with. Every time I need to do something full stack with Node I feel I need to go back and figure out what the current state of ORM's are. However the reason I don't use Rails as much is that I'm not writing a lot of "full-stack" apps. A lot of the work these days is gluing together various SaaS services. Okta/Firebase for Auth, Contentful for CMS, Stripe + Webhooks for Commerce etc. I just don't do anywhere near as much "CRUD" style programming as I used to do earlier in my career, which is both a comment on my career and the state of programming today. I'd love to see a project that wraps up a bunch of best-of-breed technologies and creates a full framework and doesn't try to be all things to all people. ie React for Front-End, Bookshelf ORM, Express Server etc (pick your favorites, but have an opinion that evolves but only in one direction.
- BurningFrog 5y ago> I dislike all the magic of rails. I never know what is going on because there is some functionality that inherits from a rails class or some other part of the code base. This is also my only complaint with Rails. I'm a programmer, not a wizard, and I'm not good at magic.
- jstummbillig 5y agoI never really understood the criticism about "magic" in Rails. We are surrounded by magic (which only means things we can not realistically be bothered to take the time to really understand, in contrast to things which are incomprehensible). I have no real clue why the terminal works. I have no real clue why my OS works. I have no real idea how TCP/IP does its thing. Sure, I can use them – but I couldn't really explain and much less recreate them. What I need in all the above is replicability. I do x, and I know y is going to happen. Get x, do y. This is true in Rails. If I really wanna know more Rails is open and easily explorable. No one is preventing me from finding out how any piece of the "magic" works. "Magic" class inheritance is a thing in JS as much as it is in Rails. What is so special about Rails and "magic"?
- onehair 5y agoWhen multiple teams work on the same rails project, you're bound to have someone enhance some class somewhere, and all of a sudden, your isolated class is doing things it's not supposed to do, or at least you think it's not supposed to be doing it. You try to debug it, but there are no types no way for the tools you're using to let you know easily, here is where this specific piece of logic coming from. In Typescript, entities have types and when you misuse something the typescript checker tells you while you're coding why, that's not what you're supposed to do. You can super easily track down the type and navigate the code base to the source and adapt either your code or edit the source. Easily. With rails, you're often required to do mental gymnastics to debug simple things, after the fact
- LargeWu 5y agoLet's not pretend javascript Promises and async/await are not magic in the same way some of Rails is. Lots of gotchas and unintuitive behavior, let alone cryptic error messages and stack traces. At least Ruby generally gives pretty useful stack traces. When something breaks, it gives you a pretty clear indication of exactly what line it happened on and what the problem is.
- qudat 5y agoAutoloading is the worst feature in rails and it should be ripped out: https://erock.io/2021/11/01/on-autoloading.html https://erock.io/2021/11/01/on-autoloading.html
- culopatin 5y agoIm happy you posted this. Im a noob starting a project in Spring and I get lost in the jargon. I find that all the Spring knowledge I’ve gathered is to know what is NOT written in the code that Spring is doing for me. In other words, feels like knowing Spring is being able to read between the lines and placing annotations more than building with it. Which is fine, but it’s easy to get lost when starting out. It’s also for me to find help since the community seems much smaller and none of my friends are interested in helping out because they don’t want to learn Spring.
- chakkepolja 5y agoI felt the same. The documentation is so sparse. Can someone suggest a book or a website that builds concepts bottom-up?
- culopatin 5y agoI tried this route and what I found is either outdated or was of poor quality and the code examples didn’t compile. It’s easy to get the barebones up and running but once you need to start customizing is when things have many different ways you could go about getting them done.
- reactor 5y agoTake a look at https://quarkus.io https://quarkus.io you won't feel overwhelmed.
- ImprobableTruth 5y agoYeah, Spring is incredibly 'magic' heavy. Works great when you know the exact right annotation incantation, but it's a pain to actually understand what's going on. I've found the official documentation to be very detailed, so it's helpful if you really need in-depth knowledge, but if you don't it's a bit hard to parse out the relevant bits. Copying something from the official guides seems often the easiest way... In regards to the community, I didn't find it to be much smaller? The stack overflow tag is very active. I have the same experience that nobody I know wants to learn Spring out of their own volition though.
- aelzeiny 5y ago> I dislike all the magic of rails. This is my #2 problem with Ruby, and it's also the reason why a lot of folk love it. I think of macros in the same way I think of RegEx, if you're writing one you better hope it works perfectly because chances are that you'll be the only one to maintain it. Other Ruby "features" that I dislike: 1. Blocks + Procs + Lambdas are all function-adjacent. Can't we just call them functions? 3. Out of bounds indexes on Arrays/Maps return nil. 4. method_missing() is super cool and super abusive. Again it feels like magic when functions come from nothing.
- tcoff91 5y agoRuby on Rails is awesome to write, horrible to maintain. It’s the fastest way to build a web app but good luck with staying productive once you have 100 engineers working on it and a million lines of rails soup to wrangle.
- hudon 5y agoGutHub, Shopify, Coinbase, Square, AirBnB, etc. , can probably answer some of your concerns.
- Toutouxc 5y ago> Blocks + Procs + Lambdas are all function-adjacent. Can't we just call them functions? Well, Ruby has functions, they're just called Procs. Lambdas are a special, more strict breed of Procs, and blocks are just (pretty complex) syntax sugar for passing a Proc to a method. The main function-like concept is always a Proc. > Out of bounds indexes on Arrays/Maps return nil. Calling the #[] or #slice method on an Array with an out-of bound index returns nil, calling the #fetch method raises an IndexError or returns an arbitrary default value. You can use whichever suits the situation.
- titusjohnson 5y ago> I dislike all the magic of rails. Let me assure you, there is 0 magic in Rails. Just because something is available to you via a convention doesn't mean there's magic, it means you haven't read the docs and don't understand the convention.
- davelnewton 5y agoCouldn't disagree more, but I think you're taking the term "magic" too literally. There is a ton of magic in Rails. It consists primarily of magic. I've been doing Rails since <1yr of introduction (Ruby for longer than that, and Lisp for longer than either). I'm very familiar with metaprogramming. Metaprogramming fits the canonical definition of magic in this context. Ruby, and Rails, also makes it very easy, and seductive, to add more magic. This is powerful, but dangerous. Like Lisp macros. Understanding the magic is not just a matter of "understanding the conventions" and reading the docs.
- guax 5y agoEverytime you see something you don't know where it's coming from, it's magic. Every time I interacted with Rais ive seen it, you have to know that some file somewhere registered or autoloader something else, etc. You don't see the imports to find it, you have to grep the repo instead and sort through all the matches.
- davelnewton 5y agoDI/IoC is a separate thing from the ecosystem; the benefits are just as strong in JS or Ruby--it's just that in JS/Ruby some of the benefits aren't as noticeable because of language malleability and openness.
- kmac_ 5y agoSame experience with a medium sized Rails project here. I joyfully ejected after several months, I needed a detox from the untyped mess, every singe library was different, there were no coherent apis/interfaces at all. All Rails patterns were replaced with some random "smarter" counterparts, dry-rb here, some "better" orm developed in a shack there, all glued together. I recognized it's not the issue with Rails per se, it's the Ruby devs culture and I'm not compatible with it (even though the team was quite good, just a lot of cruft to deal with).
- armandososa 5y agoHave you tried Remix yet? It's very early but I think it finally hits the sweet spot between rails and "modern" javascript frontend.
- almokhtar 5y agoHahahaha for real !