What's So Hard About Ruby?
-
So I've seen a couple of comments now to the effect of 'Ugh, Ruby is such a pain and so hard to program in', and admittedly I'm kind of lost on that one. Especially when it comes from people that can do MU-code and/or are working on Python for Evennia.
Python, to me, seems infinitely more finicky and picky about all of its various little whatsits and One True Right and Only Way-ism. And yet, people still think Ruby is harder?
Why? What's the deal?
Genuinely curious. I'm a ruby amateur, but I'm wondering if there's some kind of programming pitfall that I'm about to step into down the line.
-
I have absolutely no idea!
Ruby is so similar (IMO) to Python that I was able to start programming for Ares (simple stuff, obviously) without knowing the first thing about Ruby. I just followed the examples in the code and looked up things online when I needed to. I've since taken the time to learn it properly and I like it so much that it has become my go-to scripting language. In fact, I am using it for my current Rhost based project, which makes extensive use of Rhost's RESTful API and execscript functionality.
Oh, and if you want to see what picky looks like, try running your Ruby code through Rubocop
-
@derp Developers in general tend to be very picky and territorial about their preferences. Vim versus emacs, tabs versus spaces, take your pick.
Ultimately as long as a language works for the intended purpose it doesn't really matter too much. Most modern languages are interchangeable to a large degree, and it comes down to what you're already familiar with or just what you like.
-
IMHO - nothing.
I've been a professional programmer for over 20 years, and it's no harder than any other language I've ever seen, and easier than most.
I actually started Ares in Python and had a hard time getting it off the ground. Python is way more finnicky about little things like indentation that can throw off folks who aren't used to programming. It also didn't support the dynamic loading properties that I needed for Ares. It's a fine language overall - I've got nothing against it. It just wasn't the right tool for the job.
The only genuine criticism I've seen about Ruby is that it has many ways of doing the same thing, whereas other languages (including Python) are more opinionated and force you to do things a certain way. I mean... I guess I can see where that might throw some people off? But personally I find that as a selling point, not a down side.
-
The only thing I do not like about Ruby is how it handles truthiness. Coming from C and Python, it knocked me for a loop when I discovered that only 'nil' and 'false' are false. Everything else, including empty strings and the number 0, for example, is true. Which just feels so... wrong!
It's easy enough to get used to though.
-
@derp said in What's So Hard About Ruby?:
So I've seen a couple of comments now to the effect of 'Ugh, Ruby is such a pain and so hard to program in', and admittedly I'm kind of lost on that one. Especially when it comes from people that can do MU-code and/or are working on Python for Evennia.
Python, to me, seems infinitely more finicky and picky about all of its various little whatsits and One True Right and Only Way-ism. And yet, people still think Ruby is harder?
Why? What's the deal?
Genuinely curious. I'm a ruby amateur, but I'm wondering if there's some kind of programming pitfall that I'm about to step into down the line.
Huh. I've never heard anyone say Ruby is hard to program in.
It is a pretty friendly language, all things considered. And both Ruby and Python share some common lineage. In the end I think a lot of it comes down to personal preference (which is generally true of most languages except PHP, which is an abomination and should have no claim to life).
-r
-
I'm offended by the phrasing of this topic and the content.
It implies it should be easy to program/code.
It implies if my dyslexic brain takes years and years to learn something, I'm not so intelligent because its actually easy.
I started to learn Mu-Code way back on Star Trek MUSE: Tos. They had coding school as part of joining your race, this is early 90s when everyone was expected to learn some code and to contribute to the environment of the Muse.
I still don't know everything, I still ask questions on MUSH, the PennMUSH Social MU where the developers hang out.
The fundamental difference for my brain and going to Python or Ruby is model/class/etc.
In MU softcode, if I look at an object that uses another object for code (the +attack uses the inherent dice code to roll dice by example), I can find the attack code (maybe its on the combat code object) because I learned grep or something. I can see in there it pulls a function from RNG object and in there I can see how the dice are rolling and storing in registers to go back to combat. I can slowly piece it together.
In Ruby, if I look at one file that adds to a model created by other objects, I have no clue how to find it all. NPC model maker gives it some attributes, but the Combat checker does something else with NPC model to help for combat. But I have no clue where to look or search to know what all is building the complete NPC model.
So what i learned since coding in PennMUSH since the 90s (thirty years for my dumb ass) is turned on its head in my brain. Hell, I can't go to TinyMux and expect to do what limited stuff my dumb brain can do in Penn.
So, I guess thanks for the snobbery about what's so hard and making me feel dumb today.
And probably all the people that think coding is hard in general. Thanks for them too. There is a reason not everyone is coding. And this 'its easy' isn't helping as much as you think it might be.
Know what's easy for me? I'm not gonna say, cause it will sound like I'm bragging and in the end, doesn't matter what I like to do or find entertaining.
-
Same basic function. The only difference in the complexity is the Evennia version supports the use of player-defined UI colors. One is clearly simpler than the other.
Ares/Ruby: def header(str = '', width = 78) return line if str.empty? || str.nil? "%xn%x27-- %x33<< %x15#{str} %x33>> %x27%xH#{'-' * width - (str.size + 10)}%xn" end Evennia/Python: def header(text: str, player: Character, width: int = settings.CLIENT_DEFAULT_WIDTH) -> str: if o := player.options == None: return '' if not text: out: str = f"|{o.border_color}{o.header_fill * width}|n\n" else: flen: int = width - len(strip_ansi(text)) - 10 out: str = f"|{o.border_color}{o.header_fill * 2} |{o.header_star_color}<< |{o.header_text_color}{text} |{o.header_star_color}>> |{o.border_color}{'-' * flen}|n\n" return out
-
@lotherio said in [What's So Hard About Ruby?](
It implies it should be easy to program/code.
Coding is not easy and I don’t believe anyone here was meaning to imply that it was. My comment at least was merely comparing ruby to other programming languages in the context of the original question.
It took you years to get as familiar as you are with Mu Code I believe it would take less time to gain that same skill in Ruby. That doesn’t mean it’s easy
-
@lotherio said in What's So Hard About Ruby?:
So, I guess thanks for the snobbery about what's so hard and making me feel dumb today.
I can appreciate that you're affected by the topic, here, and I'm sorry that you felt it was belittling to you. But what you're describing (coding in general) is absolutely not what I'm referencing.
At least three people in the past -- two, maybe three weeks, have made it a point to talk about how Ruby specifically is hard to code in (versus something like python or Mux code).
And I'm asking why Ruby in particular is harder to code in than other languages as part of a follow-up to those comments.
There's no snobbery going on here, and nobody is looking down on you based on any level of coding you do or don't have. It was a genuine question asked in good faith about a topic that has come up multiple times in a (relatively) short span of time.
So I apologize if you felt attacked. That wasn't the intention, and what you're referencing isn't even what I was talking about or asking. I think we're mostly on the same page.
Edited because I was feeling a might defensive and that was unconstructive.
For reference, here are a couple of examples of what I'm referring to:
@23quarius said in Project Gridlock (Temp Name) Matrix style mush:
Mister
JohnsonAnderson, Ruby is horrible, don't torture yourself with Ruby@mr-johnson said in Project Gridlock (Temp Name) Matrix style mush:
Going to go with ares in spite of how hard it is to code with Ruby. Just because it's the system I've used for my last 4 games that actually saw a release.
-
@Lotherio Double post since I was on phone earlier and wanted to expand on what @derp said. Also sorry if I came off snobbishly. I was aware of the comments Derp was referencing about Ruby specifically and just assumed that was the basis of the question.
Coding is absolutely not easy, and struggling to learn to code does not in any way, shape, or form reflect on one's general intelligence. It is doubly challenging when you have to deal with something like dyslexia or dyscalculia on top of everything. I hope it is not able-ist or patronizing to say how impressed I am that you have managed to learn to code as well as you have demonstrated in our chats on the Ares discord. (If it is, I apologize in advance.)
It's also important to keep in mind that when learning to code for the newer MU platforms like Ares or Evennia, you're not just learning Ruby/Python. You're also learning the MUSH-specific classes and the "Ares/Evennia" way of doing things. You're learning the database stuff and web stuff. So yeah... making a "hello world" command may be comparatively easy, but learning how to make or modify a complex system can be a lot.
It's a lot in MUSHcode too. You (and other experienced MU coders) have just had the advantage of many years to learn it and now you're starting from scratch.
-
This post is deleted! -
@faraday said in What's So Hard About Ruby?:
It's also important to keep in mind that when learning to code for the newer MU platforms like Ares or Evennia, you're not just learning Ruby/Python. You're also learning the MUSH-specific classes and the "Ares/Evennia" way of doing things.
Super true. General language comprehension is a prereq for the next phase: The wild, wacky, and hairball task of figuring how a thing built in that language works/behaves.
Which tends to make one grateful for good documentation!
-r
-
Honest answer: because my coding knowledge stops at [space()] and [ansi()] to make pretty little color-coded charts.
-
@carma said in What's So Hard About Ruby?:
To the title of this thread, I say that learning any new language is a hard task, be it spoken, written, or typed. Some languages are harder than others. Consider if you titled this thread, "What's So Hard About Cantonese?" and your post were complaining about how Korean seems infinitely more finicky and picky.
The phrasing of the original question is perhaps off, but there's definitely conversation to be had re: 'Why are you finding X more difficult? I had trouble with Y, but X was relatively easy.'
It's a natural follow up question when someone says something is hard when you find a different, but related, thing hard instead. It's just phrased like jank.
ETA: That is to say 'what is it about X that is difficult for you' vs 'I don't get why X is hard for you, it's easy for me.'
-
This post is deleted! -
The title could maybe use a facelift - why do people think Ruby is harder to learn than python, or something. But the first paragraph does seem to clearly frame it as a Ruby vs. Python/softcode question.
I think it's also useful to note that within programming education circles, there are some languages that are objectively considered easier for beginners than others. (to reiterate - easiER not EASY).
This could be due to features of the language itself (a strongly-typed language like C# has extra hurdles than a weakly-typed one), the environment needed to run it in (Javascript can be experimented with straight in a browser using tools like jsfiddle), and other factors (block languages like those used in Scratch and code.org are visual and great for beginners).
There's not universal agreement on this, of course, but there is general consensus. And from that angle, both Ruby and Python are considered good "beginner" languages. No programming educator on earth would recommend starting off learning programming with a Lisp-based language like softcode.
(Site note: That doesn't mean softcode is a bad language - on the contrary, it's quite impressive and serves its intended purpose well. It's just such an unusual paradigm that it's not a great foundation for learning other programming languages. And I think that's why people struggle a bit with the softcode->Ruby/Python transition.)
-
@faraday said in What's So Hard About Ruby?:
I think that's why people struggle a bit with the softcode->Ruby/Python transition.
For me personally, it's because I'm not a 19-year-old who can stay up all night long reading help files and learning to MUSHcode.
Maybe not for everyone else, but it's not that Ruby/Python/whatever else are any easier or more difficult to learn. It's that I learned to code MUSH because it was my hobby, back when my hobby was the central part of my life. It's not anymore.
My brain-juice gets used for RPing instead of learning to code. I'll stay up late to finish a really good scene, but I'm way too mature nowadays to stay up all night coding. That's for geeks.
-
@krmbm said in What's So Hard About Ruby?:
For me personally, it's because I'm not a 19-year-old who can stay up all night long reading help files and learning to <snip!>
It's probably out of this thread's scope but that's one of the main causes professional developers eventually divert from their original career paths. In your 20s you can afford to enthusiastically stay up night after night wrestling with the cool new technologies, learning them inside and out and coding cool shit to hone your craft. In your 30s and 40s, with kids and a family, obligations, not to mention a body/mind that just can't handle going to sleep at 03:00 and getting up at 08:00 any more, it's a different story.
But having seen that from the other side it's not bad either way. Project managers (or managers in general) with strong technical skills get paid well. And veteran developers who might not be intimately familiar with every newfangled new toy but with a firm grasp on the fundamentals, able to architect and troubleshoot are always in demand, too.
-
@krmbm said in What's So Hard About Ruby?:
My brain-juice gets used for RPing instead of learning to code. I'll stay up late to finish a really good scene, but I'm way too mature nowadays to stay up all night coding. That's for geeks.
Ha! That hurts... because... it's true...
@arkandel said in What's So Hard About Ruby?:
@krmbm said in What's So Hard About Ruby?:
It's probably out of this thread's scope but that's one of the main causes professional developers eventually divert from their original career paths. SNIP
#facts
This is how some of us find our weapon of choice is interpersonal relationships, powerpoint, confluence, and periodically pointing out that the proposal is probably NP Hard as opposed to living in past lives of reflected DLLs, ROP chains, and reverse shells.
-r