Live data from Hacker News

Happy Birthday, Ruby

github.com

221–230 of 239 posts

Re: Happy Birthday, Ruby

#221

I'm currently working on a Ruby project, and I love the language so much! It's elegant, fast enough for me, and the ecosystem rocks. It seems that, after Ruby borrowed from many previous languages, a lot of rubyisms went into Rust (the nice functional-style enumerations, the awesome package manager inspired by Bundler). And I'm thrilled the best of the Ruby world found its way into other languages. A future where the…

I read about Ruby, indeed it's quite elegant but if it's "fast enough" for you then any language is fast enough for you.. /S

Re: Happy Birthday, Ruby

#222

Earlier quoted context omitted.

pluralization seems to be somewhat orthogonal to the "no standards" issue you raise; one could have introduced standard rules to help with that 'wild west' and still left out pluralization. pluralization brings with it runtime overhead and edge cases (which can be dealt with with more runtime overhead, of course).

I'm curious, where does pluralization of table names bring runtime overhead? AFAIK, they are stored in the model and not generated every time they are needed.

apparently, my bad. my earlier reading of rails from years ago was that this was runtime inflection, not at generation time.

it still, imo, adds some cognitive overhead, and other orms I've used (grails/gorm, for example), don't try to pluralize. you can pluralize by hand if you want to, but the default is just to name a table whatever the class name is.

Re: Happy Birthday, Ruby

#223

Earlier quoted context omitted.

So...eh. Ruby has the easiest data access tools, between ActiveRecord and Sequel (which I prefer), out there. I don't know too many folks who'd disagree with you about that. But where you're happy with Rails taking a few lines, I am as of late big on Kotlin (because I agree with you regarding Java) encouraging me to be correct . I'm building a new product using Spring Boot, Kotlin, and JDBI and while, yes, there's bo…

It's not just code bloat, typed languags and frameworks like spring have to dance through hoops to allow for easy testability. Spring is founded on the idea of dependency injection that's supposed to overcome that. In Rails/Python and friends you just don't need that, and consequently things have much less bloat.

...at the cost of globals all over the place and significantly fewer code-to-interface (rather than code-to-implementatation) moments.

I'd rather test a well-factored JVM or .NET application than I would any Ruby application I've ever seen in my life, to be frank. I've never, not once, had to write a mock (awful) for a test in a JVM or a .NET application, and the quality of my tests reflect that.

Re: Happy Birthday, Ruby

#224

Earlier quoted context omitted.

> So, I'm honestly asking, as someone who hates Rails: What framework, out there, somewhere, allows me to be as productive as Rails, but which is are "better," somehow? I'm a former RoR developer (about 5 years) who's now been a full time Elixir developer for two years, so I'll make the obvious suggestion of Phoenix, which is very rails inspired. It's a little more clunky in the basics, but it has that "magical" feel…

Sounds nice, definitely not a game changer, the way websockets wasn't a game changer. I think being real time can be easily achieved with existing tools and it's somewhat overrated anyways.

It's not the real time nature that makes LiveView a potential breakthrough, for me, but the additional category of interactivity it gives between "server side rendered" CRUD app and full SPA. Most apps in this zone are probably using jQuery or sprinkling in react, the former of which gets pretty messy and buggy in my experience, and the latter of which is overkill and leads to a much more complicated build system and developer environment.

It uses websockets, and I think websockets are probably necessary to implement the feature well, but that's not what I'm excited about here.

Re: Happy Birthday, Ruby

#225
post #123

Earlier quoted context omitted.

> And I think that a typed Elixir would get my attention right quick. Elixir _is_ statically typed, it just uses strong type inference so you rarely have to explicitly type things out. A key difference between Crystal and Elixir is that Crystal tries to replicate ruby syntax in a more performant language, whereas Elixir tries to apply the sensibilities of Ruby and the Ruby community to the Erlang VM.

I was using "typed" as shorthand for "statically typed", but Elixir is not statically typed. Typespecs aren't static typing and IMO they get messy when you want to do more than specify primitives. https://elixir-lang.org/getting-started/typespecs-and-behavi...

I use typespecs in both Elm and with Dialyzer in Elixir and I haven't found either to be cumbersome, even when using complex data types.

I used to do a lot of programming in C# and Java, but I didn't miss static typing at all when I moved over to Ruby and Python. I'm sure others have differing opinions, but the absolutely last thing I worry about when selecting a language is whether or not it is statically typed.

Re: Happy Birthday, Ruby

#226

Earlier quoted context omitted.

So...eh. Ruby has the easiest data access tools, between ActiveRecord and Sequel (which I prefer), out there. I don't know too many folks who'd disagree with you about that. But where you're happy with Rails taking a few lines, I am as of late big on Kotlin (because I agree with you regarding Java) encouraging me to be correct . I'm building a new product using Spring Boot, Kotlin, and JDBI and while, yes, there's bo…

It's not just code bloat, typed languags and frameworks like spring have to dance through hoops to allow for easy testability. Spring is founded on the idea of dependency injection that's supposed to overcome that. In Rails/Python and friends you just don't need that, and consequently things have much less bloat.

Yeah you just end up with race conditions everywhere causing corruption and data loss. See active-model-serializers 0.10.8 release that just found a race condition where serializers would share state across threads making the default Rails web server (puma) completely unsafe.

Re: Happy Birthday, Ruby

#227
post #146
post #137

Earlier quoted context omitted.

As somebody who was a Rubyist for about a decade but has worked at a Django shop for several years now, I definitely see how they're similar, but I don't think Django is clearly the better of the two. Django is simultaneously less helpful (you have to do more things explicitly, such as specifying routes) and less flexible (for one example, Django doesn't have a public query builder and doesn't have a replaceable ORM…

Where is the evidence, outside Hacker News, for this increasing popularity of static typing? The fastest growing languages by most metrics are currently Javascript and Python, both of which are dynamically typed.

python has mypy types and most places are switching to typescript over javascript. If you work with more than a handful of developers (and as such on a project large enough to require them) not having types DRASTICALLY decreases productivity.

Re: Happy Birthday, Ruby

#228

Earlier quoted context omitted.

I'm not aware that this has caused much consternation. I disagree that DSLs are a defining feature of Rails. There are other ways to implement DSLs besides `method_missing`, and rubocop and other style guides warn against using this method.

I'll admit to not having used Rails, but I was under the impression that Rails itself was a DSL.

Rails is a web framework. It's an easy one to use, and often the way to express something is concise enough that I would feel okay saying that "Rails is a DSL for web applications". That would be a simile, however, and not literally correct. It would be more literally correct to suggest that Rails was composed of several DSLs, but that probably stretches the definition as well.

The routing system in Rails is definitely a DSL. You might say that defining model properties was a DSL. You can probably call an ORM query interface a DSL. The controller and view layers are going to look like just about any other framework. Rails is a full-featured framework, which can be configured with a minimum of fuss, bother, and actual code-writing. For toy apps I don't think there's anything else that's faster for development, and for real apps I'm pretty sure that all frameworks are roughly equivalent.

There are Ruby projects which do provide a "DSL for web apps", of which I believe Sinatra is the most popular. Rails incorporates some DSL-like features, and I would agree with anyone who said that it "is basically a DSL for web apps", but I would consider that a figure of speech.

Re: Happy Birthday, Ruby

#229
post #45

After getting tired of Java's verbosity in 2008, I switched to a Ruby job, where I was fortunate to work with an incredibly talented developer and Ruby expert. It was a joy coding in Ruby after 4 years of Java and XML. After that, I moved to Groovy, which seemed like a nice middle ground between Ruby and Java, or as I called it at the time: Java as it should have been. I don't hear much about Ruby and Groovy lately,…

> I don't hear much about Ruby and Groovy lately

They've been overtaken by Python and Kotlin, respectively, as developers' first choice of programming language. Kotlin even runs on Android and natively, whereas Apache Groovy is limited to the JVM.

> I ran into trouble with Ruby's handling of unicode

Ruby's developed mainly in Japan, and Japan's the last holdout in the world against the widespread use of Unicode.

Re: Happy Birthday, Ruby

#230

I'm currently working on a Ruby project, and I love the language so much! It's elegant, fast enough for me, and the ecosystem rocks. It seems that, after Ruby borrowed from many previous languages, a lot of rubyisms went into Rust (the nice functional-style enumerations, the awesome package manager inspired by Bundler). And I'm thrilled the best of the Ruby world found its way into other languages. A future where the…

I think we've arrived at that future. With languages like Crystal, Rust, Groovy, and Elixir, you can get some of the same powers that Ruby bestows upon you in other environments like a statically compiled binary, the JVM, or the Erlang runtime (with it's lovely OTP framework). I even see JavaScript taking on some Ruby-like characteristics these days.

Those languages each target one of those platforms only, i.e. Crystal and Rust for a statically compiled binary, Apache Groovy for the JVM, and Elixir for the Erlang runtime.

Why not use a language that targets many platforms? E.g. Kotlin targets the JVM, Android, and Javascript, as well as is natively compiled. Now that's the real future. Better than using, say Groovy, to target the JVM, then rewriting it all when you want it to run on Android.

Post reply on HN