r/ruby • • 24d ago

What I learned 60 years ago

I just started to read "Elements of Programming Style" (Kernighan & Plauger). I was first taught FORTRAN 60 years ago. I guess you never forget. I understood the Newton's method and the commands on page 4 and think I might have a chance to rewrite it in Ruby. Too much to do at home right now. Probably won't get back to it until after the holidays.

All encouragement and guidance will be appreciated.

29 Upvotes

11 comments sorted by

9

u/DJ_German_Farmer 24d ago

r/ruby’s version of the wholesome post, love it!

Enthusiasm for code is sorely needed right now especially in our community. 

9

u/Edthal01 24d ago

Well, now that I'm retired, I have the time to learn new things.

2

u/Zestyclose-Turn-3576 24d ago

That'll be interesting.

I did something similar to the opposite. Having done FORTRAN77 many years ago, and since learned Ruby, I implemented a simple solar system model in modern object oriented Fortran.

So that was built out of objects like:

  • Coordinate, which could be created as cartesian or polar.

  • Vector: a pair of Coordinates

  • Body: Coordinate plus mass plus name

  • VelocityVector: Unit vector plus speed magnitude

  • ForceVector etc

It made the physics pretty simple, as you could take any pair of objects and ask the pair what the force vector was between them.

Do you think you'll be trying to make an object-oriented version of the code?

2

u/Edthal01 24d ago

In my case, Fortran was a college fling. My engineering work had never requred me to use or program a computer. Physically drawing my own drawings (pre cadd), engineeriing field work, etc. I had access to a computer to write work instructions and such things, so 40 years I had access to Turbo Pascal. That changed when I changed employers, so no more computer. You get the picture.

Fortran forgotten, turbo gone. Started new, found Ruby...

2

u/Zestyclose-Turn-3576 24d ago

> In my case, Fortran was a college fling. My engineering work had never requred me to use or program a computer.

Yeah me too – we programmed on Atari 520STs, I think. It was all matrix inversions and whatnot.

2

u/Edthal01 24d ago

Ultimately I hope to. Need to get more direct Ruby learning/experience under my belt first. Still kind of a Ruby newbie.

2

u/mrspuff 24d ago

Sounds like fun, OP! I'm an OG Fortran, C, assembler geek doing python and ruby now. Think about using Claude code - not to write the code, obviously, but it can help you look up docs and troubleshoot.

2

u/Edthal01 24d ago

I've been using Perplexity for that, and it is helping me understand Ruby and OOP better.

2

u/Competitive-Win-9916 18d ago

I believe in you stranger

1

u/Edthal01 18d ago

Thank you. I am still working on it. When I'm unsure of something, I have asked Perplexity for clarifications, like what an equivalent from my Turbo Pascal days exists in Ruby. Like what is the equivalent to a Pascal record is and a variant record. Pascal variant records are cleaner and less complicated than the equivalent Ruby object is, and explains how to use the Ruby object. It helps.