Should I do functional programming in Ruby?

Y

Yu-Hsuan Lai

[Note: parts of this message were removed to make it a legal post.]

I'm a high school student and beginner of ruby.
I know that ruby is a functional-hybrid language which has many elegant
features such as first-class function, closure and implicit return.

But I also have heard the slogan "least astonishment".
I only used to learn C and C++. In my country, majority of students (school
or university) study C/C++/Java and self-study C#/VB/PHP/ASP. We seldom use
lisp or haskell.
I think that for most people, functional programming can cause much
astonishment.
Of course readability is important. So, should I write ruby in C-like
paradigm in order to decrease astonishment?
 
S

Stu

Only you can answer that question.

If your interested in programming in like C procedural you may feel
that it feels more like shell scripting than C. though you can and
there are helper objects which may make you feel at home for your data
structures (i.e. push pop) and there is also an implementation of
printf and sprintf.

Understand though that Ruby is as far as you can get from the whole
"showing the implementation" as you may be used to in C. Ruby is
object oriented to the extreme. Everything is a sender and a receiver.
Your return statements as well as parens are optional and implied.
Also case statements actually work and are not "broken" like they are
in c/c++/java.

The concept of "least astonishment" refers to programmers who migrate
from other languages may feel comfortable programming in ruby with
minor learning curve( if any).

I believe looking at what is unique ruby is what you may want to
investigate. Ruby has the ability to manipulate itself and evolve
through it's own meta-structures and introspection. I would imagine
functional programming though closures may play a role in this as
well. Though I also know it's optional. Just like everything else in
ruby the choice is yours.

~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top