Fork me on GitHub
#other-languages
<
2022-04-27
>
didibus04:04:39

There's so many ruby/rails job, I feel all the jobs are using that stack. I guess rails is truly the startup king.

didibus04:04:17

As someone who never did Ruby or rails, how likely am I to like/hate it as someone who loves Clojure?

Cora (she/her)04:04:26

I did ruby/rails for a decade and I'm frankly a little scarred from it. I think I could go back now and it wouldn't be the worst. things have stabilized a lot since I left

seancorfield06:04:54

I'm very opinionated about languages -- because I did my PhD on language design and I worked for compiler and tool vendors for years and did eight years on the C++ Standards Committee -- and I hate Ruby with a pink and purple passion. I took Washington U's "Programming Languages" MOOC online and was a community teaching assistant for several runs of it, and it showcases PL techniques using Racket (fine), SML (wonderful), and Ruby (ugh!)... and it really just cemented how much I detest Ruby.

Noah Bogart12:04:05

This is so surprising to me! Mind giving some explanations for why you dislike Ruby so much?

seancorfield16:04:05

@UEENNMX0T Part of it is purely subjective: I just don't like the syntax on a fairly visceral level -- a lot of Ruby reads like Perl to me, full of "punctuation" instead of words. In particular, stuff like @, @@, and $ to identify different scopes of variables, and => in hashes. My other big complaint is that you can't just look at a piece of code in isolation and know what it does -- because classes are mutable at runtime so even something like a + b could mean anything and with 19 levels of precedence on top of that, readability and comprehensibility are compromised IMO. Then there's the "ten ways to do anything" aspect of it. Even the most basic tutorials tend to introduce anything from three to six ways to do almost everything, so there's no consistency of style in Ruby code because different devs will gravitate to different styles.

👍 1
seancorfield16:04:11

There's also stuff that Ruby gets right: everything is an object (like Smalltalk and very unlike Java). And. Um. Can't think of anything else it gets right 🙂

😂 1
Noah Bogart16:04:18

Haha that makes sense. I think it got a little more right than that but it's all a matter of opinion and you're right that some of the warts (mutable classes being the big one) are truly awful for understanding a chunk of code. Things I think Ruby gets right: Everything is an object, expression-oriented, lexical scope, massive standard library, and &block parameters.

didibus16:04:20

Is it expression oriented? Are methods not allowed to return void? And if, else, while always return something?

didibus16:04:20

I feel apart from the syntax, which I also for some reason dislike superficially. Your other criticism could apply to Clojure no? Many ways to do things, lots of punctuation in the syntax @ # { ( [ _ etc. And you can too monkey patch anything, could redef core functions if you wanted.

seancorfield06:04:23

(I don't hate Ruby because I love Clojure -- I hate Ruby for a lot of other reasons tho')

seancorfield06:04:07

I will say that I quite like Python (the 2.7/3.x split was why I've never really got into actually using it in earnest). I despise PHP for a lot of the same reasons I dislike Ruby. I've grown to dislike Scala, after using it in production for about 18 months. I quite like Groovy, and I really like Kotlin. But I strongly dislike Go. I hate JS. I love Elm. How's that for a varied set of likes and dislikes? 🙂

seancorfield06:04:55

(and I also think Rails is horrific, for completely different reasons than my dislike of Ruby itself -- I don't like Grails either and I have encountered Rails clones in other tech that I've also heartily disliked)

seancorfield06:04:30

These opinions are my own and are not endorsed by my employer or... anyone else 🙂

😅 1
😄 2
Mno07:04:08

Ruby is a high level dynamic language that tries to be as friendly as it can to the programmer (partially by trying to look like English as much as it can) This leads it to have many repeated convenience functions and magical type conversions and idiosincracies that will start to hurt once you move away from the language and community conventions. The same applies to rails, but with even stronger effect. The entire community is mostly convention over configuration. Which leads to things being done quickly as long as they're within the 80% of cases they like to cover, which is why it's good for startups. (scalability of it has been improving tho) I worked professionally with it for a couple of years, and didn't suffer much at the time and ocasionally do contract work in it, but I don't think I could do longterm work on it without missing clojure too much

dgb2308:04:35

Convention over configuration just smells like “magical, implicit coupling” to me, which can lead to the most frustrating type of programmer work: blackbox debugging. Conventions are very good if they are data-driven and exposed and/or just about naming and directory structure without implicit assumptions from consuming code. I don’t have much ruby experience outside of scripting, but I assume it’s kind of similar or maybe worse to what we have in the PHP and JS world. That’s why I’m incredibly happy with the combination of deps.edn, polylith and integrant. It’s all just dumb, data-driven stuff - no cleverness. It’s very easy to move around stuff, have different setups and variations for development and production, inspect things and pull things out to interact with.

Mno08:04:17

It is, yes, that's precisely a problem it has, and just like those languages you end up adjusting to them and end up with a sort of stockholm syndrome for the language. I'd argue that it's a bit more sane, because at least the language itself is fairly small. It does however have an amazing amount of useful and somewhat maintained documentation because everyone does the same stuff so runs into similar problems

👍 1
dgb2309:04:01

This fundamentally comes down to what good abstractions are: clear assumptions, strong guarantees and simple relationships. If any of those things are broken, then you lose the ability to understand and extend things without making something that is inherently broken too. Except you try to build a sane layer on top of it while hoping they don’t pull the rug from under you. And this is not just__ me being snarky and grouchy. It’s years of pain and scars versus being happy, productive and confident. When the code I work with is sufficiently simple and clear, then I’m in a deeply relaxed and hyperfocused state, there is nothing I cannot do and I move with great confidence and curiosity. Discipline is then driven by a desire to care and create, instead of fear and frustration.

❤️ 2
Joe15:04:05

This is a bit off-piste: I'm having some trouble with PDP11 assembly, but I think it's a pretty generic problem, so I'm hoping someone can help...

Joe15:04:47

The PDP11 stores 16bit "words" in 2 8bit (lo and hi byte) locations. Instructions can operate on a word, or in "byte mode", operating on a single byte. There is one operation, COMB which is the byte-mode version of the "One's Complement operation", which from what I can tell flips all the bits in a binary number. As an illustration of this, it provides the example of COMB 200(R1) on page 36/37 of the handbook, https://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf. This uses the indexing addressing mode, but that's not relevant here. The crux is that it's performing COMB on (octal) address 020177. The word at location 020177|020176 contains (again, octal) 011|000 before the operation, and 166|000 after the operation. The problem I'm having is that I can't figure out how they get to that. I think a lot of it is that I'm finding working in octal very tough. There are 3 possible options I can think of, but none of them work. If I interpret 011|000 as two bytes with binary equivalent 00001001|00000000, then one's complement of the hi-byte is 11110110, or 366 in octal, which would suggest the output should be 366|000. If I interpret the word 011000 as a 16bit number, that's 0001 0010 0000 0000, with ones complement 1110 1101 1111 1111, or 166777. That has the 166 from the answer in the handbook so is maybe partially right? But it seems to contract the "Byte Mode" flag. If I decompose the word 011000 into hi and lo bytes I get 022|000, and if I then do ones complement on the hi-byte, 355|000. As a Word, that is 166400. Again close, but no cigar. I'm stumped, I'm either misunderstanding how octal works or how one's complement works.

dgb2316:04:37

It adds the octal 200 to it before the complement

dgb2316:04:42

and it only operates on the frist byte

dgb2316:04:51

in decimal its 9 + 128 = 137. convert to binary and do the complement = 01110110, in octal = 166

Joe16:04:50

Interesting. That works, but it seems to contradict the description of that operation. My interpretation was that COMB 200(R1) adds octal 200 to register 1 (017777) to get the address of the register to operate on (020177), but that the 200 doesn't affect the outcome of the operation itself. The description is > The contents of a location which is determined by adding 200 to the contents of R1 are one's complemented (i.e. logically complemented)

Joe16:04:51

Thanks for the help!

👍 1
didibus16:04:46

Damn, I was hoping for reassurance that I'd like Ruby, but it sounds like I'd hate it too. I already don't like its syntax, cause I've never been into the VB like syntax of it's just English but spoken like a robot, and everything is enclosed in start and end words. Blocks seem neat, though I'm not sure of the point of it over a lambda. After that it does seem to just suffer from being a dynamic language that provides no redeeming qualities for correctness. Clojure at least has an interactive REPL, immutability, in-order dependencies, and static function arity checks to make it manageable.

Cora (she/her)16:04:08

someone here recently called it "ruthlessly productive" as a language and I'd agree with that. you can make a lot really quickly, especially database-driven websites. it starts to really suck due to a lot of ruby stuff not caring about backwards compatibility and for it getting unwieldy in very large apps. the primary framework that makes it so productive, rails, definitely has some design issues

Cora (she/her)16:04:43

I'm a bit of a dirtbag polyglot and like a lot of different languages for different reasons. I left ruby because of upgrade woes and dealing with complexity at scale sucked. but we managed to make transcoding-as-service that scaled to over 1k servers doing transcoding all using ruby

Noah Bogart16:04:53

Love the phrase “dirtbag polyglot”

💜 1
Cora (she/her)16:04:45

it's how I feel! a lot of people feel other languages are like dirty or gross or something and I'm just entirely unbothered

😂 1
Noah Bogart16:04:41

Yeah same. I love learning new languages and seeing how language design shapes my problem solving.

Cora (she/her)17:04:40

and also how other languages influence each other and different social contexts and maybe things I can bring back to the languages I work in

Cora (she/her)17:04:55

and also sometimes another language is just the right tool for the job

☝️ 1
seancorfield22:04:04

Learning new languages is definitely good for you! The Pragmatic Programmer suggests trying to learn a new one every year but I think that's a bit aggressive... I try to learn a new one every 18 months to 2 years even if I don't get much beyond the basic tutorials...

Cora (she/her)16:04:50

so it ain't all bad

Cora (she/her)16:04:49

it really depends on your sensibilities and what you're willing to be flexible about, what you're willing to put up with as trade-offs

Cora (she/her)16:04:01

I think I mentioned in here earlier that the community has really settled down quite a bit with the backwards incompatibility problems in recent years and the language has matured a bunch and there are even tools now to do static typing that help with overcoming some of the weaknesses

Cora (she/her)16:04:25

I think the "reads as english" is a pretty surface-level observation of the language and it really doesn't read as english in any real code. I don't know why people promote it that way

Cora (she/her)16:04:07

it finally got real parallelism recently, too, using something like actors

didibus16:04:58

Ya, I could get over syntax, since that's just superficial. I hated lisp syntax the first time around as well. With Ruby's it's just I'm too lazy to type end when one character delimiter would do and visually looks like a delimiter as well 😝

didibus16:04:35

I can say that I do really like websites that are using Rails, it's more the design of them, it tends to always be pretty good. I don't know if it's that Ruby attracts more people with design talent, or somehow Rails default templates all start you off with really nice layout and css or something haha

Cora (she/her)16:04:54

your editor can fill in the end

Cora (she/her)16:04:23

rails templates are erb which is really designer friendly

Cora (she/her)16:04:26

alongside automatic hot reloading you can do a lot of styling and html without knowing too much technical info

Noah Bogart16:04:18

Haha that makes sense. I think it got a little more right than that but it's all a matter of opinion and you're right that some of the warts (mutable classes being the big one) are truly awful for understanding a chunk of code. Things I think Ruby gets right: Everything is an object, expression-oriented, lexical scope, massive standard library, and &block parameters.

Cora (she/her)16:04:33

I do a lot of frontend work and I am not a hiccup fan

Cora (she/her)16:04:51

but like anything there are trade offs ¯\(ツ)

didibus16:04:22

That's a good point. Hiccup is really programmer friendly, not so much designer friendly.

didibus16:04:35

Let's say you use Rails, and you want to use Cassandra as your database? Are you kind of screwed because it's all defaulting to assuming a specific SQL DB for example?

didibus16:04:07

How much does it lock you in as a framework?

didibus16:04:38

Also curious about the tooling around it? Is that good!

Cora (she/her)17:04:30

you don't need to use their db library

Cora (she/her)17:04:38

you can use whatever you like

Cora (she/her)17:04:25

you can swap out templating libraries, too

Cora (she/her)17:04:44

serializing to and from xml and json is trivial, they're built into the framework and the language

Cora (she/her)17:04:54

same with yaml and csv

Cora (she/her)17:04:15

the trickier parts come from if there is a library for the db you want to use that's available for ruby

Cora (she/her)17:04:31

oh and their db library supports a number of different sql databases

Cora (she/her)17:04:00

anyways, a lot of these things are worth trying. laravel in php-land is pretty nice too

Noah Bogart17:04:14

Laravel is great and php is a good language now. It’s wild

didibus17:04:48

Hum, ok, maybe that's what I'd need to do is give it some love and try it out

Cora (she/her)17:04:20

the worst outcome is you don't like it but know a bit more about it, which is pretty decent considering

didibus17:04:30

The job market is moving towards JS, Ruby more and more it seems. So I might need to get familiar with them.

Cora (she/her)17:04:57

python is huge, too

Cora (she/her)18:04:15

I mean so are java and dotnet and C

Cora (she/her)18:04:54

but the more startup-y jobs definitely seem to favor the scripting languages

didibus18:04:18

I don't see as much Python that's not data-science/ml related though. So anything that's likes PaaS, SaaS, webapps, apps, fintech, backend, seems to not be in Python.

Carlo20:04:41

I want the same thing! I'd happily be the other person 😂

👥 1
didibus18:04:04

And the enterprisy stuff like C#, Java, Go, Rust, etc., they tend to not offer the more competitive benefits of like 4 day work week, or 20h weeks, etc. That's what got me asking about Ruby haha. Was looking at http://4dayweek.io and it was all Ruby or JS

🙌 1
didibus18:04:28

Maybe Clojure startups should set a new trend. I want full time 5 days a week, 8h days, but only 6 months a year 😛 Pay me 50% with full health care benefits. Get another person to do the other half of the year in alternation, same role, same position. The business doesn't even lose out anything, they end up paying the same amount (a bit more for full health care I guess), and they still have someone full time all year.

☝️ 1
Carlo20:04:41

I want the same thing, and I don't understand how it's not more obvious to businesses that this would have many benefits! I would happily be the other person 😂

👥 1
didibus20:04:43

And it be really good for the economy as well, employ twice as many people.

robertfw15:04:02

Sign me up 😄 I finally got to a 4 day work week this past year and it is such a game changer. Not having to "ration" my energy out throughout the week makes such a difference.