Earlier quoted context omitted.
I'm learning Java and was surprised to read your comment about ruby being completely object oriented. I always assumed ruby was very similar to Python. I would be interested in learning ruby especially if it is easier for someone with an object oriented background in Java. So, how difficult would coming from Java to Ruby be? And what books or MOOCs would you recommend for the transition?
Yes, everything -- even integers --- are objects in Ruby -- you can say 5.methods and Ruby will respond with a list of methods integers know. I think the best way to learn Ruby is Dave Thomas' classic "Pickaxe Book". This describes pure Ruby, as it predates Rails (not that I have anything against Rails, but a lot of people confuse Rails with Ruby which is a mistake). There is an updated version of the book for sale f…
Happy Birthday, Ruby
231–239 of 239 posts
Re: Happy Birthday, Ruby
#232Earlier quoted context omitted.
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
#233Earlier quoted context omitted.
I don't get this Elixir as the natural progression for Rubyists. OO/mutable Ruby and functional/immutable Elixir are worlds apart beyond the superficial syntax similarities.
Ruby does lend itself to writing a lot of functional code. One can write Ruby so that it looks very similar to Bash or other Algol-derivatives, but it's also possible to write code which avoids side effects, mutable state, or variables in general.
Re: Happy Birthday, Ruby
#234Earlier quoted context omitted.
Just read through https://guides.rubyonrails.org/ Unlike the sibling comment I suggest staying away from additional gems as much as possible especially if you're a beginner. Do things the officially blessed Rails way and you will run into the least amount of problems. All gems that try to 'fix' something in Rails will often have downsides of their own and can cause hard to debug issues in corner cases.
I can see where you're coming from, but I wouldn't advise rolling your own authentication and/or authorization systems, especially as a noob.
Re: Happy Birthday, Ruby
#235Ruby's bare word syntax, while sometimes clunky, is usually nice to read. Other than that, Ruby is a stain on software engineering. If you have the choice, don't make it your first language! Ruby has the most fundamental flaws of any of the scripting languages.
WAT? Have you looked at the array_* methods in PHP?
Re: Happy Birthday, Ruby
#236Earlier quoted context omitted.
Check out Crystal - Its statically typed, compiled, and a near one to one implementation of Ruby. https://crystal-lang.org
> a near one to one implementation of Ruby This isn't the case at all. It has completely different semantics (for good reasons).
Re: Happy Birthday, Ruby
#237Earlier quoted context omitted.
I'm curious: do you genuinely find that beautiful?To me all the enumerable/map/frozen string literal stuff seems pointlessly overcomplicated compared to the simplicity of just writing down what you're supposed to do: (1..100).each do |n| a = String.new a (Disclaimer: not my code, on mobile so I stole that off GitHub)
Not really; I was basing it off of https://news.ycombinator.com/item?id=18873581#18875961 as a semi-joke. I changed it to a relatively KISS and IMO genuinely beautiful version in the parent, for others' benefits here's the version you were referring to in the above comment: #!/usr/bin/env ruby # frozen_string_literal: true module FizzBuzz Integer.include self def self.array(enumerable = 1..100) enumerable.map(&:to_fi…
Re: Happy Birthday, Ruby
#238Earlier quoted context omitted.
I'm curious: do you genuinely find that beautiful?To me all the enumerable/map/frozen string literal stuff seems pointlessly overcomplicated compared to the simplicity of just writing down what you're supposed to do: (1..100).each do |n| a = String.new a (Disclaimer: not my code, on mobile so I stole that off GitHub)
Not really; I was basing it off of https://news.ycombinator.com/item?id=18873581#18875961 as a semi-joke. I changed it to a relatively KISS and IMO genuinely beautiful version in the parent, for others' benefits here's the version you were referring to in the above comment: #!/usr/bin/env ruby # frozen_string_literal: true module FizzBuzz Integer.include self def self.array(enumerable = 1..100) enumerable.map(&:to_fi…
Re: Happy Birthday, Ruby
#239Earlier quoted context omitted.
It's not the best example, but Ruby is the only language I can think of where an expression (e) fails to parse but ((e)) parses. I find that it encourages a bad kind of code golf that leads to hard to maintain code.
When does that happen? It certainly doesn't happen for all possible values.
f(if x then y else z) does not parse.
f((if x then y else z)) does parse.