I'm a Ruby girl, in a Python world (sung to the tune of "Barbie Girl")

(Daniel Hollands) #1

Continuing the discussion from Getting text from Twitter and making it accessible to a Python app:

After a lot of yak-shaving, and failure to get anywhere achieving my goals in Python (simply due to my lack of knowledge in Python), I’m thinking about switching to Ruby.

Although I’d class myself as a Rails dev, I’m not sure I can truly call myself a Ruby dev as I’ve not done anything in Ruby outside of Rails - I’m hoping this project can change that.

This introduces it’s own issues, such as the majority of support on the Pi for the GPIO being Python-based, but I think I have a couple of solutions.

Solution the first: Look for a UnicornHAT library written in Ruby. I think I’ve found one, but not (yet) spent any time exploring it - I shall do that at my first convience.

Solution the second: Ignore the fact the UnicornHAT is powered by python, and just treat it as any other CLI command. I have a python script which I simply fire text at to display, so if I do everything I need using Ruby, then simply fire off a CLI command when it comes to displaying some text, I think I’m golden.

It’s possible I’m ignoring a bunch of other solutions, or maybe even whimping out by ignoring Python, so I’m keen on hearing what you good folk think.

(Andy Wootton) #2

I think you’re wimping out. :slight_smile: You are returning to your comfort blanket. I’m having the same struggle trying to grok functional programming. Plough on. Ask the daft questions. It’s OK.

(Daniel Hollands) #3

I respect your opinion, but I need to look at the larger picture here - what benefits will I gain from learning Python, over solving the problem with Ruby?

Everything I learn from building a CLI app using Ruby will feed directly back into my current job, giving me a wider understanding of my chosen language. Trying to muddle my way though a language I have no experience might get me somewhere eventually, but at what cost?

I’m already a bit of a jack of all trades (and, as such, master of none) - maybe it’s time I started to focus a little more?

(Daniel Hollands) #4


(Steve Pitchford) #5

IMHO - Ruby is going the way of perl. Python has massive backing in education, and from where I am sitting, it looks like it’s set to go from strength to strength.

Have a quick read of “who moved my cheese”.


(Andy Wootton) #6

Another way of looking at this is that there are going to be a lot of very bright 14 year-olds with Python skills and you’ll be the only old Ruby hacker on the block :grinning:. It will be like speaking Gaelic or Latin. Talk to me some time about how useful my 25 years in VMS are now.

(Steve Jalim) #7

@LimeBlast Basic/core Python is so darn close to pseudocode, it won’t take you long to get into it

(Marc Cooper) #8

elixir: you know it’s the future. Here’s irrefutable proof from RedMonk http://redmonk.com/sogrady/2016/02/19/language-rankings-1-16/ Proof, I say. Irrefutable.

Heh ruby’s just fine. So’s perl if you know who’s using it. Though I don’t envy them.

(Steve Pitchford) #9

I know a few people, myself included - I’m not a python advocate, I’m just advocating python :wink:

(Andy Wootton) #10

I wonder where the supply vs demand sweet spot is on that graph.
I’d guess it isn’t in ‘code in a day’ JavaScript.

It’s clearly a true story about the functional revival: Common Lisp, Scheme, F#, Erlang, Clojure, Haskell, Scala - all in the top-right quadrant.

Is that Prolog, tucked in between FORTRAN and TypeScript?

(Andy Wootton) #11

“The most powerful programming language is Lisp. If you don’t know Lisp (or its variant, Scheme), you don’t know what it means for a programming language to be powerful and elegant. Once you learn Lisp, you will see what is lacking in most other languages.

Lisp is no harder to understand than other languages. So if you have never learned to program, and you want to start, start with Lisp.”

  • RMS

I think he’s probably right but if you ever want to feel more normal and balanced, read something RMS wrote: https://stallman.org/stallman-computing.html

In Clojure, I think Rich Hickey has improved Lisp.

(Jon) #12

There might be one, but it’s worth bearing in mind that one language won’t fit all anyway - there are lots of languages for a reason.

Even if we could distill languages down to a useful subset - perhaps for efficiency? - that would be no good, since most of us get emotionally invested in the ones we prefer. For example, I use (and enjoy) PHP, despite the vocal minority set hard against it. My determination to keep using it, then, is unlikely to be purely technical - it is also a semi-subconscious counter-reaction against an Reddit mob wielding sticks of fashionable outrage (Fractal Of Bad Design, I’m looking at you). It is a stand against the competitive principles of venture capitalist snark and the negativists who make a sport of tearing other people’s volunteer work to shreds.

Now, I expect the Perl folks feel the same way, probably because of the common (and incorrect) view that no-one uses it any more. Interestingly Ruby is getting a lot of negative mentions these days - always in comparison to Python - so perhaps Rubyists can relate to this as well. This feels odd to me, since although I don’t use Ruby, it doesn’t feel so long back that it was The New Clean Language With One True Web Framework :smile:

This is not to say that people should not critique languages - I think that’s fine - but I advocate against language warring, since what fits in each stack takes into account a very complex (and sometimes human) set of considerations.

(Marc Cooper) #13

You can’t infer a whole lot from either of the axes. More github projects could mean more use, that the language is incomplete or very flexible. The burst in elixir could just be folk trying it with exercism. More activity on SO could mean hard to use, or folk being more experimental.

Javascript is where it is because no-one understands it (SO) and because of all the JS frameworks (github) :wink:

(Marc Cooper) #14

I agree. Though I don’t agree with Stallman about Lisp. I do agree with him about c++. He said he stopped programming in 2008 and hasn’t done much since 1992. There’s been a lot of development since then.

The language itself is only a part of what makes a development tool powerful these days. You have to consider its entire ecosystem. For example: bindings, tooling, VM (if applicable), frameworks, concurrency (increasingly), ease of extension, ease of sharing extensions, and so on. I’ll even go so far as to include the people and atmosphere driving the language forward.

(Andy Wootton) #15

“there are lots of languages for a reason.”

There are lots of languages for many reasons and some of them aren’t very good reasons :slightly_smiling:

I’ve spent a lot of time trying to decide what modern ‘general purpose’ language to learn and the discussions I’ve had have been very instructive but I know my decision has been for both philosophical and very personal reasons. I’ve finally decided on Clojure (vs Scheme, Common Lisp & Haskell), JavaScript (vs Perl) and Python (vs Ruby & Java), for now.

(Andy Wootton) #16

I haven’t done enough Lisp to be sure yet but I’m very interested in the different way of thinking that goes with it. I’ve only just realised that my first language, Algol 68, ‘had functions as first class citizens’ too. I remember trying to do something recursively horrible with linked lists in Pascal in my first job, without proper type checking.

(Marc Cooper) #17

I know PHP well, and it’s the main tool where I’m currently working. I used it before it had OO added. I actually think they made a decent job of that. However, it is in no way a well-designed language, and it has serious problems outside of its intended purpose for building web-sites. (It’s cool that they improved its GC relatively recently, but it’s still super-super-basic.)

A large part of the problem with PHP, imo, is the insularity of its community. In addition, it took a long, long while to provide decent tools for collaboration; composer is a huge step up from PEAR.

When you say:

I feel sad. PHP is okay, but don’t feel the need to defend it. There really are other far, far better languages readily available to you.

I love ruby. It’s by far the most expressive and terse language I’ve ever used. And at the last count, I’d used over 20 of the damn things – I’m old :older_man:. I can write scripts in it. I can write OO style. I can write functional style. It can even curry for heaven’s sake and create lazy enumerators. Yet, I’m thrilled that something like elixir has come along and blown the gaff.

Why would you dig your heals in and insist on PHP just because you can make it work?

There’s a talk I used to give called: Working software is useless. The point being that software can always be made to work. Always. It just takes time. Working software is what the unenlightened think is sufficient. What the world really needs is working maintainable software. That’s a completely different ball game.

You can make maintainable PHP, but it requires a level of discipline and skill I’ve never encountered in the PHP community. Being back in that domain, the word I used recently to describe the pace of change was glacial – I’m the old guy, remember! Everyone’s younger than me. The problem, however, is the insularity. It’s always been that way, and they can’t see the problem.

PHP isn’t crap. You can build stuff in it just fine. But it’s old and cranky and a million miles from what’s really going on in the world. I hope you find it in you to add another string to your bow.

(Jon) #18

I don’t agree with the implied premise that “it just about works”. Notwithstanding, I reiterate that the mental processes are not entirely conscious - it’s for all the reasons I set out above. Incidentally, don’t focus too much on the example of PHP - as I say, I think a number of old and cranky languages are chosen or stuck with for emotional or subjective reasons. Our scientific-rationalist selves could pick a fight with mother nature, I suppose, and tell her off for being wrong (or human), but it’s not a sensible errand!

I am quite sure you meant that with positivity, but given that it is essentially a criticism, what I see on the screen is “you are an inadequate programmer until you have learned X”. Now, that may be true, but - coming back to the human element again - how we argue for and against technology matters a great deal. Actually - find it in you - inadequate person? My response indicates - perhaps to both of us :slightly_smiling: - how emotionally invested we are in these things.

For what it is worth, I would moderately like to learn another language - I even have a NodeJS book waiting patiently on the shelf. However I have a much stronger drive to build a tech product, and for that, my current technologies do just fine.

Not a snarky aside: I am very glad that Ruby works for you!

(Marc Cooper) #19

It works great, although in a very narrow area.[quote=“halfer, post:18, topic:2398”]
I think a number of old and cranky languages are chosen or stuck with for emotional or subjective reasons.
I promise you that I am unashamedly promiscuous when it come to programming languages.

I did. Reading it back, it’s not great, though :frowning:

I’m not. Honestly. #1 metric: Get stuff done.

There’s no way node will convince you that there’s a better world out there than PHP, imo.

(Matt Andrews) #20

It might do if you’re already used to client-side paradigms and working in JS – last time I did anything with PHP I had a filesystem littered with random .phar files (what?) and had to do all sorts of global installs to get the right versions playing nicely. Doubtless people have the same experiences with npm/package.json but I don’t think this should discourage people from giving it a try.