TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why I believe Rails is still relevant in 2019

272 点作者 mottiden大约 6 年前

52 条评论

mikekchar大约 6 年前
I work on a Rails system. It&#x27;s fine. Just like everything else is fine. I have problems, but I have problems with everything else too (sometimes different problems, but not always...).<p>I think my main complaint about Rails is that it&#x27;s pretty heavy weight. Lately we did a Sinatra app because we didn&#x27;t really need anything that rails was giving us. Fairly quickly I realised that I didn&#x27;t need anything that Sinatra was giving us either. Rack was fine.<p>I think especially after your app gets to be a certain size, you are either writing your own framework, or fighting with the framework you chose at the beginning. It&#x27;s just the nature of the beast. From there it&#x27;s more of a training issue than anything else. You can hire &quot;Rails developers&quot; (or whatever developers), but you can&#x27;t hire people who are specifically trained in a system you&#x27;ve built. Depending on the kinds of developers you hire, this may or may not be a problem.<p>Personally, I like writing code and I like small, light systems that are easy to move around in. Usually that means trying to avoid large frameworks. However, not everybody I&#x27;ve worked with is comfortable with that experience, so normally we pick things people have worked with before. Either way it&#x27;s not a big deal in the end.
评论 #19429219 未加载
评论 #19431188 未加载
评论 #19428832 未加载
评论 #19429859 未加载
评论 #19429234 未加载
评论 #19430167 未加载
评论 #19430235 未加载
nitrogen大约 6 年前
Popularity of a framework or paradigm seems largely driven by marketing and memes. With &quot;Rails doesn&#x27;t scale&quot; as the almost-rhyme that sticks in people&#x27;s minds, an entire tech cycle gets wasted on things that take significantly more developer effort.<p>I&#x27;ve seen a Rails app handle Cyber Monday traffic for an ecommerce company just fine, and I&#x27;ve seen JVM-based apps crumple under a fraction of the load.<p>Rails scales (see, that actually rhymes, so it <i>must</i> be true), Ruby is a really nice language to work in, and those things will remain true regardless of whatever frameworks exist or whatever earworm sayings stick in the minds of the next generation of developers.
评论 #19428645 未加载
评论 #19429944 未加载
rememberlenny大约 6 年前
As an individual developer, I don’t know a platform and framework that lets me do more with my time. I used rails recently for a new project to act both as the backend for an iOS app, an auth management system, a asynchronous worker manager, an upload manaager, and BI tool.<p>Combined with the mature gem ecosystem and clear mechanics for putting everything together, I was up and running immediately, and was able to continue adding features and refining without issues.
评论 #19428445 未加载
评论 #19429971 未加载
nathan_long大约 6 年前
I spent a couple of years dreaming of getting paid to work in Ruby and Rails and about 7 years doing so. There are many things I loved about Ruby, and Rails brought a ton of good ideas to web development, as this post describes (though I don&#x27;t agree with all the highlights).<p>I&#x27;ve since moved to using Elixir and Phoenix, and then even more recently, done some consulting on a Rails project. So the contrasts are on my mind.<p>My perspective now is that the advantages Ruby&#x2F;Rails have over Elixir&#x2F;Phoenix (community size and number of libraries) are circumstantial, and the advantages Elixir&#x2F;Phoenix have (fault tolerance, concurrency, speed, less requirement for external tools) are inherent in the VM.<p>Yes, speed of development and maintainability matter. And yes, you can write good or bad code in any language. But if Rails taught us anything, it&#x27;s that defaults matter. And the default pattern in Rails is to use ActiveRecord and rely heavily on model callbacks, which can get confusing quickly. ActiveRecord also has no way to turn off lazy loading as far I know, and chasing down N+1 queries to improve performance is something I spent far too many hours doing.<p>My productivity also wasn&#x27;t helped by the long test run times of Rails applications, or by wasting time trying to optimize view rendering on a heavily-used page.<p>All of those are either non-issues for me now or at least greatly reduced - Phoenix view rendering is crazy fast, N+1 queries aren&#x27;t possible with Ecto and it doesn&#x27;t have callbacks, Elixir test suites are highly concurrent and generally fast (though driving a headless browser is still rather slow).<p>Performance and concurrency do impact productivity. And I find that &quot;functions in modules&quot; is a great way to structure code and makes it easy to refactor. So does being able to run the entire test suite faster than I can get distracted.<p>The best ideas of Rails, in my opinion, are present in Phoenix - things like structural conventions, English-like naming, and database migrations. But many of the pain points are missing.<p>Phoenix and Elixir aren&#x27;t the One True Way™, aren&#x27;t the best for every conceivable software problem, etc. And surely they&#x27;ll be superseded. But in my opinion, Rails already has been.
评论 #19431227 未加载
评论 #19431257 未加载
评论 #19432031 未加载
评论 #19431281 未加载
评论 #19431972 未加载
anm89大约 6 年前
I&#x27;ve never felt as dialed in and as productive in any other tool or framework as I have in Rails. It takes all the unimportant BS, places it off to the side, allows me to focus on what I want to build, and gives me the ability to dig in deeper on the details when I want&#x2F;need to.<p>The amount of projects I have seen go bad because someone did a bad job of solving some problem that would have been a non issue in Rails is staggering.
bjoernw大约 6 年前
Build your app using whatever you&#x27;re most comfortable with because in the end an existing product is better than no product. Will you enjoy spending an extra hour per day working with this framework over another? That&#x27;s an hour more of progress.<p>Personally I think Spring Boot with Kotlin is a way better choice today for monoliths that transition well to micro services. But if you&#x27;re already deep in the RoR world just go with that.<p>Running into stack or framework-related scaling problems is an honor and a huge accomplishment. Those are good problems and there are many ways to solve them, which will be extremely motivating at that point because people are actually using your thing.
评论 #19429482 未加载
评论 #19430225 未加载
评论 #19428913 未加载
评论 #19428654 未加载
shay_ker大约 6 年前
Having worked w&#x2F; apps large &amp; small on Django, Spring boot, and Rails, I&#x27;d say that Rails is the easiest framework to be productive in, especially to people new to it. This includes junior devs as well as senior devs - it&#x27;s just easy to pick up. And it gets easier to use over time to rip out all the cruft, especially with things like Rails API.<p>Like any language&#x2F;framework, it has its warts and its weirdness. There are times when it can be very frustrating to deal with it all. But I&#x27;ve felt that feeling working across multiple paradigms, and I&#x27;m convinced it&#x27;s just a reality of software development.<p>If you&#x27;re deep into microservices, Rails can be a tough choice, I&#x27;ll admit. It really depends on your use case. A small-medium sized startup can get a lot done with just a Rails app if your workload is primarily IO based.
geebee大约 6 年前
This particular blog post did a fine job articulating the benefits of Rails, and these remain good reasons to use rails in 2019. I think there&#x27;s another side of this discussion. There are reasons why <i>rails</i> itself is worth using, and then there are reasons why MVC frameworks + a sprinkling of javascript are still worth using.<p>Personally, I feel that the latest trend toward heavy javascript front ends that are more or less detached from the middle tier or back end has led to a wildly overblown, over engineered state of constant technical churn. I quit web development over this. I got involved in a project for a while, but finally decided that if I had to write javascript in these constantly changing frameworks, I didn&#x27;t want to be a web developer anymore.<p>Fortunately, I have enough of a math and engineering background and work experience that I was able to move over to writing code for answers more than for applications, though code for answers can be used as a wing of an app. I largely stay out of the framework now.<p>But I use python, not surprisingly. Ruby is a nice language, and Rails is an excellent framework. I think that rails plus a little bit of javascript is far more productive than the javascript churn, and for a lot of apps, you give up next to nothing in terms of functionality.<p>But if I got back into web programming, I&#x27;d probably do what I described above, but in Python. Ruby, for whatever reason, just isn&#x27;t a big player in data engineering, data science, scientific programming, machine learning, all that. I haven&#x27;t programmed in Django before, but much as I enjoyed Rails, I&#x27;d probably stick with Python at this point.<p>Alternatively, if the javascript framework hamster wheel dwellers want to handle that mess and let me write my wing of it in python and integrate it however they please, then, uh, sure. As long as management understands that when they quit, I won&#x27;t be able to maintain it. A few people tried to get me to use node, but I won&#x27;t do it. I feel secure enough that the scientific programming community will not be switching over to javascript so that we can keep our programming language consistent with the shit show that is modern web development.
评论 #19458866 未加载
mmartinson大约 6 年前
I worked on a couple of production apps in Rails at the start of my career. It was the first way I learned to make web applications.<p>Rails works as advertised and is great at what it does, but I think ultimately the conventions-obsessed nature of the community, that is often so helpful, has settled on some patterns that make the Rails approach more bother than it&#x27;s worth with other good options out there. Often touted for being able to scale business logic and developer productivity at the expense of runtime performance, I see some serious issues with the claimed strengths.<p>- The powerful active record pattern and accompanying library makes it easy to pile on coupling between business logic and database access code.<p>- Ruby doesn&#x27;t give you a straightforward way to protect against mutation, which leads to some real debugging nightmares at the worst of times.<p>- Rails conventions openly disregard low hanging fruit best practices of OOP like the SRP, and make it difficult to design code that follow these practices without straying outside the well trodden conventions (hi again Active Record).<p>- Rails provides configuration-like interfaces that don&#x27;t feel like you&#x27;re calling Ruby code. They are convenient, but offload a big cognitive burden in the name of convenience whenever you need to problem solved something that&#x27;s not a garden-variety bug.<p>Ultimately I made the time investment to try some other approaches and have been finding that it&#x27;s possible to get much of the productivity of Rails at the (arguably worthwhile) cost of a bit of extra typing up front. If you know Ruby well already and have some business goals with some urgency behind them, certainly a great move. If you are earlier career and looking to invest in a productive skills set, you may be better served to consider a few different options.
wrestlerman大约 6 年前
I thought same in 2018 when I didn&#x27;t use Phoenix. But after trying out Elixir and Phoenix, damn... Elixir and Phoenix give you so much, nice websockets, concurrency, fucking easy to read code with great docs.<p>I was a bit sceptical about the praise Elixir was getting, but after working with it for a while... I started noticing a lot of stuff that is lacking or abused in Ruby and Rails.
评论 #19430929 未加载
chvid大约 6 年前
I think for what it is - for its paradigm if you will - ruby on rails is an extremely well-designed platform. But I think things have moved on and what was back then seen as the right way (or just fresh new way) is now seen differently.<p>For example - is it really &quot;better&quot; to say 7.even? rather than isEven(7)? (Strict OO vs multi-paradigm&#x2F;functional programming).<p>Or is the article&#x27;s example of a data model migration really better than a series of alter table sql statements? (Putting OO on top of a relation database using an ORM.)<p>And why not go for a pure SPA rather than an AJAX-sprinkled compromise between a traditional server-side rendered html app and a SPA?
评论 #19429802 未加载
评论 #19431408 未加载
评论 #19429217 未加载
gashaw大约 6 年前
Ruby is great, Rails is good enough.<p>The main issue with Rails (it&#x27;s the same with other frameworks) is that it discourages from doing proper design. The only design decision you make is where to put a piece of code, which is ridiculous (&quot;Fat models, skinny controllers&quot; is a bad design heuristic.)<p>Following Rails conventions works for small (simple) applications, but over time you arrive at a point where no one understands the whole thing. At this point someone suggests moving to microservices, and all hell breaks loose.
评论 #19430256 未加载
评论 #19430795 未加载
forty大约 6 年前
I have this joke that I noticed ruby&#x2F;rails developers seems to use a lot of their extra time (which they get with the high productivity you seem to get with rail) talking about how great ruby and rails are and how efficient they are with it ^^
评论 #19429151 未加载
Arubis大约 6 年前
Rails is still fine and appropriately boring (in a good way). Its issues are well known by now, and it’s pleasant to work with for backend CRUD work.<p>What TFA really appears to be writing about is that doing backend work in nodejs is a subpar experience. I have little trouble believing that. A more interesting comparison would be to Django (my gut feeling is that Rails compares favorably here), Phoenix (a different set of choices about how opinionated to be on the data model, different base language with some significant and relevant advantages), and other frameworks that one would deliberately learn to replace Rails.
tmm84大约 6 年前
My personal love for Rails is recent. I had been trying in my one to two hours of spare time on weekends (I am busy with exercise&#x2F;family&#x2F;gaming&#x2F;etc) to build a simple website for my wife&#x27;s company (simple crud stuff mostly). I found that several ways I had attempted to build the site were time consuming to learn&#x2F;compile&#x2F;test&#x2F;demo&#x2F;repeat. Even though I program for a living, starting from scratch takes time and one&#x2F;two hours per weekend is almost nothing when it comes to getting stuff done. When the PC I was using for building kicked the bucket and I got an old Macbook air, I tried Rails and within an hour I had got most of the base moved from Spring Boot to Rails. I can&#x27;t complain about Rails. The time investment to usable results are there. I think Rails is going to relevant like other web frameworks for a good long time.
LyndsySimon大约 6 年前
I see nothing at all wrong with Rails - I find it to be a perfectly valid choice in 2019, if that&#x27;s what you want to use.<p>That said, I&#x27;m not a huge fan of Ruby in general. I&#x27;m a Pythonist, and don&#x27;t see that changing in the near future. Python seems more straight-forward and &quot;shallower&quot; than Ruby to me, and there&#x27;s less &quot;magic&quot;. I&#x27;ll even contend that Ruby is a more powerful language than Python - but with the caveat that this in fact is its greatest weakness.<p>The example that comes to mind for me is when I needed to flash multiple alerts to the user using Rails; I re-opened the class Rails used to implement the behavior and modified it to keep an iterable of messages instead of only one. It was easy, sure... but what happens when the Rails class changes in the next version? My changes not only weren&#x27;t guaranteed to be compatible, they weren&#x27;t encapsulated from the parent class, and didn&#x27;t define and verify its behavior. I can totally see a circumstance where my class would appear to work without error, but the underlying implementation might have changed in subtle and unknown ways.<p>With Python, I&#x27;d have subclassed the parent implementation and wired my subclass up to the application. RoR doesn&#x27;t make this approach easy, and even if it did, it&#x27;s not idiomatic for that language.
评论 #19432717 未加载
etaioinshrdlu大约 6 年前
Does any free web framework have something more thorough than rails&#x27; Active Admin?<p>Django admin seems pretty unfinished by comparison. Haven&#x27;t seen anything actually better.
评论 #19428759 未加载
评论 #19429061 未加载
评论 #19428810 未加载
评论 #19429147 未加载
评论 #19430480 未加载
pankajdoharey大约 6 年前
Sure its relevant in 2019, which is why someone had to write &quot;Why it is relevant&quot;, the last time i remember i read something similar about Spring Framework and why it is still relevant <a href="https:&#x2F;&#x2F;www.theserverside.com&#x2F;tutorial&#x2F;A-Spring-summary-The-Spring-framework-is-still-relevant" rel="nofollow">https:&#x2F;&#x2F;www.theserverside.com&#x2F;tutorial&#x2F;A-Spring-summary-The-...</a>
StevePerkins大约 6 年前
What is the Ruby community like in 2019?<p>I&#x27;ve spent the past 20 years primarily working on JVM-based languages. Being told for about 19 of those years that my boring verbose tech stack stack is obsolete, and going away from the business world any day now.<p>Most recently, that voice comes mainly from the Node.js community. But 10 years ago, it was a mix of Ruby and Python upstarts. I kinda saw those languages and communities as two sides of a coin:<p>* The Python guys were the upstarts who leaned toward stability and practicality. Wore slacks and polos, or maybe t-shirts and jeans.<p>* The Ruby guys were more of the &quot;move fast and break things&quot; school, and favored aesthetics over performance. Had numerous tattoos, and shaved with vintage German double-edged safety razors and a badger brush.<p>It feels like Node took all the oxygen out of the room in terms of racing to be the Java replacement. But how have the shifts affected the identity of the Ruby community? Did they get older, mature, and come to resemble the Python community culturally? Or are there still a lot of young people disrupting things rapidly, and you just don&#x27;t hear about it as much anymore?
评论 #19431298 未加载
评论 #19431498 未加载
评论 #19431627 未加载
gjmacd大约 6 年前
The author took a bit of a pot shot at NodeJS (which I do understand why). But I think it&#x27;s a bit naive to think NodeJS is any more complicated of a stack or problematic as a whole than Ruby -- it&#x27;s simply not. As someone that&#x27;s moved between many different stacks, once you&#x27;re in that stack and being productive, you tend to realize &quot;oh, this is why this is a good stack.&quot; From the outside, if you&#x27;ve never used the stack professionally, you tend to get skeptical.<p>But for me these days, there&#x27;s very little difference between stacks as to &quot;what&#x27;s better&quot;. For me it&#x27;s mainly &quot;best tool for the job and who are are your carpenters?&quot;<p>But these days, NodeJS seems to be the right choice for many of these jobs and it&#x27;s hard to sit here and knock it. Why?<p>Unfortunately, Rails suffers from what a lot of other Web stacks suffer from -- the browser requires some level of JavaScript marshalling that all the other stacks have transform to. When you can code on the server and on the client in terms of the same language. It just makes the process cleaner and far more manageable. When an object on the server is the same as the one on the client. Your life just becomes a little less stressful.<p>And I love other stacks. I&#x27;m a Python fan.<p>But It&#x27;s really hard to not embrace NodeJS when you&#x27;ve got developers who work on the frontend (Maybe in React, Vue, etc.) and server developers who are on NodeJS and they can speak together, moreover, work within each others codebase and not kill each other.<p>That doesn&#x27;t mean Ruby is a bad stack, it just means like all the other stacks, you have to move data between the backend and browser and it&#x27;s &quot;Oh, I need this change on the server, I&#x27;ll have to wait for...&quot; -- no, you can do that, if you&#x27;ve got the ability to code in JS, and you&#x27;re a fullstacker, you can do both.
评论 #19431805 未加载
gumcreme大约 6 年前
While reading this thread, it feels like a flashback from 2009 and now, I remember what was my biggest gripe with Rails (next to all the bad parts mentioned here in this thread):<p>It is the culture.<p>I really find the Rails culture odd or tbh, I utterly dislike it. I mean if met a Go guy, he tells me all good with Go, it gets the job done but it has its warts, the same with Rust, node, React and so on. People of other stacks like their stack but it&#x27;s not about life and death. Only Rails guys have these issues and would start a flamewar right on the street and try to evangelize, yell at me why Rails is (always) the way to go and imply that I am not just wrong but also an incompetent developer. There were so dogmatic and when reading such posts in 2019, they are still this way.<p><i>Edit: as expected I got downvoted and this is what I mean, they take this too serious, Rails is their religion, Rails locked them in. Downvoting doesn&#x27;t bring your Rails back.</i>
评论 #19430703 未加载
dawhizkid大约 6 年前
Aren&#x27;t some large at-scale apps still on RoR? AFAIK Coinbase, Shopify, Twitch, etc...
评论 #19428649 未加载
评论 #19428717 未加载
评论 #19428781 未加载
mark_l_watson大约 6 年前
Off topic, sorry, but reading this article made me realize how much I miss using the Ruby language. Except for maintaining a legacy web app that uses Sinatra (and takes close to zero time to maintain&#x2F;devops) work and customer preferences have driven me to other languages. Ruby really is a pleasure to develop in.
fouc大约 6 年前
All the standard web technologies are still relevant.<p>MySQL &amp; PostgreSQL are still relevant.<p>Redis is still relevant.<p>Ruby on Rails is still relevant.<p>Javascript is still relevant.
评论 #19428871 未加载
评论 #19429935 未加载
sidcool大约 6 年前
I think Rails is fine. It gets you up and running super fast. GitHub, Heroku, Basecamp etc. run on Rails and they are doing great. It&#x27;s popular because it&#x27;s relatively &#x27;low-code&#x27; than other language&#x2F;frameworks. Ruby is quite simple to get started with and Rails&#x27; convention over configuration philosophy gives a lot out of the box.<p>Having said this, it&#x27;s not all rosy. Rails does buckle under scale, hence LinkedIn and Twitter had to gradually migrate to Scala(I think) based platforms. This is more a problem with Ruby than with Rails. A huge Ruby backend application becomes quite difficult to reason without a good type system. It&#x27;s not impossible, just more difficult than say Scala or Haskell or Rust, that have very strong static types.<p>I am sure I am missing a lot in this comment.
评论 #19431384 未加载
ausjke大约 6 年前
These days for new projects you may just use flask&#x2F;django depending on how complicated your application is. Python is top 3 language and its ecosystem is getting better daily, meanwhile it leaves many other scripting languages in the dust including ruby. Otherwise you can use a java framework or (maybe) node.js?<p>Node.js no longer has a good framework anymore, express is &quot;out of date&quot;, it still can&#x27;t do async&#x2F;await and Express 5.0 is not actively developed. The MEAN stack is pretty much gone. I wish there is something in the javascript&#x2F;backend&#x2F;nodejs field that shines like Django&#x2F;Flask as a framework.
SnowingXIV大约 6 年前
I also work on a Rails system. It does the job and the nice part about it is whenever I need to make tweaks I can easily dive into the code and implement said feature quite quickly. There are a few services I wrote that have a bit of overhead but that&#x27;s my fault - these typically go untouched as they are part of the backbone. I run this system on two different instances and I will say the difference between a few thousand records and a few million records is noticeable. There isn&#x27;t any memory leaks that I could detect or n + 1 queries, so I&#x27;ve kind of thrown my hands up. Most importantly though, it&#x27;s been super reliable. I&#x27;ll take the slight delay for robustness.<p>Recently I went the other way and built something with Flask because I felt I only needed something tiny (plus python and ruby are both friendly to read) and kept hearing the negatives about monoliths. It started out refreshing because I only added in what I needed but eventually this started to get a bit annoying as it grew, I felt I was rewriting the wheel often, and I missed the organization and forced convention of Rails. Not to mention gems seemed to have more support and often were more recently updated compared to flask imports. I now want to convert this over to a Rails application.<p>I think a lot goes into picking what to use, size of team, size of users being served, verasility, and development productivity. It&#x27;s not always only performance at massive scale (you may never need to handle the traffic Twitter does and if you do I think you&#x27;re doing pretty well and can weather that storm).
l33cher大约 6 年前
Why are people saying stupid things like this? I&#x27;m doing rails 24&#x2F;7 for the past 5 years in MANY different projects and I can say its the BEST and very relevant in 2019. I have to deal with other platforms written in different languages&#x2F;frameworks like php&#x2F;laravel and I can only pity developers that have to do that by choice.
评论 #19431226 未加载
philwelch大约 6 年前
As a former Rails developer, I figured it would be worth mentioning reasons I disagree.<p>&gt; Rails is not the fastest framework in the world… but I will argue that performance is the last thing you should worry about when you want to scale.<p>&gt; In my experience, NodeJS or projects written in other frameworks start to collapse architecturally after an alarmingly small amount of complexity is added to them.<p>&gt; More important than how many requests you can serve per second, is how your development team can maintain productivity over time.<p>This is what we call dismissing the actual concern (performance) and instead going on an unrelated talking point (maintainability). And frankly, legacy Rails apps are not actually that great to live in. The Rails approach, which I can best describe a “precious”, contains a lot of abstractions that don’t actually abstract successfully, breaking down when faced with the real world in ways that require ugly fixes.<p>&gt; Where should we put files relating to our data model? &#x2F;app&#x2F;model!<p>&gt; Where should we put our config? &#x2F;config<p>&gt; Our email code? &#x2F;app&#x2F;mailers<p>&gt; Decision made. Conversation over. Now let’s get back to our desks and write some code!<p>If your backend consists merely of “data models” (with business logic and behavior bolted on in an inflexible Kingdom of Nouns sense), routes, mailers, jobs, and maybe response templates, Rails is opinionated enough. At least until your business logic is complex enough that you can’t just use active records as your sole method of abstraction. (Also, the active records themselves are poorly conceived, with obvious foot guns that persist to this day, though at least they’re better documented now. But more on that later.)<p>I usually find that the architecture I get from Rails is neither necessary nor sufficient. Do I really need controller classes just to route endpoints to handler functions? No. Do I need an ORM? No. Do I need HTML templating? Also no. But I’m going to need more sophisticated design patterns than active records. Decoupling data access from business logic is one of the first and most important separations of concerns that exists, and Rails actively discourages that. Another crucial separation is between work that can be done locally (and hence unit tested) and behavior that entails a network dependency, which includes DB access! Rails really leads you down a bad path if you just naively follow the defaults, especially if your app is so monolithic that my mailers and asynchronous jobs are in the same artifact as my response handlers. (I’m not down on monoliths; Rails just does too much for a microservice and not enough for a monolith. Hell, Rails does too much for a macroservice let alone a microservice.)<p>&gt; Database management is hard. Managing database schemas and migrations is hard.<p>&gt; Rails provides you with a no-nonsense way of defining your database structures, as well as a full suite of CLI commands for migrating, resetting, seeding, dropping and creating databases across all environments.<p>&gt; Rails handles databases in a ubiquitous way. There are database drivers for almost every popular database, and schema management and Object Relational Mapping is handled the same way across all data stores.<p>These are almost all false.<p>* SQL isn’t hard to use for schema definitions or migrations. The Rails DSL for database schemas is marginally prettier than SQL, at the expense of adding an extra layer of indirection and making you learn yet another precious Ruby DSL when, if you’re worth your salt, you already understand SQL anyway.<p>* Rails has an inbuilt assumption that your app connects to a single DB instance per environment. Cool, but why on earth would I connect to different RDBMS systems across environments (except <i>maybe</i> in-memory SQLite for “unit tests”, which is already an anti-pattern?). And given this constraint, what exactly does ActiveRecord get me? I can wake up one morning and just port my whole app to Postgres without changing a single line of code? That’s not bloody likely in the real world and we all know it.<p>* Rails adds even more unnecessary brittleness to common DB access scenarios, which paradoxically means that the “simple” but broken Rails solution has to be augmented or replaced by ugly workarounds. For example, ActiveRecord validations are inherently prone to race conditions that make them both unnecessary and insufficient. From the current Rails guide:<p>&gt; 2.11 uniqueness<p>&gt; This helper validates that the attribute&#x27;s value is unique right before the object gets saved. It does not create a uniqueness constraint in the database, so it may happen that two different database connections create two records with the same value for a column that you intend to be unique. To avoid that, you must create a unique index on that column in your database.<p>OK, so the uniqueness validation doesn’t guarantee uniqueness if there are concurrent connections to my DB. Also, every real world Rails app is deployed so it runs as multiple processes. So it never guarantees uniqueness. Instead, I create a unique index, and ActiveRecord...sometimes throws an exception that’s distinct to the RDBMS but not distinct to the failure mode, so I still have to string match against my DB’s particular phrasing of “uniqueness constraint got violated” and handle that as an unnecessarily generic Ruby exception. Which is exactly the same amount of work that would exist if uniqueness validation just wasn’t a Rails feature to begin with.<p>A thoughtful design would realize: at least some validation <i>has</i> to happen in the DB and not in the application code, and it will anyway, so let’s make patterns for living with that. Why don’t my models automatically detect my unique indexes and throw a “not unique” Rails exception when the DB complains? Why does it instead insist on doing a shitty job of trying to guarantee uniqueness itself? It gets worse and worse when you run into scenarios like, “I want to run SQL queries that don’t cleanly map onto ActiveRecord without monkey patching every damned column of the result set onto individual instances of a loosely related ActiveRecord class”.<p>&gt; Rails (and Ruby) Have a Deep Culture of Code Quality<p>Hah. I think I’ve already debunked that one. Rails has a deep culture of precious, brittle abstractions that make easy things easier and hard things harder if not impossible.<p>&gt; Asset Management<p>If your app is monolithic enough that you’re managing your assets in your Rails app, it’s probably big enough that you’ve run into the problems with Rails I’ve mentioned earlier. If it isn’t that big, odds are you’re in a microservice environment where your assets are most likely deployed in a highly decoupled way—perhaps from a separate repo owned by your front end devs. Maybe the asset pipeline is a perfectly reasonable way of managing a full-stack monorepo, and you can still deploy your Rails assets to a CDN and make it work. But that implies that your web app is a Rails monolith, and Rails monoliths need a lot of thoughtful design decisions above and beyond “put models in app&#x2F;models”.<p>&gt; RSpec is quite simply the gold standard for behaviour driven development, and almost single-handedly created the BDD movement that is still raging in the industry today nearly a decade later.<p>RSpec is nothing special. I actually find Spock a lot more featureful and self-documenting.<p>&gt; A Smorgasbord of Plugins<p>The first plugin on the list he links to is activerecord-import, which only exists to work around a problem Rails itself creates in the first place. The rest are either generic things that every other language has and other instances of workarounds for Rails limitations.<p>Rails (and Ruby in general) isn’t unique in terms of library support. Python has greater breadth, JVM has greater breadth, heck I bet you can still find stuff on CPAN that never made it into a RubyGem.<p>&gt; Heroku<p>Works with everything; not a selling point for Rails.<p>&gt; ActiveAdmin<p>Admittedly, something like this is one of the few redeeming qualities of an ORM, which is why Django always had this built in. Why not Rails?<p>The article keeps saying that Rails is “batteries included”. “Your app behaves in a reasonable way without ugly DB-specific exception handling code if you run more than one parallel instance of it” didn’t count as batteries either, though. But I guess HTML templates did. Rails’ design choices would be logical if you treat Rails as a framework for prototyping, but isn’t that when you need admin screens the most?<p>&gt; Rails is battle-hardened and industry-proven. There is a long list of (very) successful businesses building their product with Rails.<p>Starting with Twitter, which migrated away from Rails onto a JVM backend as soon as they grew up. If you want to go with “battle-hardened and industry-proven”, use the Spring ecosystem. You can even deploy it on Heroku.
评论 #19430043 未加载
评论 #19430589 未加载
belenos46大约 6 年前
Man. I like two things. Boring languages&#x2F;frameworks, and minimalism.<p>Boring languages&#x2F;frameworks Just Work, and are usually pretty secure.<p>Minimalist --which is to say, making something as simple as possible, but no simpler-- means fewer moving parts which can break in production.<p>90% of what my places of employment and clients need is the same old shit, and I like to build it so that when something breaks, I can jump in and hammer out the broken thing and get the process moving again without needing a ton of research.
devin大约 6 年前
Big no thanks on citing the wisdom of one “uncle bob”, but otherwise, yeah, the framework is relevant if not dominant, and that’s just fine. Live long and prosper.
smartstakestime大约 6 年前
rails did the opposite of php , and I think its harder for it to pivot in its community.<p>-php started with no framework , everyone just did super minimal strait to the db and template query stuff, very unorganized but you knew the underlying apis and tech because you were right up against them<p>-rails started very ridged. separating programmers from the underlying apis and tech<p>Now php devs had to create the ecosystem of organization but the experience of working with the the server and db was still useful particularly when doing something unique or when one needed special performance<p>Ruby devs needed to learn to become leaner how to break away from the framework when performance was needed. This was completely new and I feel the community did not support scripting away from ruby. Mostly the community was focused around ease<p>also at the same time PHP was improving the language. I dont think Ruby had the same improvement and some of the stuff I have heard about ruby makes me cringe.<p><a href="http:&#x2F;&#x2F;rubylearning.com&#x2F;blog&#x2F;2010&#x2F;09&#x2F;27&#x2F;almost-everything-is-an-object-and-everything-is-almost-an-object&#x2F;" rel="nofollow">http:&#x2F;&#x2F;rubylearning.com&#x2F;blog&#x2F;2010&#x2F;09&#x2F;27&#x2F;almost-everything-is...</a>
评论 #19429341 未加载
danenania大约 6 年前
These days I find myself thinking of Rails as primarily a dsl for modeling data in SQL. I still don’t think anything beats it for this purpose.<p>But all things considered, I think TypeScript&#x2F;react&#x2F;lambda with VSCode is now a better choice for developer and devops productivity in both the short run <i>and</i> the long run. It’s still a good idea to follow many of the Rails conventions though regardless of the language you use.
clessg大约 6 年前
This article reads to me as more of a &quot;Rails vs Node.js&quot; piece, which seems almost too easy—I would be interested in a more thorough comparison of Rails versus other frameworks. Here I will attempt a comparison, limited in length as this isn&#x27;t a blog. :)<p>My personal favorite up-and-coming framework (and admittedly, my favorite web framework overall) is Phoenix[1], written in Elixir[2], a functional programming language with a focus on concurrency, performance, and developer productivity. In my opinion, Phoenix has almost all of the best parts of Rails without nearly as many of the warts, and adds a plethora of compelling features of its own.<p>Despite what the author argues, I believe that raw performance and developer performance are equally important, and even intertwined. Why? A slow application results in lost customers and revenue, a fact that is well-documented. A default Rails application is going to be quite slow, requiring intervention. Of course, most larger Rails apps are not necessarily slow in practice—in my experience, this is largely because the code is littered with brittle caching logic and hacks requiring many human-hours to maintain and debug when things go wrong. Thankfully, Ruby is seeing improvement in the performance realm.<p>Phoenix achieves massive scalability, raw performance, and developer performance, without requiring significant trade-offs and caching logic littered all over your code. It is an absolute joy to write Elixir. Phoenix is famous for consistently achieving microsecond response times without caching, and being capable of holding millions of websocket connections[3]. Granted, Elixir as a language is not computationally fast, but the typical web app is not performing expensive computations, but instead juggling IO, which Elixir handles extremely well. CPU-intensive tasks can be written in a different language if need be.<p>Importantly, Phoenix is <i>not</i> your application—Phoenix&#x27;s job is to provide a web interface into your broader Elixir application. Thus, Phoenix is more of a toolkit than a framework, and yet it provides everything you would expect in any web framework, with strong conventions based on the solid foundation of Elixir. You could migrate to a different framework with relative ease. You can easily integrate different interfaces into your application, such as a CLI frontend. This is in contrast to Rails, where Rails <i>is</i> your application unless you actively fight against the framework.<p>Ruby and Rails are notoriously bad at handling concurrency and real-time features using e.g. websockets. This becomes progressively painful as using all CPU cores becomes increasingly necessary, and as websockets continue their ascension on the web &amp; mobile. In contrast, concurrency and soft real-time communication are Elixir &amp; Phoenix&#x27;s bread-and-butter.<p>As I mentioned, Phoenix brings compelling features of its own. The most interesting to me is the upcoming Phoenix Live View[4], which will allow developers to write rich, interactive, real-time applications without being forced to wade into JavaScript hell. Read the linked article for more information. I could be wrong, but I don&#x27;t see something like Live View making its way into Rails, especially without significant downsides.<p>One area where Ruby &amp; Rails trounce Elixir &amp; Phoenix is maturity. Although they have gained significant traction, Elixir &amp; Phoenix are still comparatively immature. Thus, you&#x27;ll have a harder time hiring, finding third-party libraries, and answers to questions. That said, Elixir is based on Erlang, which is extensively battle-tested and has a huge assortment of libraries available. (You can very easily and naturally use Erlang code in Elixir.)<p>I could go on, but I think this has gotten long enough.<p>[1] <a href="https:&#x2F;&#x2F;phoenixframework.org" rel="nofollow">https:&#x2F;&#x2F;phoenixframework.org</a><p>[2] <a href="https:&#x2F;&#x2F;elixir-lang.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;elixir-lang.org&#x2F;</a><p>[3] <a href="https:&#x2F;&#x2F;phoenixframework.org&#x2F;blog&#x2F;the-road-to-2-million-websocket-connections" rel="nofollow">https:&#x2F;&#x2F;phoenixframework.org&#x2F;blog&#x2F;the-road-to-2-million-webs...</a><p>[4] <a href="https:&#x2F;&#x2F;dockyard.com&#x2F;blog&#x2F;2018&#x2F;12&#x2F;12&#x2F;phoenix-liveview-interactive-real-time-apps-no-need-to-write-javascript" rel="nofollow">https:&#x2F;&#x2F;dockyard.com&#x2F;blog&#x2F;2018&#x2F;12&#x2F;12&#x2F;phoenix-liveview-intera...</a> (Repo: <a href="https:&#x2F;&#x2F;github.com&#x2F;phoenixframework&#x2F;phoenix_live_view" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;phoenixframework&#x2F;phoenix_live_view</a>)
评论 #19430433 未加载
derekdahmer大约 6 年前
Was anyone saying Rails wasn&#x27;t relevant?
评论 #19430757 未加载
评论 #19429163 未加载
lurker213大约 6 年前
In my opinion, Rails &#x2F; Ruby is nearly unbeatable in terms of productivity when you add trailblazer to the mix.
评论 #19428976 未加载
danmaz74大约 6 年前
Meta: I read this on the tube, and wanted to write a comment when in the office. Came here, and it&#x27;s well out of the first page, even if there were many additional upvotes. I really wonder who hates rails so much to flag an article about it, and why.
_hardwaregeek大约 6 年前
I think Rails could go far if DHH et al keep their ears to the ground about the state of web development and adapt accordingly. It still has some killer features that I&#x27;ve yet to see replicated with as high a level of ergonomics and elegance.<p>For instance, GraphQL in Rails is smooth like butter. You define the types and the fields just resolve like magic based on your models. I wrote an API a while back and it was just stunning at how easy it was to write. Only issue? I wasn&#x27;t using Rails. I was using all of the niceties of Rails like autoloading, ActiveSupport, ActiveRecord, associations, etc., without the actual, framework of MVC. If Rails could really invest in the API mode and get it working with say, GraphQL, I could see it working amazingly.<p>Plus, you could take the DSL idea and expand it to GraphQL. GraphQL top level queries and mutations take similar forms (get all of resource, get one of resource, etc). You could easily abstract that into a DSL if you&#x27;d like.<p>Authorization and authentication in GraphQL isn&#x27;t amazing either. I&#x27;d really like to see someone making that simple and on by default.<p>There&#x27;s also some generic Ruby tooling things that&#x27;d be nice. Types, of course. The standard way would be a mypy&#x2F;TypeScript esque annotations with erasure at runtime, but I actually feel like Ruby could do something really neat and really true to the language by developing runtime dependent type checking. Autoformatting would be nice (any thoughts on rufo[0]?)<p>[0] <a href="https:&#x2F;&#x2F;github.com&#x2F;ruby-formatter&#x2F;rufo" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;ruby-formatter&#x2F;rufo</a>
revskill大约 6 年前
Rails needs more opinionated decision on frontend story. Just pick ReactJS instead ? Not a bad idea. Or VueJS ? Neither a bad choice. It&#x27;s the main reason i don&#x27;t choose Rails over a universal Node.js stack for the HTML rendering part.
评论 #19428520 未加载
评论 #19428498 未加载
crb002大约 6 年前
Rails will have a resurgence with a Data Driven Design generator like JHipster. So much time saved when you get front end client side validations generated automatically; and layout is 90% automated with UI constraints.
dmitriid大约 6 年前
In the past 14 years we somehow lost the ability to do “Your blog in 15 minutes” videos for any framework [1].<p>I wonder if that “do X in under 20 minutes” can be replicated in modern-day Rails.<p>[1] <a href="https:&#x2F;&#x2F;mobile.twitter.com&#x2F;dhh&#x2F;status&#x2F;492706473936314369?lang=en" rel="nofollow">https:&#x2F;&#x2F;mobile.twitter.com&#x2F;dhh&#x2F;status&#x2F;492706473936314369?lan...</a>
hombre_fatal大约 6 年前
I don&#x27;t know how to quantify how relevant Rails is today, but I do think it&#x27;s interesting to explore why Rails isn&#x27;t as popular as it once was. I remember just eight years ago, Rails was on the HN frontpage almost daily.<p>Some ideas:<p>I think the most critical trend has been the dissemination of the Ruby ecosystem&#x27;s most popular and best ideas into every other ecosystem, which I would summarize as a culmination&#x2F;caricature of a movement that was already in motion thanks to other ecosystems like Perl and Python. Rails was such a massive hit because it was a stark contrast to the tropes of complexity that came before it like endless XML configuration and IIS. I think Rails was a symbol of this whole renaissance, not single-handedly, but because it coincided so well with a critical-mass milestone in our industry and hit so hard with this cult of &quot;fun and easy&quot;. And these days were back when <a href="https:&#x2F;&#x2F;rack.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;rack.github.io&#x2F;</a> came out and Zed Shaw wrote Mongrel which was Twitter&#x27;s first web server and one of Ryan Dahl&#x27;s inspirations for Node.js.<p>These represented identity-level changes in tech and its crescendo into the mainstream, not ideas that would merely spark and die in the Ruby ecosystem, so it&#x27;s no surprise that Rails cannot command the same gravity over time.<p>Another trend has been the popularity explosion of smaller and simpler solutions over monolithic frameworks. For example, trending away from things like GWT and ExtJS and Ember and Meteor. Trending towards things like React and Express. No Rails analogue caught on in Node or Go and nobody cares.<p>There&#x27;s also the explosion of Javascript which became such a viable alternative to other dynamically-typed languages (particularly Ruby in this context) that &quot;why should I pick Ruby?&quot; became a harder and harder question for beginners to answer.<p>Finally, there&#x27;s the explosion of choice. One back-end application framework just can&#x27;t dominate HN anymore like it could in 2007. I think React is the modern repeat of Rails in the sense that it popularized a new paradigm of building applications. And I think React will go the way of Rails in the sense that its ideas will become so ubiquitous that React itself won&#x27;t stand out anymore, like when we see UIKit2 adopt these sorts of unidirectional data flow and FP ideas as a core first-class abstraction. And we&#x27;ll get so used to it that we&#x27;ll wonder &quot;so what was the big deal about React again?&quot;<p>Rails is certainly still amazing software and is clearly still improving. I generated a fresh Rails project half a decade ago after a long hiatus and was blown away when the error page in the browser had an embedded Pry REPL initialized at the error&#x27;s stack frame iirc. That&#x27;s some wtf-level polish. And I can only imagine how much better Rails has become since.
评论 #19428995 未加载
评论 #19431221 未加载
sklivvz1971大约 6 年前
&gt; I will argue that performance is the last thing you should worry about when you want to scale.<p>Oh boy, this is in one sentence almost everything that is wrong with Rails...
fareesh大约 6 年前
I feel like Ruby&#x2F;Rails needs to introduce some way of eliminating bloat through some kind of optimization steps at the time of deployment.
JamesAdir大约 6 年前
Some stats from Who is Hiring March 2019: Number of occurrences of the words: Rails - 25 Elixir - 13 Python - 76 Ruby - 29 Django - 20
Smithalicious大约 6 年前
Heh, from the rise of Rails as the hot new thing to blog posts trying to justify its continued existence, it all went pretty fast.
评论 #19430294 未加载
miki123211大约 6 年前
how relevant is Rails in the age of SPAs? How well does it work with making JSON APIs and hosting static React apps?
评论 #19428965 未加载
mrtweetyhack大约 6 年前
Too bad we can&#x27;t compile a Rails app...
mavdi大约 6 年前
Every time I read an article about something still being relevant, it soon becomes irrelevant.
评论 #19428663 未加载
评论 #19428442 未加载
mping大约 6 年前
Rails is fine but didn&#x27;t age well, specially the lack of strong functional programming support. Other nag is that it&#x27;s hard to not do things the rails way - this monoculture reinforces the appearance that is fine because people looking to do something different just don&#x27;t use rails. And when you &quot;scale&quot; rails is not really rails that scales as much as it is the architecture - it could be applied to other frameworks. Still if you are familiar you can write stuff really quickly.
评论 #19429215 未加载
jmchuster大约 6 年前
Rails is a great monolith framework, but a monolith will eventually reach its limits, due to size&#x2F;complexity of the team or the task at hand. I think providing a better story around how to prepare for or handle that transition would definitely serve Rails a lot better in the long run. But, as long as the main target audience of Rails is Basecamp (a saas tool with 12 developers), I don&#x27;t see it in the future.
评论 #19428589 未加载
pankajdoharey大约 6 年前
Mostly an opinion piece, A few points to Observe :<p>* According to the author NodeJS fails architecturally when small amounts of complexity is added to it.<p>=&gt; Same applies to Rails aswell, anything beside a crud app and you start wondering which code goes where.<p>* Rails is Opinionated...<p>=&gt; Great if it were 2006, In 2019 rest apis are a norm, and more Nodejs apps get enabled everyday have the same feature. Infact serverless apps to have the same features. In my view firebase or similar apps is the right way to go when you are booting your apps, and then scale or rewrite when you grow.<p>* Rails has a deep culture of code quality.<p>=&gt; So does smalltalk, lisp and clojure. Infact ruby community has borrowed many ideas from both Smalltalk and Java communities.<p>* RSpec ..<p>=&gt; Rspec isnt the original invention its based on JMock.<p>* Heroku, ActiveAdmin, Industry Proven ...<p>=&gt; Straw-man arguments.<p>I am as opinionated as rails and in my opinion Rails isnt relevant in 2019, they are running out of ideas, the latest &quot;innovation&quot; in rails is an inbuilt <i>Rich Text editor</i> called Trix available as ActionText. Yes you read it correctly a rich text editor is the latest relevant innovation in a web framework. I think for most startups a great way would be to start with a serverless setup like Lambda or Firebase .... and just write the relevant front end bits in Javascript, Coffeescript, Clojurescript or Elm. When the app outgrows such services just write the enough parts of backend service as you need it.
评论 #19433150 未加载