23 ms·
The Rails Doctrine
- criddell 11y agoNow that Rails isn't the cool new thing anymore, is it still a good choice for new projects? For the new year, I'm thinking about the programming landscape and contemplating what I want to learn next. I've tinkered with Ruby on Rails in the past and think DHH is on to something with the doctrine he has laid out. I've only scratched the surface of Rails, but it still seems pretty neat to me. A deeper dive would be fun. On the other end of the spectrum, Dart + Angular is appealing in part because I'm a fan of some of the Google developers working on Dart. While Rails feels like it is entering a comfortable middle age (or at least adulthood), Dart feels a little like a car being assembled as it cruises down the interstate. It's new and maybe a bit dangerous. Both projects are super-appealing to me. Unfortunately time constraints prohibit me from chasing both and I'm interested in opinions especially of Rails people. Are you still excited about it?
- chrisseaton 11y ago> Now that Rails isn't the cool new thing anymore But why does that have an impact on what tech you use?
- deleted 11y ago[deleted]
- criddell 11y agoIt's a good question and it's really what I'm asking about. The only web-stuff I've worked on in a commercial settings was a long time ago using Java and Tomcat. At the time, it was the cool new thing. I think that some of the pain points of languages and frameworks from that era are what prompted DHH to develop Rails (I'm specifically thinking about convention-over-configuration and admit I could be totally wrong here). So today, I probably wouldn't pick Java and Tomcat for a personal project just because I know it won't be as fun and I won't be as productive as I would be with different technology. Has Rails been eclipsed in a similar way?
- halostatue 11y agoNo. I’m running a team of developers where we are using Rails as our first-line tool, but we are also committed to using the best tool to solve the jobs at hand. So far, we have only needed to add Lua for a small piece of what we are doing because we can reason about what our logic is supposed to be doing quickly and easily in Rails. Less than a third of my team were Ruby or Rails developers before joining us, and we are always pushing forward on learning more so that we have a great bucket of tools available as we try to solve our business problems and we hit those things where trying to reason about the problem is difficult in Rails, or where performance matters more than readability and code clarity.
- edwinnathaniel 11y agoI'll pick Java, SpringMVC, Maven, JUnit+DBUnit, and FlyWay (DB migration) and any appserver (jetty, tomcat, TomEE, glassfish) thrown at me except from the BigCos (WebLogic, WebSphere). Those tools are pretty close to what Rails give you (notice the View/UI is open for anything... Rails View is slightly nicer as it has better templating capabilities but ... not a deal breaker for me). It's not sexy, it gets the job done, and I know it'll run for at least 5-7 years with minimum hassle. Plus it's easy to be productive on Java project...
- nemild 11y agoEven as someone who uses the newer languages/frameworks, I wish I could upvote this statement multiple times: "It's not sexy, it gets the job done, and I know it'll run for at least 5-7 years with minimum hassle."
- jazzyk 11y agoUpvoted. I am tired of getting the "uncool old fart" looks every time I propose similar stack. You CAN do cool stuff with established tech plus have a peace of mind that you will not run into any "surprises".
- criddell 11y agoIt makes total sense to mitigate risk on a commercial project by going with established (well supported, well understood) technology. No argument. But for a personal toy project where you want to be surprised, would you choose something like Ruby on Rails?
- mokkol 11y agoInstead of cool & new, think about Rails is stable and mature :) And yes I think you should consider to use Rails. In my opinion it is one of the best back-end frameworks out there.
- aikah 11y ago> Rails is stable Rails certainly is mature, its APIs are not stable at all. With every version,even minor, there are annoying changes that often break 3rd party plugins. It shouldn't happen. That's why JEE has specs, as heavy as they get 3rd parties can always refer to them in order to write custom code. Rails is anything but stable. Hard to complete a single tutorial online without running into API issues.
- Luyt 11y agoI got my first error right after `rails new myapp` and `rails server`. After some Googling I found out that apparently I had to install Node.js also, but the error message wasn't very clear. This was the official 'getting started' rails tutorial on the rubyonrails.org site [0]. [0] http://guides.rubyonrails.org/getting_started.html http://guides.rubyonrails.org/getting_started.html
- nik736 11y agoWell, you need a javascript runtime, eg you could install nodejs, that's what the error says. I agree that it might be confusing as a rails beginner, but Rails uses it to convert CoffeeScript files and for minifying and merging all JS stuff into one file.
- akavi 11y agoI'm not sure I understand why "comfortable middle age" is a negative. Unless the argument is that Rails has either a) accumulated damaging cruft or b) missing out on important new features/paradigms, "comfortable middle age" seems like a huge selling point, right? Battle-tested, mature, a huge amount of shared knowledge, etc?
- criddell 11y agoI didn't intend for that to be a negative, just that it's a different point in it's life. I'm not trying to make any argument about Rails, but am very interested in your opinion. Has it accumulated cruft? Is it missing something that newer frameworks have embraced?
- jaredcwhite 11y agoI didn't learn Ruby/Rails back when it was the "cool new thing" -- I resisted and tried to wrestle PHP to my liking. Eventually I gave up and threw my hat in the ring, and I'm so glad I did. My advice is to learn Rails first, and then take all the wonderful things you've learned and apply them to other languages and ecosystems if you wish (many libraries and frameworks for Javascript and other langs are inspired by Ruby or Rails). I don't think it's as valuable to attempt the reverse...
- lmm 11y ago> Now that Rails isn't the cool new thing anymore, is it still a good choice for new projects? It's probably the best choice for a straight-up CRUD webapp (as was always the case). I wouldn't want to do a project with nontrivial business logic in an untyped language these days (having seen how little flexibility you have to sacrifice for safety in a modern typed language), but your views may differ.
- mattmcknight 11y agoAgree on CRUD, but on typing I'm the opposite. Anything sufficiently complex logic, especially etl or projects with multiple models of the same entity, is easier for me in a language with duck typing. It's just amazing how all our brains adapt slightly differently to the different sorts of problems we face and the bag of tricks we use, in addition to the different languages and tools.
- oldmanjay 11y agoI feel bad for anyone who has to swim in your wake. People who embrace dynamic typing generally create write-only code that no one can maintain, since they labor under the delusion that little things like clarity of purpose are a waste of time.
- mattmcknight 11y agoDuck typing vastly reduces the amount of code one has to write that does nothing, making the purpose of the code much more clear. The tradeoff is in compilation, not clarity of purpose. The code tends to be more flexible to changes in the underlying data, as it is easier to modify! A sad example of those defending static typing are the Java programmers. I point out that Java supports duck typing via reflection, even if the syntax is painful. They say they don't use reflection, they use Spring. [Head in hands] In any case, there are many happy programmers in my wake, they don't need your sympathy! :-)
- kazagistar 11y ago
- song 11y agoWhen doing projects on the side, I like to play with node.js or Elixir but when I have to develop projects for paying customers, I tend to gravitate towards Rails... Few reasons for that: 1. I'm extremely productive and fast at developing in Rails 2. It's much easier for the client to get an app that's develop for a Framework that's been there for a while, is stable and will continue to be there 3. Ruby is a nice language and the principles behind Rails resonate with me (so it's not like Java and Spring which I was eager to get rid of when I switched to Rails a bit over 10 years ago) That doesn't mean that I don't use node.js for certain specific use cases on client projects... But my goto framework is Rails
- kyllo 11y agoI would say yes, as long as you're building a greenfield project that is a database-driven web application, where your priorities include high productivity and quick time-to-market. It's basically been the default choice for web startups for several years now, lots of startup devs know it, and there are battle-tested libraries available for just about anything you want to do with it. And it is still aggressively adding new features, e.g. first-class support for websockets just came out in rails 5.
- Skoofoo 11y agoTools don't necessarily become less useful with time.
- ebiester 11y agoIt depends on what you want to build. I find nothing novel in either tool, so I don't think it's good to learn in a mind-expanding sense. For building medium-sized external-facing apps, rails is one of the better choices out there. For building long-running client-side applications, angular isn't a bad choice (though I prefer Ember for that constraint, personally.) If you live in the land of Oracle or other proprietary databases, I wouldn't suggest rails. It has some rough edges in my experience. Otherwise, I think you should find a project and run with it, or join a place already in the rails ecosystem. I wouldn't learn it for its own sake.
- patio11 11y agoI've been programming Rails since 2010, and still feel like it's far-and-away the most productive I've ever been for turning SQL into HTML and then user actions back into SQL. If your task is SQL into HTML and then user actions back into SQL, with a few "sprinkles" of Javascript on top of it, Rails will not steer you wrong. I have also recently been doing, for the first time in a long while, work which is not SQL into HTML and then user actions back into SQL. Rails was never seriously considered for that part of the project. This was the correct call, and the new stack (GoLang and React) are fun things to have in my toolbelt, but there have been a few points this year where I've said "I just spent two hours on something which would have been 4 lines in Rails and I'm not sure I'm done yet."
- criddell 11y ago> turning SQL into HTML and then user actions back into SQL You've really distilled it to it's essence and that has given me a lot of clarity. The company I work for uses an issue tracker written with Ruby on Rails (Redmine). There's a few things I'd like to change and so I think I'm going to spend the first part of this year getting comfortable with Rails and making a few changes to Redmine that I'd like to see. Then, I might transition to Dart and see if I can put together an interesting browser-based client.
- sb8244 11y agoRails is an awesome framework to develop in. For me, however, it is less about Rails and more about the community. Take for instance the popular Ruby job processing system, Sidekiq. It integrates very easily into Rails and makes that whole async job thing painless. I haven't seen anything as sophisticated in other languages. ActiveModel is also a very nice library to work in, and having it by default is nice. I personally do Rails backend + Angular frontend and it is a very rewarding stack. I get the power of Angular, but the simplicity of Rails in the backend. DHH is wholly against that, but it works really well.
- resure 11y agoHe is not against angular-like frameworks, he is against attempts to apply them everywhere.
- jaredcwhite 11y agoI think DHH has realized that Rails has a bit of an "image" problem when it comes to new web app development, and this is a way to lay out why Rails remains relevant and even desirable. No doubt some will take exception to some or most of his points, but that's OK. For the rest of us who thrive in continuing to build with and evolve the Rails ecosystem, it feels good to see a renewed focus on communicating just what makes Rails (and Ruby) special and vital.
- miseg 11y agoI know PHP-bashing is oldschool, and I love what I've been able to do with PHP. After a decade of me in PHP, his love for Ruby is a lovely selling point for trying out that language.
- xyzzy4 11y agoThe main problem with Rails is that other developers you work with have strong opinions about coding style, and they hammer you on code reviews if you don't code their way.
- shampine 11y agoI'm not sure I agree that makes it a Rails problem, more of a developers who happen to use this tool problem.
- lmm 11y agoCommunity is part of tool choice though, for better or for worse.
- xyzzy4 11y agoIt's partly a Rails problem because there's a ton of different ways to implement something, so people will always find reasons to disagree with what you did. And the Rails community seems particularly over-opinionated about these things. There's a lot of cargo cult thinking going on when your stuff gets code reviewed.
- halostatue 11y ago…which is not a Rails problem, but an inexperienced developer problem.
- mountaineer 11y agoWork with on open source projects or with with in a company? In either case, having some agreed upon coding style guides may help reduce individual style conflicts. * https://github.com/airbnb/ruby https://github.com/airbnb/ruby * https://github.com/thoughtbot/guides/tree/master/style/rails https://github.com/thoughtbot/guides/tree/master/style/rails
- xyzzy4 11y agoIt was at a startup.
- sauere 11y agoFunny, everything in this post is exactly why i prefer Python(+Django/Flask) over Ruby(+Rails). Too much magic happening everywhere, a gazillion of built-in methods, weird shit happening all over the place, all that combined with all the syntactic sugar Ruby offers. Granted, it might look "beautiful" in the eyes of a experienced RoR developer, but personally i find it just makes code very hard to read. Just my 2 cents.
- glossyscr 11y ago> Too much magic happening everywhere, a gazillion of built-in methods, weird shit happening all over the place Couldn't agree more on this. Magic is good if you understand the underlying stuff but if you don't and you are once offtrack you are lost. Maybe it's also a matter of taste. However the hype and traction DHH could build when RoR started was quite impressive.
- jshen 11y agoI think this is wrong. Nearly all of us build on top of things we don't understand. I don't understand the physics of a harddisk, or the pipelining of a CPU, or some of the low level OS functionality. The issue is when do each of us, as individuals and/or teams, really need to understand more. And perhaps more importantly, when does it make business sense to leverage magic to get to market faster, build cheaper, or find market fit before worrying about building the most robust thing possible.
- deleted 11y ago[deleted]
- random_rr 11y agoThat's a pretty crazy claim. So, do you build your own interrupt gates, and take those into account when you're writing PHP? How about electrons? Can you draw me a graph of the electrons currently residing in your computer case/laptop? Can you explain to me exactly how your PHP code will look in binary? Sorry to be snippy, but you're making a pretty audacious claim there. I don't think any reasonable software engineer/developer can claim to fully understand every underlying principle. I mean, you can have an abstract, high-level idea of how things work, but do you really think you know the intimate details of every single piece of hardware/software involved in writing your code?
- bcardarella 11y agoFor those that are interested in a more performant and scalable Rails-like experience I encourage you to check out Phoenix: http://phoenixframework.org http://phoenixframework.org We have been working with Elixir (the language Phoenix is built on) for over a year. It is an incredibly satisfying language and its toolset is surprising advanced for its age. Phoenix has been a very easy mental jump for our developers who were already trained on Rails.
- rgawdzik 11y ago+1 to that, it has comparable performance to Gin! https://github.com/mroth/phoenix-showdown https://github.com/mroth/phoenix-showdown
- flashm 11y agoTo add another side to this coin, having recently used Phoenix to write an api after hearing good things, I found Elixir clunky, and Phoenix poorly documented. It tries to be too much like Rails (I realise this is the point, though), and is currently failing spectacularly in my opinion. YMMV obviously.
- chrismccord 11y agoIn the spirit of making our docs better, what did you find poorly documented? We go to great lengths to have extensive, comprehensive docs. Pick any module in our source, and you'll find extensive documentation on usage, APIs, etc. All docs are extracted to hexdocs.com as well http://hexdocs.pm/phoenix/Phoenix.html http://hexdocs.pm/phoenix/Phoenix.html This is in addition to our separate online guides focused more on getting up and running through the basics. Where did we lose you?
- BuckRogers 11y agoThis attitude has been shown by multiple people involved with Elixir/Phoenix from what I've seen. I'm impressed and though I'm not using Phoenix, I am very interested and that general attitude of "where did we lose you" has really raised the language/framework's status in my mind. I'm a Pythonista and feel more coerced/shunned by the leaders of that community, to the point where I feel like I'm somehow "part of the problem". I definitely see Phoenix/Elixir in a positive light and at some point will give it a fair shake for myself.
- jerguismi 11y agoIt is funny how small things affect your future. I did a lot of stuff with rails back in 2007 or so. However I really got fed up with it because some things were so slow. So for the next project I decided to pick up django, and I've been using django since then. Would it have made much difference if I had staid with ruby/rails instead of python/django? I dunno. Many of my friends have careers with rails, and they have nice careers. I have nice career as well, as do many other friends with django. In the end they are not that different, I guess.
- sadiqmmm 11y agoDHH is amazing.... Thank you for creating RAILS.
- rileymat2 11y agoAbout picking the "Best" tool for the job. One annoying thing about Stack Overflow is that they aggressively stop those types of questions with their mod system. Just understanding the Pros and Cons of the major options is very valuable, but not allowed.
- nchelluri 11y agoI could not agree more. I think they tried to promote other sites in their network for this sort of discussion but as far as I can tell none of them really caught on the same way. A number of my open-ended questions about picking tools/libraries have been [CLOSED]. It really bugs me. I think there's such a valuable need there; you pick a dev tool and it may have maintenance and development consequences (repercussions is perhaps a less gentle way of stating it) for years or perhaps decades. It really impacts everything. We need to find a way to evaluate tools in a dev-friendly manner, keeping in mind that no dev ever has full time to really read and digest the docs they come into contact with, at least in my experience. (Peter Norvig has some apt statements about the realities of dev time management in his Coders at Work interview, IMO, which could spawn another discussion).
- aikah 11y agoAbout SO, it's just that this isn't the goal of SO. The goal of SO is asking a precise question and getting a specific result, it's not a place for debate or opinion. Quora could have been that place, for some reason and because of some odd UX choices ( mandatory signup to browser the site ) , it isn't , which is too bad.
- briandear 11y agoSo it would destroy SO if, in the context of programming, there was a best of question? Are they really that tight-assed? Do they not have the bandwidth? Really, I'm curious how those questions would hurt the site. And Quora? Why would SO prefer users to actually go somewhere else? Debate and opinion, despite what the moderators think, is a valuable part of coding. It isn't all "solve for x." Because the interesting thing about the 'ask a specific question' concept is that some questions are closed because they're too specific. I pretty much abandoned SO. The anal retentive pendants moderating things have turned me off to spending any time contributing.
- batiste 11y agoThere is great stuff to say Ruby and RoR. But I have yet not experienced the "smile" that DHH is describing. Especially when I have to read and understand the code written by colleagues (or myself mind you). To do my job I had first to become a master in grep to find where stuff come from and deciphering half assed documentation. Mostly because exploring objects with hundreds of methods is not my cup of tea. I also enjoy understanding my tools, and RoR is, in my experience, not particularly easy to understand. This doesn't put a smile on my face.
- jasonjei 11y agobatiste, I think what you are describing is that the culture around Ruby doesn't put a smile on your face, rather than just Rails. Ruby's philosophy is quite a bit different from Python, Smalltalk, Perl, Java, and PHP. Ruby is roughly described as "batteries included." Some people don't prefer this, as it encourages meta-programming and introspection rather than explicit instructions. A lot of libraries and tools around Ruby use meta-magic; some libraries have been attempting to strike a middle ground with meta magic, such as Datamapper (explicit) vs ActiveRecord (implicit). But the bias is definitely towards implicit; or as what DHH calls "omakase."
- jdalbert 11y agoLots of people don't like maintaining other or former colleagues' code, especially when the codebase starts turning into a legacy one. This is true in every language. There are several solutions for this, but I personally take the easy way out: quit your job and be the first developer in a new startup, or do some freelance work. Whatever you need that floats your boat
- edwinnathaniel 11y agoI recently wrestled with the idea of using NodeJS for any side projects. I touched Ruby/Rails in the past for a few times (on-off between small works) and never really felt excited or see it as something "beautiful" because at the end of the day, we, developer, still have to debug our own buggy code. After a few strings of drama in the NodeJS land, a few chat with friends who used NodeJS in production, and seeing the pattern of BigCo who use NodeJS only for glue/front-end/gateway appserver, I'm pretty close to settle with Rails. I admire DHH for his dedication to the framework for so long (since 2004). You don't see that type of dedication in the NodeJS land. Yes, NodeJS is still new, but a few BDFL/leaders of important NodeJS projects had left the boat already. One of the premier NodeJS vendors, StrongLoop, always mired with controversy (I happened to know a few people who worked for a company that was acquired by StrongLoop). Building long-term side-project requires a stable platform because of the time limit (outside office hour + other responsibilities). Dealing with unstable but "sexy" technology is not a good choice.
- cballard 11y ago> Where Java championed forcefully protecting programmers from themselves, Ruby included a hanging rope in the welcome kit. I don't think this is something to be admired in a language. Java is a bad language to work in because it's not expressive, not because it protects programmers (which it doesn't). Thankfully, we are seeing this shift the other way with the growing popularity of languages like Rust and Swift.
- kyllo 11y agoJava is a bad language to work in because it's not expressive, not because it protects programmers (which it doesn't). Compared to C/C++, yes it does. Java protects you from out-of-bounds array access, uninitialized access, buffer overflows, use-after-free, double-free, etc etc.
- hawleyal 11y agoSo, basically nothing in real world domain. The protections are basic at best. The most common errors are runtime exceptions, zero protection offered. YMMV.
- kyllo 11y agoThe Heartbleed Bug[1] sure felt like a real world domain problem to me. If OpenSSL were written in a memory-safe language like Java it would not have happened. [1] http://heartbleed.com/ http://heartbleed.com/
- kaonashi 11y agoThe worst thing about rails these days is ruby itself. If I'm going to use a non type-safe language, I may as well use the one that's on the client side as well (and has first class functions).
- mattmcknight 11y agoRuby procs are first class.
- jrometty 11y agovery functional
- rimantas 11y agoAnd then you discover that Ruby was not so bad after all. With blocks and procs I doubt many miss those first class functions that much.
- pekk 11y agoType safety does not mean static typing.
- kaonashi 11y agoAre you trying to make the case that ruby is type-safe?
- Ologn 11y ago> Progress over stability > We have to dare occasionally break and change how things are to evolve and grow. > ...harder to swallow in practice. Especially when it’s your application that breaks from a backwards-incompatible change in a major version of Rails. It’s at those times we need to remember this value, that we cherish progress over stability... I encountered this doctrine first hand. A division of a company I worked at had its division's website rewritten in RoR by some outside consultants. Even brand new, it was a mess of Ruby gems of conflicting dependencies which was undeployable. The build system was a train wreck as well. Some of the main web pages of their web sites like rubygems.org were not available - the web site had "progressed" and when you clicked on a link, the page explaining anything had disappeared. I mean hell, go to rubyforge.org this minute (1:15 PM EST) - it is down, of course. The blog of the author of the Ruby gem that then was the main gem that handled web serving did not inspire confidence. As I would have to maintain it (as a sysadmin, not programmer), I refused to deploy the system, since it was an unreproducable mess of conflicting gems and gem versions and kludges. They decided to pay the RoR consultants additional money, despite them having never delivered a working system. By the time I left, it still was never deployed. The division closed dozens of offices soon after, and then the division shut down - perhaps not completely related, but probably somewhat related to this project. Meanwhile, the company's other divisions had decent programmers programming for Java application servers, and that code and those servers were much more solid. Builds rolled out easily (and could easily be rolled back if need be). It was really night and day. It makes sense this contempt for stability is explicitly part of their doctrine.
- FooBarWidget 11y agoThat sounds like a Rails app from the 2.x days (circa 2009). Back then, "a mess of conflicting dependencies" was a indeed problem. With the introduction of Bundler, that problem has been fixed ever since.
- bdcravens 11y agoDHH's is talking about the doctrine of the framework, not random apps built atop the framework. rubyforge.org has been offline for over a year and a half, as announced over 2 years ago. You describe a Rails application written by outside consultants that was undeployable, and compare it to apps written by internal Java developers. I believe the quality of the developers had more to do with the deployability than the languages of choice. You could just as easily have a Java application written by consultants, with undocumented JARs, magical PATHs, mystical server.xml's to make things work just right, and crazy ant scripts.
- euphemize 11y agoThis is easily described with a contrast to Python. [...] Ruby accepts both exit and quit to accommodate the programmer’s obvious desire to quit its interactive console. Python, on the other hand, pedantically instructs the programmer how to properly do what’s requested, even though it obviously know what is meant (since it’s displaying the error message). When you're trying to convince me that your programming language is great because another one is so much shitter in comparison, you're on the defensive and basically telling me you don't trust your own stuff. Especially when this is at the top of your article. By the way, python handles your example very gracefully in comparison to other REPLs (for instance, node spits out a cryptic, but expected traceback on exit/quit)
- brightball 11y agoHe didn't say Python was bad in comparison. He just highlighted a simple example of coding to spoken language expectation even if it means aliasing. It's a minor example of trying to make the development experience more enjoyable, nothing more.
- warfangle 11y agoIt's a REPL. `exit` isn't in the standard library. Aliasing it doesn't make sense.
- euphemize 11y agoDid you read the quote? He very exactly says that python is bad in comparison - by using a concrete python vs ruby example. If this was a passing mention on some blog post, I'd be inclined to believe you, but this post is not like any other. It's a descriptive update of the current rails "doctrine". When I ask you "why is your X so great" and you tell me immediately "look at how bad Y does", I'm inclined to think you're not feeling very secure about X.
- brightball 11y agoHere is the exact quote from the article: > Anyway, what did this mean for Rails and how does this principle continue to guide its evolution? To answer that, I think it’s instructive to look at another principle that was often used to describe Ruby in the early days: The Principle of Least Surprise. Ruby should behave how you’d expect it to. This is easily described with a contrast to Python: > code snippet > Ruby accepts both exit and quit to accommodate the programmer’s obvious desire to quit its interactive console. Python, on the other hand, pedantically instructs the programmer how to properly do what’s requested, even though it obviously know what is meant (since it’s displaying the error message). That’s a pretty clear-cut, albeit small, example of PoLS. Nowhere in the above is he calling Python bad. He's using an example of how Python handles a thing to illustrate how Ruby handles that exact situation differently inline with his philosophy "Principle of Least Surprise". I'm not trying to get into a semantic argument here, just pointing out that he's making an illustration with a minor detail. Calling Python "bad" would make no sense, because Python is wonderful. This is just a way to highlight how Ruby does things differently than others have chosen to do them.
- vinceguidry 11y agoI submit that anyone who takes the time to really learn Rails and how it works and the problems it solves will never want to use another web framework except for toy projects. It really is that good, and just keeps getting better every year. It does one thing, web applications, and does it really, really well for the type of coder / team it was designed for. People that belittle it by saying it has too much magic or whatever have never seriously tried to maintain a huge web application all by themselves. Web apps are ridiculously, mind-bogglingly complex, Rails conventions have been baking for well over a decade now. If you're Twitter, maybe you have the resources to maintain a serious web presence without Rails. Everyone else is just handicapping themselves.
- lucaspiller 11y agoMost of the software I write nowadays is for business web applications (with a few things going on in the background), and yes for this market I don't think there is really any better choice than Rails. Although it may not have every new shiny bell and whistle, the ecosystem is mature enough to be stable and to have developed accepted best practices, which means you don't need to worry about whether the tool you use is still going to be supported in 6 months time.
- bphogan 11y agoAgree. But the churn on gems is very painful. To be successful with Rails long term, you must make time to constantly upgrade your framework, for for too often a gem maintainer will just stop supporting older versions of the framework. And all of a sudden the version you need won't build, or isn't compatible with something else, etc. So Rails is great. It saves you tons of time and gives you rock solid web apps that talk to databases. As long as you don't fall behind in your gem versions. :) That's me speaking after maintaining several apps from Rails 1 all the way to 4.2. And probably 5.
- troels 11y agoThe thing about gem churn is somewhat true, BUT that is a problem in any open source eco-system that I've seen so far. And in fact I think Rails fares much better in this area than most others. There are a lot of very high quality gems out there that are actively maintained and play well together. Contrast that to the cesspool that is Wordpress plugins.
- attilagyorffy 11y agoI've been a Rails developer for 10 years now and I have to say it is still my favourite tool of choice (yes even in 2016). There are other interesting tools and frameworks out there (I'd love to put my hands on Phoenix and Elixir if I had the time) but for now I have to be honest: When I start a new client project I have to consider a few things: * Using a well-known framework is favourable over new shiny toys in a commercial system * An ecosystem that has good 'defaults' is essential. A single web framework won't do everything for you. You need stuff around that for testing, deployments, etc. For mainly the reasons above Rails is still my primary tool of choice. Yes, it has pinpoints but the reasons above far outweigh the new and shiny.
- ronnier 11y ago>Optimize for programmer happiness I've never been more unhappy programming than when I touch Rails. I'll take python or Java any day of the week. >Convention over Configuration Discoverability is totally gone. Walking into a brand new RoR app and it's next to impossible to figure out what's going on. Not having a good IDE doesn't help. >Exalt beautiful code Write simple easy to read code. Don't be clever.
- jcsnv 11y ago>I've never been more unhappy programming than when I touch Rails. I'll take python or Java any day of the week. Try PHP
- jdalbert 11y agoI come from Java/JEE and I would choose Ruby any day of the week. Some former colleagues had bad Python experiences. Some others have their first working experience in Ruby and want to go somewhere where the grass is greener. IMO what makes programmers happy is not so much a programming language in particular but rather the context surrounding the job: role in the team, age of the codebase, fun colleagues, level of "corporatism", good or bad management if any, how much code you are able to ship per day, etc.
- aikah 11y ago> 7.Progress over stability No real ecosystem can be built on rails since its apis keep on breaking. That's why in my experience, most people give up on rails. Stop breaking apis, introduce stability and maybe the framework will be successful again. People don't give up on rails because of ruby, or because it's bloated or slow, but because it became an unmaintainable, non upgradable mess as time passed.
- keredson 11y agoone thing i hate about rails is writing the database migrations. (i thought: "why not just define what the schema should be, and let a diff-like tool figure out update statements?") so that's what i wrote: https://github.com/keredson/ruby-db-evolve https://github.com/keredson/ruby-db-evolve been using it in production for ~1y now.
- morokhovets 11y agoI may be wrong but it looks that you just misunderstood what migrations offer and their usage patterns. What if you have to remove one column and split its data into two new ones? I can provide dozens of similar examples from my production code. In short, migrations are not only about schema metadata. It would make more sense if your gem would generate migrations from schema.rb changes. Also, that rant at the end of README kinda shows that you're hating the tool you're trying to use. Why not use another? You are not tied to ActiveRecord. I'm not trying to say that migrations are flawless as a tool. I've faced at least one major problem with them. But still.
- hawleyal 11y agoAgreed.
- keredson 11y agoI understand the skepticism. I presented it at the Houston Ruby group last year, shortly after developing it. You should have seen the looks at the start. But try it on your own project. (It takes like 30 seconds to switch.)
- keredson 11y agoTrue, this doesn't do data migrations, and we still write the occasional(1) data migration when needed. But those are no more difficult to write, and the much more common non-data migrations are an order of magnitude easier. So net win. (1) If your data migrations are not "occasional" (and I mean very occasional) that's a sign you're doing a poor job at modeling your data. Splitting one column into two is almost always an example of someone really f-ing up the original schema. Think of it this way: how do you switch branches? Do you look up the most recent ancestor, check it out, migrate down to it, then back up the new branch? It's so hard I don't know any rails devs who actually do it. But with a my tool it's a one-line command. PRs w/ schema changes actually get tested now, not just eyeballed. Also, did you even read the "rant"? Do you seriously like the proposed version control tool modeled after rail's migrations? ;)
- qertoip 11y agoIf you like the Rails Doctrine, check out Phoenix Framework and Elixir language by the former Rails Core Developer Jose Valim. You'll get hooked as you did with Rails 10 years ago.
- jaequery 11y agoSigh, it's hard to take any of these comments seriously without first understanding how much real-world experience they actually have in the industry.
- brianolson 11y agoYou could probably post that comment verbatim on half the threads in HN and get upvoted.
- pekk 11y agoPeople can have valid, informed opinions even if they aren't rich bigshots with fancy titles. Distinguishing people according to how many years they have been pushing buttons in the industry and talking themselves up as "A players" really doesn't mean anything.
- Luyt 11y agoI transcribed an interview with DHH [0] in which he also explains his motivations for choosing Ruby (instead of PHP or Java, for example), and where he explains some design principles for Rails. [0] http://www.transcribed-interview.com/dhh-rails-david-heinemeier-hansson-interview-randal-schwartz-floss.html http://www.transcribed-interview.com/dhh-rails-david-heineme... "One example I always pull out is “what you gonna call the primary key in your tables?” When I was working with PHP and Java, every single shop, almost every single application, would have its own naming scheme. Some would say they have the ‘Products’ table and then they'd have ‘productid’, others would have ‘product_id’, some people would have ‘prod_id’ or ‘p_id’ or ‘P_id’, and every time somebody made a new design decision it meant configuration. You now have to tell your models, your objects, how they're going to talk to this database table. Because it needs to know what the hell you called the freaking primary key column, and it just doesn't matter! Who cares what the primary key column is called? It just doesn't matter. It's going to have zero impact on the usefulness of your application." and "‘Dont repeat yourself’ is all about not having the same intentions spread out in multiple places. Don't have one configuration. If you're calling something, let's again take the example of the primary key. If you're calling that for ‘id’ you shouldn't have to configure that in three different places that all have to work together and all have to be changed together. You should just pick one authoritative place to have that information stored. And then you can make changes from there. It also goes with the the whole Ruby idiom: we don't want those Java boilerplate ten line things: that's repeating yourself. If you have the same idiom, if you have the same intentions, that should really be exceedingly a short expression. And that goes up throughout the entire framework. Just keep one place to change those things, and keep the idioms very short."
- edwinnathaniel 11y agoThat sounds like the pre-ORM days. These days ORM would map member variable id to database table id.
- Luyt 11y agoThe interview is from July 2009. I think Rails already had its ORM then. DHH says: "The model part in an MVC application is where all the business logic is kept. Those are all the classes like ‘Post’ and ‘Category’ and ‘Author’ and all those things –say if you're making a weblog– you'd keep all that stuff in the Model. And you'd have all the logic about whether the author is allowed to make a post and how the relationship between posts and comments work together. Those are all sitting in the model, so that's all the business logic, very often backed by a database in some sense, not always, but most of the time. And that's where in Rails we're using something called ‘ActiveRecord’. Which is this way of mapping database tables to objects, and then decorating those objects with logic."
- bliti 11y agoBit off-topic here: How is the Rails market these days? It seems (personal perception of outsider) that it has been replaced by Python/JS work.
- nik736 11y agoThere is still enough work and projects being built using Rails. Of course NodeJS stole a lot of thunder from Ruby/Rails, but everyone who has been smart either went back to Ruby/Rails or moved on to Go (if performance was an issue). I don't think Python is an issue, it's always have been that people went from Ruby -> Python and vice versa.
- bliti 11y agoThe change from Rails to Go must be quite shocking. Going from such a completely framework to a barebones language is a huge step. I write Go and went from Python -> Go and it still was a bit of a jump. :)
- vudu 11y agoEveryone who has created their own open source framework which supports a multi-million-dollar business that now supports your hobby of driving million dollar race cars, please feel free to cast stones at what rails is and has become.
- sanderjd 11y agoThis is a terrible form of argument. Success does not mean you're correct. Many successful people and things deserve criticism. I don't think DHH or Rails is among them, but that isn't because they're successful.
- vudu 11y agoIt is merely an observation. That is, the strength of a person's opinion is often inversely related to their experience.
- vinceguidry 11y ago> Success does not mean you're correct. Err, yes, it does. That's precisely what success means. If you are successful at something, that means you did something right. What that something is is certainly up for debate, but you can't ignore success as an argument.
- blakeyrat 11y agoRight; for example if you're a successful pharma CEO you might be able to afford the one and only copy of a Wu-Tang Clan album. Unless you define "success" as "being rich", no, I'm sorry, it's not true. It's actually quite easy to become rich by being a complete scumbag with no consideration for other people.
- sanderjd 11y agoI think a much better, more relatable, and currently very striking example of this fallacious "rich and famous people must know what they're talking about" line of reasoning is the current U.S. Republican presidential primary front-runner.
- equalarrow 11y agoCouldn't agree with DHH more. I found Rails during the 0.9 releases. Coming from the horrific world of Java web frameworks like Spring and Tapestry, it was a revelation to see how fun and productive web programming could be again. When I saw things like 2.times, 1.day.ago, and ActiveRecord, I knew I was done with Java web development. This isn't a knock against Java per se, but I just spent so much time in the trenches having to do busywork and configuration that isn't necessary if authors of those frameworks put programmer productivity and enjoyment first. Thank you DHH!
- deleted 11y ago[deleted]
- learc83 11y ago> desire for static types If you like static typing, then sure use something with static typing. I don't however, think that the criticism that "one day when you have millions of users you'll have to migrate to another language" is useful. Most startups will never make it to that level, and anything that saves them time in the beginning is probably worth it. If the average developer is only 5% more productive in rails than whatever java framework you're using, it's probably worth using Rails until you need to migrate (all else being equal). That 5% now makes it more likely you'll reach the point where you need to scale.
- deleted 11y ago[deleted]
- deleted 11y ago[deleted]
- cballard 11y ago> 1.day.ago So apparently .day multiplies the number of seconds in a day by the receiver, then .ago subtracts that from the current date[0]. However, not all days contain the same number of seconds. This is where "friendly" APIs like this lose me - they're vague and sometimes incorrect. In Foundation, which I consider to have a decently designed date API, "dates" are doubles of seconds all since a reference date, and "date components" are used to express the concept of days, months, and years - which also require a time zone and a calendar to even make sense. [0] https://stackoverflow.com/questions/21392065/how-do-you-implement-1-day-ago-in-ruby https://stackoverflow.com/questions/21392065/how-do-you-impl...
- deleted 11y ago[deleted]
- of 11y agos/so its only fitting/so it's only fitting/
- elliotec 11y agoI was just singing praises to Rails last night for these reasons. At my corporate job, we use Java with Spring, and a hellish mess of node packages/libraries/whatever we're calling them now. It's not good. So when I do side projects or consulting gigs, I always run to Rails which is what got me into development. It's very refreshing. Reminds me of the jQuery post the other day. Rails is just a little older than jQuery. Rails with some jQuery sprinkled in is as close to development perfection as I've ever seen. Also re: "too much magic" - Why is magic a bad thing? Creating layers of abstraction to ease building is what programming is really about, right? Why would we want to go backwards to configure everything under the claim of "I need to know how EVERYTHING works!"?
- rudolf0 11y agoSometimes (performant) SPAs provide a better user experience than regular views strung together with Ajax/jQuery. But otherwise, I agree. Rails and jQuery were probably the first truly "nice" APIs I've used in programming, and I still get quite a bit of enjoyment from using them, to this day.
- elliotec 11y agoI've seen a few examples of performant SPAs providing a better user experience, but I can only think of a couple. One example would be the Timbuk2 bag customizer: http://www.timbuk2.com/customizer#/product/15-custom-commute-laptop-messenger-bag/size/4/customize http://www.timbuk2.com/customizer#/product/15-custom-commute... But even this seems possible without committing to an SPA architecture. If I recall correctly they are using Ember for this. But yeah, you're right.
- rudolf0 11y agoCheck out http://ask.fm http://ask.fm This is actually a SPA and a bunch of strung together jQuery. But things subjectively feel "faster" compared to what the site was like before they upgraded to this model.
- AKifer 11y agoHaving been working with Rails for a long time, now I wonder what could be the next cool thing looks like. The only improvement I'd like to see is about performances, and Elixir and Crystal are a good candidates to replace ruby in this direction. But until now, I don't see any other framework equaling the elegance of Rails, great job David and all the community, let's continue to keep Rails weird.
- ianamartin 11y agoMy background is Python, C#, and SQL, and it shows because those languages have affected the way I think about programming. I strongly disagree with DHH's points 2,3,4, and 6. But I think I'm going to learn the language anyway and use it for some projects because I think it's important to not get in a rut. Using different languages changes the way you think about code, and if you are not constantly updating the way you think about code, you are falling behind. Besides, I really like the way DHH writes. His language is persuasive even when I quite certainly disagree with him. Still going to learn a functional language first probably. But then Ruby/Rails.
- hardwaresofton 11y agoA tad bit off topic, but for your functional language I'd recommend Haskell. It's given my mind the most trouble out of any of the other functional languages I've tried (which is a good thing). I find it's syntax reasonable, and resources plentiful. Excellent lecture series on functional programming (language used is Haskell): https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Functional-Programming-Fundamentals/ https://channel9.msdn.com/Series/C9-Lectures-Erik-Meijer-Fun... When you get to trying to understand monads, DON'T look up monad tutorials, look for functor -> applicative functor -> monad tutorials, like this one: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html http://adit.io/posts/2013-04-17-functors,_applicatives,_and_...
- ianamartin 11y agoThank you for this. Much appreciated. I have a copy of learn you a Haskell for great good and have been slowly working my way through it in my occasional spare time. Also interested in F# these days now that Microsoft seems to be open-sourcing . . . pretty much everything.
- hardwaresofton 11y agoLearn you a haskell for great good is also a fantastic resource (that I should have mentioned) -- I also worked through it, and found that it was a good not-boring introductory text. It strikes a good balance between being informational and playful, while offering the examples and exercises that you'd expect for building intuition. One of the rare books I read online (completely free from http://learnyouahaskell.com/ http://learnyouahaskell.com/), and liked so much that I bought a hard copy to carry/read.
- TheMagicHorsey 11y agoMature Ruby projects are very difficult for a new Ruby programmer to parse and understand. In contrast, Go projects are quite easy to understand. DSLs are part of the reason for this. Naturally there is a tradeoff. People that have been working with a particular DSL in Ruby for a long time can achieve amazing things in a short amount of time. Equivalent productivity is not really possible in Go (at least not yet, in my experience). Having said that, I think it is easier to onboard new (and newbie) programmers onto a Go project than a mature Ruby project.
- resca79 11y agoI like ruby and rails, not just for the framework itself, but for what it was and it is for many developers. I want to say thanks to DHH for his way to maintain the framework simple, despite to many PRs that try to make rails more complex. Thanks to this document, I'd like to read also some document about the standard in big rails app.
- tomphoolery 11y agowhoa what the hell is ApplicationRecord?
- thirdsun 11y agoThe replacement for ActiveRecord::Base in Rails 5. All your models will inherit from ApplicationRecord. See http://nithinbekal.com/posts/rails-5-features/ http://nithinbekal.com/posts/rails-5-features/
- tarikjn 11y agoMy tool of choice today is Clojure, but I have to thank RoR for teaching me a lot of sensible conventions that I use in Clojure nowadays.
- ryan-allen 11y agoI personally prefer ASP.NET MVC, it has all the core parts of early Rails (back when it was nice and simple), and it's statically typed to boot. The most magic thing in .NET MVC is Entity Framework, and all it's magic is either a bunch of strongly typed convention classes (of which you can create your own), or LINQ queries, which work pretty well. If I'm building stuff for Adults with Money I'll choose static typing any day.
- runjake 11y agoI think I can boil down all the debates in the comments: Some people prefer the Rails way of doing things. Others prefer something else. Nobody is wrong.
- jesstaa 11y ago9. Monkey patching instead of good design 10. Don't worry about data integrity
- of 11y agoPush up a big tent? David Oscarmeyer Heineken is gross! :P
- windor 11y agoI think this should be post here: https://dockyard.com/blog/2015/11/18/phoenix-is-not-rails https://dockyard.com/blog/2015/11/18/phoenix-is-not-rails It's very interesting to see such different philosophies.
- reaction 11y agoCan someone describe their experience with using rails as a back-end JSON API for javascript apps (flux/react or with angular/ember)?
- awj 11y agoWe've been happily doing Rails/Ember for about a year now. When we started Ember Data wasn't as stable or as customizable as it is now, so I don't have experience working with that. In general, we've been happy with it. We ended up writing our own serializer system (similar to ActiveModel::Serializers) to provide legacy clients with the option to use XML without losing our minds. Rails has a lot of view-level niceties that we're not using under this scheme, but the rest of the framework is still very useful for this task.
- norswap 11y agoI was hit hard by the cognitive dissonance at the start of section 2. Just after waxing in section 1 on how Rails is designed to his own happiness (including adding quirky methods like 'fifth'), he says "One of the early productivity mottos of Rails went: “You’re not a beautiful and unique snowflake”"
- tim333 11y agoI like the philosophy of optimizing for programer happiness even if it's imperfectly implemented. I think those kind of ideas have more power than they are commonly credited with.
- iecompat 11y agoGhhjj Ghhj Ghjjn Hhhj
- iecompat 11y agoVhvuvuvuvuvj