12 ms·
> Now, this line of code is not simple, it’s easy to write it, but the code is extremely complicated under the hood because: Every time I hear someone complain
by vinceguidry 10y ago
> Now, this line of code is not simple, it’s easy to write it, but the code is extremely complicated under the hood because:
Every time I hear someone complain about Rails, I ask myself if this person is really just complaining about how complex web dev is. I've never seen a complaint that passed this smell test.
Yes, Rails abstracts over a veritable shit-ton of complicated domains. The problem is, that complexity isn't going to go away if you decide not to use those abstractions. Every single one of that laundry-list of things that ActiveRecord::Base.create does will have to be implemented again, by you, badly, if you choose to roll your own.
It boggles my mind why developers don't take the web seriously as a domain, like it's not real coding or something. It's the worst instance of bike-shedding I've ever seen.
Rails isn't perfect, by any means. But Rails is not a black box, it's all free software. You are more than free to re-implement anything Rails does yourself and release it as a gem. Modularity and flexibility are built right in. It seems incredibly odd to leave Rails over this. For what, Java? Unbelievable.
- jamra 10y agoI'm not a rails dev, but I believe that you are misconstruing his argument. It is not about inevitable complexity, but about the ownership of that complexity. If you are able to control the side effects part of development, you can control how it scales and debug it much more easily.
- mooreds 10y ago> It is not about inevitable complexity, but about the ownership of that complexity. I've been there, done that--was part of a team that owned a java application that grew over a decade (and eventually ran the team). A year or so after I left, they retired the application. Why? Because we owned all the complexity and couldn't support it. Maybe that was my failing. Maybe the team's failing. But I don't think that having control of how the whole codebase fits together means you necessarily have more control over complexity.
- ethbro 10y agoThose who trade for buried complexity are doomed to start digging whenever they discover an edge case. Maybe they never need to do that, in which case that's a bargain. But I tend to think that any old enough codebase continually accrues edge cases that must be solved.
- philwelch 10y agoI've never seen a ten year old Rails application, but from the Rails applications I have seen, I'm horrified by the thought of how it would look after that long.
- pimeys 10y agoI've been in a company that let their Rails applications grow for 7 years. Believe me, the oldest code was not pretty to read and almost impossible to refactor. When we finally had a real frontend team, the only way out was to reimplement the apps with a new architecture. At one point I realized, I should not stick into one language and one framework. Ruby is good to know, but I'm better if I can also tackle Scala, Java, Rust, OCaml, Haskell, Python and so on. Also happier, I'd say... I can now choose the best tool for the job.
- dagw 10y agoHaving worked on systems like that, the problem is that you end up in a situation where there are literally two people in the world who can answer questions about how something works and integrating other third party libraries or solutions becomes harder and harder.
- Double_Cast 10y agoI have a third interpretation: I think Solnic was complaining about a lack of diversity in the Ruby ecosystem. The most salient part of the post was (imo) the paragraph regarding how Merb was subsumed into Rails, instead of continuing to compete against Rails. Rails is essentially a monopoly. > It seems incredibly odd to leave Rails over this. For what, Java? Unbelievable. If projects such as Merb were more common, maybe Solnic could leave Rails without abandoning Ruby.
- forrestthewoods 10y ago> about how complex web dev is Isn't that part of the problem? Webdev is complex. But it feels to me like it's been overcomplicated by a factor of 100. It doesn't have to be.
- gaius 10y agoAbsolutely. At the end of the day you're doing some string substitutions then sending a text file over a socket. We were doing that in the early 90s! But to do it now we use these surreal Rube Goldberg contraptions with a hundred layers of abstraction.
- vinceguidry 10y agoAnd all programming itself is is turning strings of 1s and 0s into other strings of 1s and 0s. Asking web dev to be less complex is like asking financial markets to be simpler. Websites are market tools, tools have to retain a competitive edge. You can't afford to ignore market trends. You can't afford to wait until everything is well-defined. You can't let craftsmanship get in the way of shipping. You can buck the rules yourself and operate on whichever side of the tradeoff you want to operate in, but you can't expect everybody else to follow the same rules you do. I mean, if you don't like the web, then by all means find a different domain. I personally love it, and find it absolutely fascinating. With the right tools, (Rails) the complexity is manageable.
- forrestthewoods 10y agoI don't think the web's complexities are intrinsic. It's layers and layers of crap built on top of crap. Computers are so mind numbingly fast that in some respects it's impressive we've made the web as slow as it is. Which isn't to say that the crap mountain wasn't the best choice. It may very well be the pragmatic choice. The highest net benefit choice. But I don't believe it's intrinsic. I don't believe it has to be this way. Which means it's at least worth considering alternate paths. Even if in the end we picked the same way. I work in video games. Currently working in VR. Where you absolutely must hit 90fps and never drop a frame. A certain degree of craftsmanship is required to ship. Layers and layers of abstraction on abstraction need not apply.
- awesomepantsm 10y agoTry setting up rails dev on a windows environment and get back to me.
- rhizome 10y agoI did until 3.2. The only real problem was native extensions, and many gem developers provided win32 bins for those things if they support win32 at all. Granted, I personally wasn't (...) God's gift to clean code, but I could certainly work with anything other people (say, on IRC) were working with and talking about.
- Retr0spectrum 10y agoI think the majority of webdev tools are pretty tedious to set up on Windows without cygwin etc.
- Marazan 10y agoFlask is no problem, Django is child's play to setup.
- deleted 10y ago[deleted]
- true_religion 10y agoI feel like that's because someone put a lot of time and effort into making Python's core library play nice on Windows, and Pythonistas tend to interact with the OS/network only through core library functions. To contrast, Elixir runs on Windows. However, it may be hard to get all your projects up and running due to various baked in concerns where they were written to support Unix-like systems only.
- schwarrrtz 10y agoNode is a one click install on Windows, no cygwin required.
- 10y ago
- jonahx 10y agoI'm assuming you are not familiar with solnic's work. Because he is not just idling complaining. His rom project, and the ecosystem of supporting gems which have grown from it over years of work, are the exact opposite of "implemented again, by you, badly." It's more like "implemented for the first time, correctly, by someone who actually understands what good design is."
- vinceguidry 10y agoThat's valid, and you're right, I wasn't familiar with his work. But that doesn't diminish any of my points. So he did reimplement ActiveRecord. I'm not surprised he found it difficult to actually integrate into Rails. Rails is a framework. You don't treat a framework like a library. It's not going to play nice with your design because frameworks by their very nature impose the design on you. With a framework, "works for me" is a perfectly valid reason to keep using it and to dismiss criticisms with. That's the whole point, to get you up and running with as little fuss as possible. I personally hate CSS frameworks, I'd rather retain more control over the markup and selector semantics. That's a choice I make, and I'm aware of the tradeoffs. I would not make the same choice with web dev, because choosing the other side of that tradeoff involves way too much work. But I'm a working coder, I'm not trying to make my mark on the world. I just want to get shit done and move on. Solnic obviously wants to make something bigger than just a website. He's looking for a bluer ocean to tame. Which is cool, we need all kinds of coders. What this is really about is that Rails isn't for him. I can accept that. But his rationale is all wrong, it expects Rails to be something it isn't and never could be. Rails is absolutely the best at what it does for the kinds of coders it's intended to do it for. It tracks the state of the art of web development and boils down most of the complexity with user-friendly abstractions. It's not terribly flexible, but Rails doesn't want to be flexible. It wants to be productive. He wants to go help build the next Rails. Godspeed. I hope he succeeds so that I can go use his framework when it's finally ready in 10 years or so.
- xuejie 10y agoI'm sorry but I just don't get this, in your previous comment, you mentioned: You are more than free to re-implement anything Rails does yourself and release it as a gem. Modularity and flexibility are built right in. And right here, you also mentioned: I'm not surprised he found it difficult to actually integrate into Rails. Rails is a framework. You don't treat a framework like a library. It's not going to play nice with your design because frameworks by their very nature impose the design on you. So which one is correct here?
- briantakita 10y ago> I ask myself if this person is really just complaining about how complex web dev is A major problem with rails is it tries to "simplify" the inherent complexity of web development by using abstractions & mappings that ultimately increase incidental complexity in the entire stack.
- BinaryIdiot 10y ago> Every time I hear someone complain about Rails, I ask myself if this person is really just complaining about how complex web dev is. I've never seen a complaint that passed this smell test. Yes, Rails abstracts over a veritable shit-ton of complicated domains. I call this "magic" and I dislike it very much. I'm a very explicit person. I like the ability to jump into any project, regardless of language, and be able to figure out how it works. This is typically possible with Python, Node and PHP with most web frameworks. Ruby with Rails? Not at all and for precisely this reason. I'm fine with abstracting things but only to a degree. If you're doing a laundry list of complex things with a single statement, and I'm referring to web server specific stuff not ASM instructions, then your framework is going to require more ramp-up time than any other explicit one.
- agmcleod 10y agoInteresting point. I find I can be pretty okay jumping onto a rails project, as I know a lot of the conventions. Where to look to see how things are connected. Admittedly, it's taken me sometime to learn how a multi architecture go project using thrift is setup :)
- ivan_gammel 10y agoJava isn't that bad, I'd say. ;) I've been in web development for almost 20 years, and used quite a lot of stuff, including PHP, Perl, C++, Java, Ruby and even such a weirdo like Informix WebConnect. Java is still my favorite, and the reason is the true modularity. You can combine Java EE and Spring stacks (lots of XML already forgotten in distant past), you can choose any presentation layer implementation and the architectural flexibility is the real selling point for projects bigger than a homework. I can beleive if the author would switch to it and I'm surprised that you don't.
- fat0wl 10y agoyeah i do Scala now but same deal. Where I think the OP comment really goes wrong is when he says something like "you're gonna need all that stuff and you're gonna end up re-implementing it yourself". I really don't find that to be the case... when you're developing with libs you are cognizant of your app endpoints and just add whats needed. It's better to consciously add a lib or turn a feature on than to just accept a big ball of yarn that some cowboy framework devs shat out. In the Rails app at my job it takes a ton of debugging just to figure out how many layers of decorators are firing off around every model. I might even go so far as to say that a lot of where JVM has strength is that contexts are pretty measurable... Spring containers, Akka systems. You instantiate them and hold them basically in the palm of your hand, you understand your scopes. Any technology that allows application scope to slip out of your fingers and intermingle with everything else under the sun is something I'd be wary of.
- endemic 10y agoMy own anecdote: at a previous job, new development was done in Rails, while "legacy" Python applications were maintained by one (!) guy. The Python apps were about the exact opposite of the Ruby apps -- cherrypy was used for the HTTP interface; very low level (compared to Rails, at least). He used to shake his head at the stack traces that Rails would spit out. "Intermingle with everything else under the sun" sounds about right.
- dragonwriter 10y agoThe complaints weren't about the complexity of web dev, but the degree of tight coupling and bad application architecture that the author sees baked fundamentally into Rails and the approach it is designed to favor. And as for leaving for what, the author identified both the other Ruby-based stacks and the noon-Ruby languages and frameworks that he sees as valuable. And, no, Java is not on the list. Your rant looks like a reflexive defense of Rails from someone who hasn't read the source article more than superficially; the article doesn't dismiss the web as a serious domain, it just sees Rails as locked into a dated approach to the domain.
- vinceguidry 10y agoLook, if solnik thinks he can do Rails better than Rails, I really hope he succeeds, because I can't wait to meet the perfectly-flexible, perfectly-succinct web development framework that has the kind of support and tooling ecosystem that I enjoy with Rails. I get it, tight coupling and forced architecture aren't ideal. I accept those limitations so I can get Rails' productivity superpowers. I don't just accept them, I embrace them, I've learned the wonderful joy of having everything you coded 6 months ago just slide right back into your mind because it didn't try to buck the convention. I spent extra time understanding that convention and why it exists when I wrote that code, I think most Rails devs don't do that, and so overcomplicate their applications. I've been on the other side of that tradeoff, so I can see where you're coming from. There's a lot of appeal in making and using your own abstractions that fit the domain better. But the web is a complicated domain in its own right. The right approach is to use one DSL for the web, and make your own for your domain. DHH was right, Rails is your application. To do otherwise is to over-complicate your architecture. > locked into a dated approach to the domain. Ugh, seriously? Is this fashion or engineering?
- incepted 10y agoThings get dated in engineering too. The writing has been on the wall for Rails for a while now, we're just seeing an increasingly large number of people publicly moving on from it.
- vectorpush 10y agoActiveRecord is terrible for any kind of complex database work. If your data models are simple or you decide to shoehorn your entire data model into an "object" representation then ActiveRecord will allow you to work, but if you need to run queries like "return every product that represents less than 2% of total revenue for the last year excluding products purchased by our top 10 most profitable clients" ActiveRecord is going to give you a very inefficient solution where you'll also end up writing Ruby code to accomplish what the database is already capable of.
- igor47 10y agoActiveRecord is not the right tool for a job like this. It's meant to return records needed for serving normal web traffic, not for running data analytics. This is a better job for a tool which can run queries like this outside of a latency-sensitive environment (hadoop, presto, whatever). > you'll also end up writing Ruby code to accomplish what the database is already capable of. This is for the best. Usually, you have only a few database servers, while you have lots and lots of web servers. If you have a computationally intensive task, it's better to perform it on those web servers, which you can scale horizontally. In our environment, the problem is usually the opposite -- it's way too easy in ActiveRecord to ask the database to do computation like sorting for you. Also, it can be hard to predict what impact an additional clause will have on the server's use of indexes. We try to get engineers new to Rails to write the simplest, most performant queries and then use ruby to do any soft of complicated transformation or computation.
- gaius 10y agoThis is a better job for a tool which can run queries like this outside of a latency-sensitive environment (hadoop, presto, whatever) Actually the right tool for this is plain old SQL. Even with nice formatting this is probably a 10-liner at most. If you have a computationally intensive task, it's better to perform it on those web servers, which you can scale horizontally It's only computationally intensive if you're doing it wrong.
- module0000 10y ago
- overgard 10y agoAs a counter point, are you sure web dev is the complex thing, or does it just seem complex because you're dealing with these massive gnarly frameworks that hide thousands of lines of code behind seemingly simple facades that perform incomprehensible magic? I think the mention in the article of the User.Create(params[:name]) one liner is really instructive. Creating a user is one of the most important things you're going to do in an application! The business logic rules are incredibly important, the security implications are huge, everything. Trying to make it "easy" is ridiculous, because as a developer, you should be thinking about these things. That's the kind of thing that should contain absolutely zero magic, the logic should be upfront and visible. I've worked as a web dev, and I've also worked outside of web development, and the number one thing that drove me insane doing web development was never knowing if any one line of code was doing some severe amount of impossible-to-debug magic. I'd rather just write javascript against the browser APIs with a lightweight http server. As far as I can tell, the vast majority of frameworks aren't really about providing functionality, they're thought experiments in how to write software. That's fine, but they should bill it as such. I'm not going to say web development is easy, there are parts that are legitimately difficult on their own accord, but I think the web development community has made things massively harder on themselves by pretending all these abstractions are actually simplifying the task they've set out to do.
- aantix 10y ago>because as a developer, you should be thinking about these >things. That's the kind of thing that should contain >absolutely zero magic, the logic should be upfront and visible No, you shouldn't be thinking about these things. Because you'll get them wrong. Are you really going to account for all security cases? Are you really going to account for all data coercion coming to/from the db? And even if you do, why go through the pain of those cases when there's a community of thousands of other developers, some of which have probably solved it infinitely better? Eventually, we have to get shit done. The only code that is worth something is code that serves others. Eventually we have to pick some abstractions so that we can get on with the show.
- code_sloth 10y ago
- pjmlp 10y agoWhen performance matters, Java runs circles around Ruby, Python or any other scripting language used in application development. Having been bitten by web applications written in scripting languages (Apache + TCL like AOLServer) with an architecture very similar to Rails, but done in 1999, Rails was never that interesting to me.
- citizenkeen 10y ago> It boggles my mind why developers don't take the web seriously as a domain, like it's not real coding or something. I'm glad to hear people say this. I want to be a webdev (second career), but rather than code school I went back for an MSCS, because I really wanted to dive into the nuts and bolts down at the database implementation level. I've done a fair amount of machine learning, ai, large-scale parallel programming, and algorithm design, and while I'm super-green, it's good to see the top comment is that the web is a serious domain.
- mekoka 10y agoHe said he's been dabbling with functional programming. I saw mentions of Elixir, Clojure, Scala and Haskell. Where did he say he was going to work in Java?
- PopsiclePete 10y agoI've written quite a few web apps over the years, sometimes in ruby, sometimes in go, sometimes python, sometimes C#, and I've actually never had to implement 'ActiveRecord::Base.create', much less poorly. I don't see what an ORM framework has to do with HTTP, honestly, the last 2 apps I worked on didn't even use a relational DB. I'd be curious how you'd finagle ActiveRecord to work with ElasticSearch - what would you do in that case? I don't understand why web dev is so "scary" or "complex" that it needs 8 abstraction layers on top of it for my own protection. The only time I thought I needed hand-holding was when I didn't understand SQL injection and cross-site forgery/scripting (and once you do understand them, it's not difficult to protect yourself against those either). If I found HTTP methods and headers, Javascript, CSS, Cookies and the rest of the web stack "scary" and needed hand-holding from Rails in order to get shit done, I'd be really, really worried about my skill set... The web world is changing quickly and you have to ask yourself if you're a "web developer" or a "rails developer". I think you'd want to be the former.